Skip to content

Commit

Permalink
Undo whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre99999999 committed Nov 1, 2024
1 parent bb1a8ee commit e05a4fc
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions pwiz/data/msdata/Serializer_MGF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ class Serializer_MGF::Impl
void read(shared_ptr<istream> is, MSData& msd) const;
};

template <typename T>
struct nosci10_policy : boost::spirit::karma::real_policies<T>
{
// we want to generate up to 10 fractional digits
static unsigned int precision(T) { return 10; }
// we want the numbers always to be in fixed format
static int floatfield(T) { return boost::spirit::karma::real_policies<T>::fmtflags::fixed; }
template <typename T>
struct nosci10_policy : boost::spirit::karma::real_policies<T>
{
// we want to generate up to 10 fractional digits
static unsigned int precision(T) { return 10; }
// we want the numbers always to be in fixed format
static int floatfield(T) { return boost::spirit::karma::real_policies<T>::fmtflags::fixed; }
};


Expand All @@ -78,25 +78,25 @@ void Serializer_MGF::Impl::write(ostream& os, const MSData& msd,
SpectrumList& sl = *msd.run.spectrumListPtr;
SpectrumWorkerThreads spectrumWorkers(sl, useWorkerThreads, continueOnError);
for (size_t i=0, end=sl.size(); i < end; ++i)
{
SpectrumPtr s;
try
{
// s = sl->spectrum(i, true);
s = spectrumWorkers.processBatch(i);
}
catch (std::exception& e)
{
if (continueOnError)
{
{
SpectrumPtr s;
try
{
// s = sl->spectrum(i, true);
s = spectrumWorkers.processBatch(i);
}
catch (std::exception& e)
{
if (continueOnError)
{
cerr << "Skipping spectrum " << i << " \"" << (s ? s->id : sl.spectrumIdentity(i).id) << "\": " << e.what() << endl;
continue;
}
else
throw;
}
else
throw;
}

const Scan& scan = !s->scanList.empty() ? s->scanList.scans[0] : Scan();
Scan* scan = !s->scanList.empty() ? &s->scanList.scans[0] : 0;

if (s->cvParam(MS_ms_level).valueAs<int>() > 1 &&
!s->precursors.empty() &&
Expand All @@ -105,16 +105,16 @@ void Serializer_MGF::Impl::write(ostream& os, const MSData& msd,
os << "BEGIN IONS\n";

const SelectedIon& si = s->precursors[0].selectedIons[0];
CVParam scanTimeParam = scan.cvParam(MS_scan_start_time);
CVParam scanTimeParam = scan ? scan->cvParam(MS_scan_start_time) : CVParam();
CVParam chargeParam = si.cvParam(MS_charge_state);

CVParam spectrumTitle = s->cvParam(MS_spectrum_title);
if (!spectrumTitle.empty())
os << "TITLE=" << spectrumTitle.value << '\n';
else if (titleIsThermoDTA)
{
string scan_string = id::value(s->id, "scan");
os << "TITLE=" << thermoBasename << '.' << scan_string << '.' << scan_string << '.' << chargeParam.value << '\n';
string scan = id::value(s->id, "scan");
os << "TITLE=" << thermoBasename << '.' << scan << '.' << scan << '.' << chargeParam.value << '\n';
}
else
os << "TITLE=" << s->id << '\n';
Expand All @@ -132,12 +132,12 @@ void Serializer_MGF::Impl::write(ostream& os, const MSData& msd,
os << " " << intensityParam.valueFixedNotation();
os << '\n';

CVParam inverseReduceIonMobility = scan.cvParam(MS_inverse_reduced_ion_mobility);
CVParam inverseReduceIonMobility = si.cvParam(MS_inverse_reduced_ion_mobility);
if (!inverseReduceIonMobility.empty())
os << "INVREION=" << inverseReduceIonMobility.valueFixedNotation();
os << '\n';

CVParam collisionalCrossSectionalArea = scan.cvParam(MS_collisional_cross_sectional_area);
CVParam collisionalCrossSectionalArea = si.cvParam(MS_collisional_cross_sectional_area);
if (!collisionalCrossSectionalArea.empty())
os << "COLLCROSSSA=" << collisionalCrossSectionalArea.valueFixedNotation();
os << '\n';
Expand All @@ -158,9 +158,9 @@ void Serializer_MGF::Impl::write(ostream& os, const MSData& msd,

const BinaryDataArray& mzArray = *s->getMZArray();
const BinaryDataArray& intensityArray = *s->getIntensityArray();
using namespace boost::spirit::karma;
typedef real_generator<double, nosci10_policy<double> > nosci10_type;
static const nosci10_type nosci10 = nosci10_type();
using namespace boost::spirit::karma;
typedef real_generator<double, nosci10_policy<double> > nosci10_type;
static const nosci10_type nosci10 = nosci10_type();
char buffer[256];
for (size_t p=0; p < s->defaultArrayLength; ++p)
{
Expand Down

0 comments on commit e05a4fc

Please sign in to comment.