Skip to content

Commit

Permalink
[Ref] Insert meaningful "NA"s in CSV reports
Browse files Browse the repository at this point in the history
  • Loading branch information
saif-el committed Feb 27, 2021
1 parent 813ac49 commit aaa6600
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions src/core/libmaven/csvreports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ void CSVReports::_writeGroupInfo(PeakGroup* group)
string compoundName = "";
string compoundID = "";
string formula = "";
float expectedRtDiff = 0;
float ppmDist = 0;
float expectedRtDiff = -1.0f;
float ppmDist = -1.0f;
if (group->hasCompoundLink()) {
compoundName = _sanitizeString(
group->getCompound()->name().c_str()).toStdString();
Expand All @@ -326,13 +326,16 @@ void CSVReports::_writeGroupInfo(PeakGroup* group)
compoundID = compoundName;
}

string expRtString = expectedRtDiff < 0.0f ? "NA"
: to_string(expectedRtDiff);
string ppmDistString = ppmDist < 0.0f ? "NA" : to_string(ppmDist);
_reportStream << SEP << compoundName
<< SEP << compoundID
<< SEP << formula
<< setprecision(3)
<< SEP << expectedRtDiff
<< SEP << expRtString
<< setprecision(6)
<< SEP << ppmDist;
<< SEP << ppmDistString;

if (group->parent != NULL) {
_reportStream << SEP << group->parent->meanMz;
Expand Down Expand Up @@ -407,13 +410,13 @@ void CSVReports::_writePeakInfo(PeakGroup* group)
<< SEP << sampleName
<< SEP << (adduct == nullptr ? "" : adduct->getName())
<< SEP << "C12 PARENT"
<< SEP << 0.0f
<< SEP << 0.0f
<< SEP << 0.0f
<< SEP << "NA"
<< SEP << "NA"
<< SEP << "NA"
<< setprecision(3)
<< SEP << 0.0f
<< SEP << 0.0f
<< SEP << 0.0f
<< SEP << "NA"
<< SEP << "NA"
<< SEP << "NA"
<< SEP << 0.0f
<< setprecision(2)
<< SEP << 0.0f
Expand All @@ -424,7 +427,7 @@ void CSVReports::_writePeakInfo(PeakGroup* group)
<< SEP << 0.0f
<< SEP << 0.0f
<< SEP << 0.0f
<< SEP << 0
<< SEP << "NA"
<< endl;
}
} else if (group->isGhost()) {
Expand Down Expand Up @@ -536,13 +539,13 @@ void CSVReports::_writePeakInfo(PeakGroup* group)
<< SEP << sampleName
<< SEP << adductName
<< SEP << tagString
<< SEP << 0.0f
<< SEP << 0.0f
<< SEP << 0.0f
<< SEP << "NA"
<< SEP << "NA"
<< SEP << "NA"
<< setprecision(3)
<< SEP << 0.0f
<< SEP << 0.0f
<< SEP << 0.0f
<< SEP << "NA"
<< SEP << "NA"
<< SEP << "NA"
<< SEP << 0.0f
<< setprecision(2)
<< SEP << 0.0f
Expand All @@ -553,7 +556,7 @@ void CSVReports::_writePeakInfo(PeakGroup* group)
<< SEP << 0.0f
<< SEP << 0.0f
<< SEP << 0.0f
<< SEP << 0
<< SEP << "NA"
<< endl;
}
}
Expand Down

0 comments on commit aaa6600

Please sign in to comment.