1
1
using MassSpectrometry ;
2
- using OldInternalLogic ;
3
2
using Proteomics ;
4
3
using Spectra ;
5
4
using System ;
9
8
using System . Linq ;
10
9
using System . Threading . Tasks ;
11
10
12
- namespace InternalLogicEngineLayer
11
+ namespace EngineLayer . Analysis
13
12
{
14
13
public class AnalysisEngine : MyEngine
15
14
{
@@ -20,11 +19,11 @@ public class AnalysisEngine : MyEngine
20
19
private readonly double binTol ;
21
20
private readonly int maximumMissedCleavages ;
22
21
private readonly int maxModIsoforms ;
23
- private readonly ParentSpectrumMatch [ ] [ ] newPsms ;
22
+ private readonly PsmParent [ ] [ ] newPsms ;
24
23
private readonly List < Protein > proteinList ;
25
- private readonly List < MorpheusModification > variableModifications ;
26
- private readonly List < MorpheusModification > fixedModifications ;
27
- private readonly List < MorpheusModification > localizeableModifications ;
24
+ private readonly List < MetaMorpheusModification > variableModifications ;
25
+ private readonly List < MetaMorpheusModification > fixedModifications ;
26
+ private readonly List < MetaMorpheusModification > localizeableModifications ;
28
27
private readonly Protease protease ;
29
28
private readonly List < SearchMode > searchModes ;
30
29
private readonly IMsDataFile < IMzSpectrum < MzPeak > > myMsDataFile ;
@@ -41,7 +40,7 @@ public class AnalysisEngine : MyEngine
41
40
42
41
#region Public Constructors
43
42
44
- public AnalysisEngine ( ParentSpectrumMatch [ ] [ ] newPsms , Dictionary < CompactPeptide , HashSet < PeptideWithSetModifications > > compactPeptideToProteinPeptideMatching , List < Protein > proteinList , List < MorpheusModification > variableModifications , List < MorpheusModification > fixedModifications , List < MorpheusModification > 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 )
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 )
45
44
{
46
45
this . doParsimony = doParsimony ;
47
46
this . doHistogramAnalysis = doHistogramAnalysis ;
@@ -605,12 +604,12 @@ protected override MyResults RunSpecific()
605
604
{
606
605
if ( newPsms [ j ] != null )
607
606
{
608
- PSMwithProteinHashSet [ ] psmsWithProteinHashSet = new PSMwithProteinHashSet [ newPsms [ 0 ] . Length ] ;
607
+ PsmWithMultiplePossiblePeptides [ ] psmsWithProteinHashSet = new PsmWithMultiplePossiblePeptides [ newPsms [ 0 ] . Length ] ;
609
608
for ( int i = 0 ; i < newPsms [ 0 ] . Length ; i ++ )
610
609
{
611
610
var huh = newPsms [ j ] [ i ] ;
612
611
if ( huh != null && huh . score >= 1 )
613
- psmsWithProteinHashSet [ i ] = new PSMwithProteinHashSet ( huh , compactPeptideToProteinPeptideMatching [ huh . GetCompactPeptide ( variableModifications , localizeableModifications , fixedModifications ) ] , fragmentTolerance , myMsDataFile , lp ) ;
612
+ psmsWithProteinHashSet [ i ] = new PsmWithMultiplePossiblePeptides ( huh , compactPeptideToProteinPeptideMatching [ huh . GetCompactPeptide ( variableModifications , localizeableModifications , fixedModifications ) ] , fragmentTolerance , myMsDataFile , lp ) ;
614
613
}
615
614
616
615
var orderedPsmsWithPeptides = psmsWithProteinHashSet . Where ( b => b != null ) . OrderByDescending ( b => b . Score ) ;
@@ -682,7 +681,7 @@ private static void IdentifyFracWithSingle(BinTreeStructure myTreeStructure)
682
681
{
683
682
foreach ( Bin bin in myTreeStructure . FinalBins )
684
683
{
685
- bin . FracWithSingle = ( double ) bin . uniquePSMs . Values . Where ( b => ! b . Item3 . IsDecoy && b . Item3 . thisPSM . peptidesWithSetModifications . Count == 1 ) . Count ( ) / bin . uniquePSMs . Values . Where ( b => ! b . Item3 . IsDecoy ) . Count ( ) ;
684
+ bin . FracWithSingle = ( double ) bin . uniquePSMs . Values . Count ( b => ! b . Item3 . IsDecoy && b . Item3 . thisPSM . peptidesWithSetModifications . Count == 1 ) / bin . uniquePSMs . Values . Count ( b => ! b . Item3 . IsDecoy ) ;
686
685
}
687
686
}
688
687
@@ -931,16 +930,18 @@ private static BinTreeStructure MyAnalysis(List<NewPsmWithFdr> limitedpsms_with_
931
930
932
931
OverlappingIonSequences ( myTreeStructure ) ;
933
932
933
+ IdentifyFracWithSingle ( myTreeStructure ) ;
934
+
934
935
return myTreeStructure ;
935
936
}
936
937
937
- private static List < NewPsmWithFdr > DoFalseDiscoveryRateAnalysis ( IEnumerable < PSMwithProteinHashSet > items )
938
+ private static List < NewPsmWithFdr > DoFalseDiscoveryRateAnalysis ( IEnumerable < PsmWithMultiplePossiblePeptides > items )
938
939
{
939
940
var ids = new List < NewPsmWithFdr > ( ) ;
940
941
941
942
int cumulative_target = 0 ;
942
943
int cumulative_decoy = 0 ;
943
- foreach ( PSMwithProteinHashSet item in items )
944
+ foreach ( PsmWithMultiplePossiblePeptides item in items )
944
945
{
945
946
var isDecoy = item . IsDecoy ;
946
947
if ( isDecoy )
@@ -1038,5 +1039,28 @@ private void AddObservedPeptidesToDictionary()
1038
1039
1039
1040
#endregion Private Methods
1040
1041
1042
+ #region Private Classes
1043
+
1044
+ private class SequenceComparer : IEqualityComparer < PsmWithMultiplePossiblePeptides >
1045
+ {
1046
+
1047
+ #region Public Methods
1048
+
1049
+ public bool Equals ( PsmWithMultiplePossiblePeptides x , PsmWithMultiplePossiblePeptides y )
1050
+ {
1051
+ return x . FullSequence . Equals ( y . FullSequence ) ;
1052
+ }
1053
+
1054
+ public int GetHashCode ( PsmWithMultiplePossiblePeptides obj )
1055
+ {
1056
+ return obj . FullSequence . GetHashCode ( ) ;
1057
+ }
1058
+
1059
+ #endregion Public Methods
1060
+
1061
+ }
1062
+
1063
+ #endregion Private Classes
1064
+
1041
1065
}
1042
1066
}
0 commit comments