Skip to content

Commit

Permalink
fix refinement bug, update version number
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkovalchik committed Nov 9, 2018
1 parent 74b5d82 commit 69b754f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
2 changes: 1 addition & 1 deletion RawTools/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ static int DoStuff(ArgumentParser.ParseOptions opts)
if (opts.WriteMGF)
{
MGF.WriteMGF(rawData: rawData, rawFile: rawFile, outputDirectory: opts.OutputDirectory, cutoff: opts.MassCutOff,
intensityCutoff: opts.IntensityCutoff);
intensityCutoff: opts.IntensityCutoff, refineMassCharge: opts.RefineMassCharge);
}

if (opts.Metrics)
Expand Down
4 changes: 2 additions & 2 deletions RawTools/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("7.11.2018.10")]
[assembly: AssemblyFileVersion("9.11.2018.2")]

[assembly: AssemblyInformationalVersion("1.3.1")]
[assembly: AssemblyInformationalVersion("1.3.2")]
33 changes: 32 additions & 1 deletion RawTools/Write/DataWrite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using RawTools.Data.Extraction;
using RawTools.Utilities;
using RawTools.QC;
using RawTools.Algorithms;
using ThermoFisher;
using ThermoFisher.CommonCore.Data.Business;
using ThermoFisher.CommonCore.Data.Interfaces;
Expand Down Expand Up @@ -209,7 +210,7 @@ public static void WriteMatrix(RawDataCollection rawData, ScanMetaDataCollection

static class MGF
{
public static void WriteMGF(RawDataCollection rawData, IRawDataPlus rawFile, string outputDirectory, double cutoff = 0, int[] scans = null, double intensityCutoff = 0.01)
public static void WriteMGF(RawDataCollection rawData, IRawDataPlus rawFile, string outputDirectory, double cutoff = 0, int[] scans = null, double intensityCutoff = 0.01, bool refineMassCharge = false)
{
double intCutoff = 0;
string fileName = ReadWrite.GetPathToFile(outputDirectory, rawData.rawFileName, ".mgf");
Expand All @@ -227,8 +228,38 @@ public static void WriteMGF(RawDataCollection rawData, IRawDataPlus rawFile, str
operations.Add(Operations.Ms2SegmentedScans);
}

if (refineMassCharge) operations.Add(Operations.Ms1CentroidStreams);

CheckIfDone.Check(rawData, rawFile, operations);

if (refineMassCharge)
{
ProgressIndicator P = new ProgressIndicator(rawData.scanIndex.ScanEnumerators[MSOrderType.Ms2].Length, "Refining precursor charge state and monoisotopic mass");
P.Start();
int refinedCharge;
double refinedMass;

//if (!rawData.Performed.Contains(Operations.PeakRetAndInt))
//{
// rawData.CalcPeakRetTimesAndInts(rawFile);
//}

foreach (int scan in rawData.scanIndex.ScanEnumerators[MSOrderType.Ms2])
{
// refine precursor mass and charge
// var centroid = rawData.GetAverageScan(rawFile, scan);
//rawData.centroidStreams[rawData.precursorScans[scan].MasterScan]

(refinedCharge, refinedMass) =
MonoIsoPredictor.GetMonoIsotopicMassCharge(rawData.centroidStreams[rawData.precursorScans[scan].MasterScan],
rawData.precursorMasses[scan].ParentMZ, rawData.trailerExtras[scan].ChargeState);
rawData.trailerExtras[scan].ChargeState = refinedCharge;
rawData.precursorMasses[scan].MonoisotopicMZ = refinedMass;
P.Update();
}
P.Done();
}

const int BufferSize = 65536; // 64 Kilobytes

using (StreamWriter f = new StreamWriter(fileName, false, Encoding.UTF8, BufferSize)) //Open a new file, the MGF file
Expand Down
4 changes: 3 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
but the meta data was incomplete. To address this, the scan lists RawTools uses to process are now built off of the scan dependents found in the
raw file meta data. This means scans which are missing meta data will not appear in the output data table. Note that these occurances are rare, and
we are planning to add a text output to alert the user when this happens.
- The examples have been updated. There are now two sections to the examples function: --interface and --modifications.

### Fixed
- MS3ScanRate was not referecing the correct data. Is fixed now.
- MS3ScanRate was not referencing the correct data. Is fixed now.
- Fixed a bug which caused a crash when MS scan data was absent or corrupted for a scan.
- Fixed a bug where precursor charge state and monoisotopic m/z was not refined when the only output was an MGF file.

## [1.3.1] 2018-10-26
### Fixed
Expand Down

0 comments on commit 69b754f

Please sign in to comment.