1
1
using MassSpectrometry ;
2
+ using MzLibUtil ;
2
3
using Proteomics ;
3
4
using Spectra ;
4
5
using System ;
@@ -21,12 +22,12 @@ public class AnalysisEngine : MyEngine
21
22
private readonly int maxModIsoforms ;
22
23
private readonly PsmParent [ ] [ ] newPsms ;
23
24
private readonly List < Protein > proteinList ;
24
- private readonly List < MetaMorpheusModification > variableModifications ;
25
- private readonly List < MetaMorpheusModification > fixedModifications ;
26
- private readonly List < MetaMorpheusModification > localizeableModifications ;
25
+ private readonly List < ModificationWithMass > variableModifications ;
26
+ private readonly List < ModificationWithMass > fixedModifications ;
27
+ private readonly List < ModificationWithMass > localizeableModifications ;
27
28
private readonly Protease protease ;
28
29
private readonly List < SearchMode > searchModes ;
29
- private readonly IMsDataFile < IMzSpectrum < MzPeak > > myMsDataFile ;
30
+ private readonly IMsDataFile < IMsDataScan < IMzSpectrum < IMzPeak > > > myMsDataFile ;
30
31
private readonly Tolerance fragmentTolerance ;
31
32
private readonly Action < BinTreeStructure , string > writeHistogramPeaksAction ;
32
33
private readonly Action < List < NewPsmWithFdr > , string > writePsmsAction ;
@@ -40,7 +41,7 @@ public class AnalysisEngine : MyEngine
40
41
41
42
#region Public Constructors
42
43
43
- public AnalysisEngine ( PsmParent [ ] [ ] newPsms , Dictionary < CompactPeptide , HashSet < PeptideWithSetModifications > > compactPeptideToProteinPeptideMatching , List < Protein > proteinList , List < MetaMorpheusModification > variableModifications , List < MetaMorpheusModification > fixedModifications , List < MetaMorpheusModification > localizeableModifications , Protease protease , List < SearchMode > searchModes , IMsDataFile < IMzSpectrum < MzPeak > > myMSDataFile , Tolerance fragmentTolerance , Action < BinTreeStructure , string > action1 , Action < List < NewPsmWithFdr > , string > action2 , Action < List < ProteinGroup > , string > action3 , bool doParsimony , int maximumMissedCleavages , int maxModIsoforms , bool doHistogramAnalysis , List < ProductType > lp , double binTol ) : base ( 2 )
44
+ public AnalysisEngine ( PsmParent [ ] [ ] newPsms , Dictionary < CompactPeptide , HashSet < PeptideWithSetModifications > > compactPeptideToProteinPeptideMatching , List < Protein > proteinList , List < ModificationWithMass > variableModifications , List < ModificationWithMass > fixedModifications , List < ModificationWithMass > localizeableModifications , Protease protease , List < SearchMode > searchModes , IMsDataFile < IMsDataScan < IMzSpectrum < IMzPeak > > > myMSDataFile , Tolerance fragmentTolerance , Action < BinTreeStructure , string > action1 , Action < List < NewPsmWithFdr > , string > action2 , Action < List < ProteinGroup > , string > action3 , bool doParsimony , int maximumMissedCleavages , int maxModIsoforms , bool doHistogramAnalysis , List < ProductType > lp , double binTol ) : base ( 2 )
44
45
{
45
46
this . doParsimony = doParsimony ;
46
47
this . doHistogramAnalysis = doHistogramAnalysis ;
@@ -203,8 +204,8 @@ public Dictionary<CompactPeptide, HashSet<PeptideWithSetModifications>> ApplyPro
203
204
{
204
205
HashSet < Protein > proteinsWithThisBaseSeq ;
205
206
peptideBaseSeqProteinListMatch . TryGetValue ( newBaseSeq , out proteinsWithThisBaseSeq ) ;
206
-
207
- foreach ( var protein in proteinsWithThisBaseSeq )
207
+
208
+ foreach ( var protein in proteinsWithThisBaseSeq )
208
209
{
209
210
HashSet < CompactPeptide > t ;
210
211
proteinToPeptidesMatching . TryGetValue ( protein , out t ) ;
@@ -728,12 +729,13 @@ private static void IdentifyUnimodBins(BinTreeStructure myTreeStructure, double
728
729
{
729
730
var ok = new HashSet < string > ( ) ;
730
731
var okformula = new HashSet < string > ( ) ;
731
- foreach ( var hm in UnimodDeserialized . modifications )
732
+ foreach ( var hm in UnimodDeserialized )
732
733
{
733
- if ( Math . Abs ( hm . mono_mass - bin . MassShift ) <= v )
734
+ var theMod = hm as ModificationWithMassAndCf ;
735
+ if ( Math . Abs ( theMod . monoisotopicMass - bin . MassShift ) <= v )
734
736
{
735
- ok . Add ( hm . full_name ) ;
736
- okformula . Add ( hm . composition ) ;
737
+ ok . Add ( hm . id ) ;
738
+ okformula . Add ( theMod . chemicalFormula . Formula ) ;
737
739
}
738
740
}
739
741
bin . UnimodId = string . Join ( " or " , ok ) ;
@@ -748,10 +750,12 @@ private static void IdentifyUniprotBins(BinTreeStructure myTreeStructure, double
748
750
var ok = new HashSet < string > ( ) ;
749
751
foreach ( var hm in UniprotDeseralized )
750
752
{
751
- if ( Math . Abs ( hm . Value . MonoisotopicMass - bin . MassShift ) <= v )
752
- {
753
- ok . Add ( hm . Value . NameAndSites ) ;
754
- }
753
+ var theMod = hm as ModificationWithMass ;
754
+ if ( theMod != null )
755
+ if ( Math . Abs ( theMod . monoisotopicMass - bin . MassShift ) <= v )
756
+ {
757
+ ok . Add ( hm . id ) ;
758
+ }
755
759
}
756
760
bin . uniprotID = string . Join ( " or " , ok ) ;
757
761
}
0 commit comments