@@ -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 ;
@@ -281,7 +280,6 @@ public Dictionary<CompactPeptide, HashSet<PeptideWithSetModifications>> ApplyPro
281
280
proteinListHere . Add ( kvp . Key ) ;
282
281
proteinGroups . Add ( new ProteinGroup ( proteinListHere , kvp . Value , uniquePeptidesHere ) ) ;
283
282
}
284
-
285
283
286
284
// grab indistinguishable proteins
287
285
foreach ( var proteinGroup in proteinGroups )
@@ -409,15 +407,14 @@ public void ScoreProteinGroups(List<ProteinGroup> proteinGroups, List<NewPsmWith
409
407
}
410
408
411
409
// add every psm that corresponds to the protein group's peptides to the group
412
- foreach ( var proteinGroup in proteinGroups )
410
+ foreach ( var proteinGroup in proteinGroups )
413
411
{
414
- foreach ( var peptide in proteinGroup . PeptideList )
412
+ foreach ( var peptide in proteinGroup . PeptideList )
415
413
{
416
414
string peptideBaseSequence = string . Join ( "" , peptide . BaseSequence . Select ( b => char . ConvertFromUtf32 ( b ) ) ) ;
417
415
List < NewPsmWithFdr > psmListForThisBaseSeq ;
418
416
419
417
peptideBaseSeqToPsmMatching . TryGetValue ( peptideBaseSequence , out psmListForThisBaseSeq ) ;
420
-
421
418
if ( psmListForThisBaseSeq != null )
422
419
{
423
420
foreach ( var psm in psmListForThisBaseSeq )
@@ -511,26 +508,26 @@ public void ScoreProteinGroups(List<ProteinGroup> proteinGroups, List<NewPsmWith
511
508
512
509
// score the group (scoring algorithm defined in the ProteinGroup class)
513
510
proteinGroup . ScoreThisProteinGroup ( ) ;
514
-
511
+
515
512
// remove empty protein groups (peptides were too poor quality and group doesn't exist anymore)
516
513
if ( proteinGroup . proteinGroupScore == 0 )
517
514
proteinGroupsToRemove . Add ( proteinGroup ) ;
518
515
}
519
516
520
- foreach ( var proteinGroup in proteinGroupsToRemove )
517
+ foreach ( var proteinGroup in proteinGroupsToRemove )
521
518
{
522
519
proteinGroups . Remove ( proteinGroup ) ;
523
520
}
524
521
525
522
// build razor peptide list (peptides that have >1 protein groups in the final protein group list)
526
- foreach ( var kvp in peptideToProteinGroupMatching )
523
+ foreach ( var kvp in peptideToProteinGroupMatching )
527
524
{
528
525
if ( kvp . Value . Count > 1 )
529
526
{
530
527
allRazorPeptides . Add ( kvp . Key ) ;
531
528
}
532
529
}
533
-
530
+
534
531
foreach ( var proteinGroup in proteinGroups )
535
532
{
536
533
foreach ( var peptide in proteinGroup . PeptideList )
@@ -544,7 +541,7 @@ public void ScoreProteinGroups(List<ProteinGroup> proteinGroups, List<NewPsmWith
544
541
// build PeptideWithSetMod list to calc sequence coverage
545
542
HashSet < PeptideWithSetModifications > peptidesWithSetMods = null ;
546
543
compactPeptideToProteinPeptideMatching . TryGetValue ( peptide , out peptidesWithSetMods ) ;
547
- foreach ( var pep in peptidesWithSetMods )
544
+ foreach ( var pep in peptidesWithSetMods )
548
545
{
549
546
proteinGroup . PeptideWithSetModsList . Add ( pep ) ;
550
547
}
@@ -659,6 +656,28 @@ protected override MyResults RunSpecific()
659
656
660
657
#region Private Methods
661
658
659
+ private static void OverlappingIonSequences ( BinTreeStructure myTreeStructure )
660
+ {
661
+ foreach ( Bin bin in myTreeStructure . FinalBins )
662
+ {
663
+ foreach ( var hm in bin . uniquePSMs . Where ( b => ! b . Value . Item3 . IsDecoy ) )
664
+ {
665
+ var ya = hm . Value . Item3 . thisPSM . newPsm . matchedIonsList ;
666
+ if ( ya . ContainsKey ( ProductType . B ) && ya . ContainsKey ( ProductType . Y ) && ya [ ProductType . B ] . Any ( b => b > 0 ) && ya [ ProductType . Y ] . Any ( b => b > 0 ) )
667
+ if ( ya [ ProductType . B ] . Last ( b => b > 0 ) + ya [ ProductType . Y ] . Last ( b => b > 0 ) > hm . Value . Item3 . thisPSM . PeptideMonoisotopicMass )
668
+ bin . Overlapping ++ ;
669
+ }
670
+ }
671
+ }
672
+
673
+ private static void IdentifyPsmsWithMaxMods ( BinTreeStructure myTreeStructure )
674
+ {
675
+ foreach ( Bin bin in myTreeStructure . FinalBins )
676
+ {
677
+ bin . FracWithMaxMods = ( ( double ) bin . uniquePSMs . Values . Count ( b => ! b . Item3 . IsDecoy && b . Item3 . thisPSM . NumVariableMods == max_mods_for_peptide ) ) / bin . CountTarget ;
678
+ }
679
+ }
680
+
662
681
private static void IdentifyAAsInCommon ( BinTreeStructure myTreeStructure )
663
682
{
664
683
foreach ( Bin bin in myTreeStructure . FinalBins )
@@ -796,7 +815,7 @@ private static void IdentifyCombos(BinTreeStructure myTreeStructure, double v)
796
815
var ok = new HashSet < Tuple < double , double , double > > ( ) ;
797
816
foreach ( var bin in myTreeStructure . FinalBins . Where ( b => Math . Abs ( b . MassShift ) > v ) )
798
817
foreach ( var bin2 in myTreeStructure . FinalBins . Where ( b => Math . Abs ( b . MassShift ) > v ) )
799
- if ( bin . CountTarget * bin2 . CountTarget >= totalTargetCount * comboThresholdMultiplier )
818
+ if ( bin . CountTarget * bin2 . CountTarget >= totalTargetCount )
800
819
ok . Add ( new Tuple < double , double , double > ( bin . MassShift , bin2 . MassShift , Math . Min ( bin . CountTarget , bin2 . CountTarget ) ) ) ;
801
820
802
821
foreach ( var bin in myTreeStructure . FinalBins )
@@ -900,6 +919,10 @@ private static BinTreeStructure MyAnalysis(List<NewPsmWithFdr> limitedpsms_with_
900
919
901
920
IdentifyMine ( myTreeStructure , binTol ) ;
902
921
922
+ IdentifyPsmsWithMaxMods ( myTreeStructure ) ;
923
+
924
+ OverlappingIonSequences ( myTreeStructure ) ;
925
+
903
926
return myTreeStructure ;
904
927
}
905
928
0 commit comments