@@ -16,7 +16,6 @@ public class AnalysisEngine : MyEngine
16
16
17
17
#region Private Fields
18
18
19
- private const double comboThresholdMultiplier = 3 ;
20
19
private const int max_mods_for_peptide = 3 ;
21
20
private readonly double binTol ;
22
21
private readonly int maximumMissedCleavages ;
@@ -299,7 +298,6 @@ public void ApplyProteinParsimony(out List<ProteinGroup> proteinGroups)
299
298
proteinListHere . Add ( kvp . Key ) ;
300
299
proteinGroups . Add ( new ProteinGroup ( proteinListHere , kvp . Value , uniquePeptidesHere ) ) ;
301
300
}
302
-
303
301
304
302
// grab indistinguishable proteins
305
303
foreach ( var proteinGroup in proteinGroups )
@@ -396,15 +394,15 @@ public void ScoreProteinGroups(List<ProteinGroup> proteinGroups, List<NewPsmWith
396
394
}
397
395
398
396
// add every psm that corresponds to the protein group's peptides to the group
399
- foreach ( var proteinGroup in proteinGroups )
397
+ foreach ( var proteinGroup in proteinGroups )
400
398
{
401
- foreach ( var peptide in proteinGroup . PeptideList )
399
+ foreach ( var peptide in proteinGroup . PeptideList )
402
400
{
403
401
string peptideBaseSequence = string . Join ( "" , peptide . BaseSequence . Select ( b => char . ConvertFromUtf32 ( b ) ) ) ;
404
402
List < NewPsmWithFdr > psmListForThisBaseSeq = new List < NewPsmWithFdr > ( ) ;
405
403
406
404
peptideBaseSeqToPsmMatching . TryGetValue ( peptideBaseSequence , out psmListForThisBaseSeq ) ;
407
- foreach ( var psm in psmListForThisBaseSeq )
405
+ foreach ( var psm in psmListForThisBaseSeq )
408
406
{
409
407
if ( ! proteinGroup . TotalPsmList . Contains ( psm ) )
410
408
{
@@ -488,24 +486,24 @@ public void ScoreProteinGroups(List<ProteinGroup> proteinGroups, List<NewPsmWith
488
486
489
487
// score the group (scoring algorithm defined in the ProteinGroup class)
490
488
proteinGroup . ScoreThisProteinGroup ( ) ;
491
-
489
+
492
490
// remove empty protein groups (peptides were too poor quality and group doesn't exist anymore)
493
491
if ( proteinGroup . proteinGroupScore == 0 )
494
492
proteinGroupsToRemove . Add ( proteinGroup ) ;
495
493
}
496
494
497
- foreach ( var proteinGroup in proteinGroupsToRemove )
495
+ foreach ( var proteinGroup in proteinGroupsToRemove )
498
496
{
499
497
proteinGroups . Remove ( proteinGroup ) ;
500
498
}
501
499
502
500
// build razor peptide list (peptides that have >1 protein groups in the final protein group list)
503
- foreach ( var kvp in peptideToProteinGroupMatching )
501
+ foreach ( var kvp in peptideToProteinGroupMatching )
504
502
{
505
503
if ( kvp . Value . Count > 1 )
506
504
allRazorPeptides . Add ( kvp . Key ) ;
507
505
}
508
-
506
+
509
507
foreach ( var proteinGroup in proteinGroups )
510
508
{
511
509
foreach ( var peptide in proteinGroup . PeptideList )
@@ -519,7 +517,7 @@ public void ScoreProteinGroups(List<ProteinGroup> proteinGroups, List<NewPsmWith
519
517
// build PeptideWithSetMod list to calc sequence coverage
520
518
HashSet < PeptideWithSetModifications > peptidesWithSetMods = null ;
521
519
compactPeptideToProteinPeptideMatching . TryGetValue ( peptide , out peptidesWithSetMods ) ;
522
- foreach ( var pep in peptidesWithSetMods )
520
+ foreach ( var pep in peptidesWithSetMods )
523
521
{
524
522
proteinGroup . PeptideWithSetModsList . Add ( pep ) ;
525
523
}
@@ -634,6 +632,28 @@ protected override MyResults RunSpecific()
634
632
635
633
#region Private Methods
636
634
635
+ private static void OverlappingIonSequences ( BinTreeStructure myTreeStructure )
636
+ {
637
+ foreach ( Bin bin in myTreeStructure . FinalBins )
638
+ {
639
+ foreach ( var hm in bin . uniquePSMs . Where ( b => ! b . Value . Item3 . IsDecoy ) )
640
+ {
641
+ var ya = hm . Value . Item3 . thisPSM . newPsm . matchedIonsList ;
642
+ if ( ya . ContainsKey ( ProductType . B ) && ya . ContainsKey ( ProductType . Y ) && ya [ ProductType . B ] . Any ( b => b > 0 ) && ya [ ProductType . Y ] . Any ( b => b > 0 ) )
643
+ if ( ya [ ProductType . B ] . Last ( b => b > 0 ) + ya [ ProductType . Y ] . Last ( b => b > 0 ) > hm . Value . Item3 . thisPSM . PeptideMonoisotopicMass )
644
+ bin . Overlapping ++ ;
645
+ }
646
+ }
647
+ }
648
+
649
+ private static void IdentifyPsmsWithMaxMods ( BinTreeStructure myTreeStructure )
650
+ {
651
+ foreach ( Bin bin in myTreeStructure . FinalBins )
652
+ {
653
+ bin . FracWithMaxMods = ( ( double ) bin . uniquePSMs . Values . Count ( b => ! b . Item3 . IsDecoy && b . Item3 . thisPSM . NumVariableMods == max_mods_for_peptide ) ) / bin . CountTarget ;
654
+ }
655
+ }
656
+
637
657
private static void IdentifyAAsInCommon ( BinTreeStructure myTreeStructure )
638
658
{
639
659
foreach ( Bin bin in myTreeStructure . FinalBins )
@@ -771,7 +791,7 @@ private static void IdentifyCombos(BinTreeStructure myTreeStructure, double v)
771
791
var ok = new HashSet < Tuple < double , double , double > > ( ) ;
772
792
foreach ( var bin in myTreeStructure . FinalBins . Where ( b => Math . Abs ( b . MassShift ) > v ) )
773
793
foreach ( var bin2 in myTreeStructure . FinalBins . Where ( b => Math . Abs ( b . MassShift ) > v ) )
774
- if ( bin . CountTarget * bin2 . CountTarget >= totalTargetCount * comboThresholdMultiplier )
794
+ if ( bin . CountTarget * bin2 . CountTarget >= totalTargetCount )
775
795
ok . Add ( new Tuple < double , double , double > ( bin . MassShift , bin2 . MassShift , Math . Min ( bin . CountTarget , bin2 . CountTarget ) ) ) ;
776
796
777
797
foreach ( var bin in myTreeStructure . FinalBins )
@@ -875,6 +895,10 @@ private static BinTreeStructure MyAnalysis(List<NewPsmWithFdr> limitedpsms_with_
875
895
876
896
IdentifyMine ( myTreeStructure , binTol ) ;
877
897
898
+ IdentifyPsmsWithMaxMods ( myTreeStructure ) ;
899
+
900
+ OverlappingIonSequences ( myTreeStructure ) ;
901
+
878
902
return myTreeStructure ;
879
903
}
880
904
0 commit comments