Skip to content

Commit 1ad5d2a

Browse files
author
stefanks
authored
Merge pull request #294 from smith-chem-wisc/StefanBranch
fix bug with precursorScanBestMass
2 parents c616914 + 1cd6725 commit 1ad5d2a

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

EngineLayer/PsmParent.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public abstract class PsmParent
3636
#region Internal Fields
3737

3838
internal readonly int notch;
39+
internal double? precursorScanBestMass;
3940

4041
#endregion Internal Fields
4142

EngineLayer/PsmWithMultiplePossiblePeptides.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ public class PsmWithMultiplePossiblePeptides
1717

1818
#endregion Public Fields
1919

20-
#region Private Fields
21-
22-
private double? precursorScanBestMass;
23-
24-
#endregion Private Fields
25-
2620
#region Public Constructors
2721

2822
public PsmWithMultiplePossiblePeptides(PsmParent newPsm, HashSet<PeptideWithSetModifications> peptidesWithSetModifications, Tolerance fragmentTolerance, IMsDataFile<IMsDataScan<IMzSpectrum<IMzPeak>>> myMsDataFile, List<ProductType> lp)
@@ -70,10 +64,10 @@ public PsmWithMultiplePossiblePeptides(PsmParent newPsm, HashSet<PeptideWithSetM
7064
PeptideMonoisotopicMass = representative.MonoisotopicMass;
7165

7266
// Look for better match in MS1 spectrum!!!
73-
if (myMsDataFile != null && !precursorScanBestMass.HasValue)
67+
if (myMsDataFile != null && !newPsm.precursorScanBestMass.HasValue)
7468
{
7569
var precursorScan = myMsDataFile.GetOneBasedScan(newPsm.precursorScanNumber);
76-
precursorScanBestMass = precursorScan.MassSpectrum.GetClosestPeakXvalue(this.PeptideMonoisotopicMass.ToMz(this.newPsm.scanPrecursorCharge)).ToMass(this.newPsm.scanPrecursorCharge);
70+
newPsm.precursorScanBestMass = precursorScan.MassSpectrum.GetClosestPeakXvalue(this.PeptideMonoisotopicMass.ToMz(this.newPsm.scanPrecursorCharge)).ToMass(this.newPsm.scanPrecursorCharge);
7771
}
7872

7973
FullSequence = representative.Sequence;
@@ -187,9 +181,9 @@ public override string ToString()
187181
sb.Append((ScanPrecursorMass - PeptideMonoisotopicMass).ToString("F5", CultureInfo.InvariantCulture) + '\t');
188182
sb.Append(((ScanPrecursorMass - PeptideMonoisotopicMass) / PeptideMonoisotopicMass * 1e6).ToString("F5", CultureInfo.InvariantCulture) + '\t');
189183

190-
sb.Append(precursorScanBestMass.Value.ToString("F5", CultureInfo.InvariantCulture) + '\t');
191-
sb.Append((precursorScanBestMass - PeptideMonoisotopicMass).Value.ToString("F5", CultureInfo.InvariantCulture) + '\t');
192-
sb.Append(((precursorScanBestMass - PeptideMonoisotopicMass) / PeptideMonoisotopicMass * 1e6).Value.ToString("F5", CultureInfo.InvariantCulture) + '\t');
184+
sb.Append(newPsm.precursorScanBestMass.Value.ToString("F5", CultureInfo.InvariantCulture) + '\t');
185+
sb.Append((newPsm.precursorScanBestMass - PeptideMonoisotopicMass).Value.ToString("F5", CultureInfo.InvariantCulture) + '\t');
186+
sb.Append(((newPsm.precursorScanBestMass - PeptideMonoisotopicMass) / PeptideMonoisotopicMass * 1e6).Value.ToString("F5", CultureInfo.InvariantCulture) + '\t');
193187

194188
if (IsDecoy)
195189
sb.Append("D");

0 commit comments

Comments
 (0)