public ProteinGroup ConstructSubsetProteinGroup(string fullFilePath) { var allPsmsForThisFile = new HashSet <PeptideSpectralMatch>(AllPsmsBelowOnePercentFDR.Where(p => p.FullFilePath.Equals(fullFilePath))); var allPeptidesForThisFile = new HashSet <PeptideWithSetModifications>(allPsmsForThisFile.SelectMany(p => p.BestMatchingPeptides.Select(v => v.Peptide))); var allUniquePeptidesForThisFile = new HashSet <PeptideWithSetModifications>(UniquePeptides.Intersect(allPeptidesForThisFile)); ProteinGroup subsetPg = new ProteinGroup(Proteins, allPeptidesForThisFile, allUniquePeptidesForThisFile) { AllPsmsBelowOnePercentFDR = allPsmsForThisFile, DisplayModsOnPeptides = DisplayModsOnPeptides }; SpectraFileInfo spectraFileInfo = null; if (FilesForQuantification != null) { spectraFileInfo = FilesForQuantification.Where(p => p.FullFilePathWithExtension == fullFilePath).First(); subsetPg.FilesForQuantification = new List <SpectraFileInfo> { spectraFileInfo }; } if (IntensitiesByFile == null) { subsetPg.IntensitiesByFile = null; } else { subsetPg.IntensitiesByFile = new Dictionary <SpectraFileInfo, double> { { spectraFileInfo, IntensitiesByFile[spectraFileInfo] } }; } return(subsetPg); }
// this method is only used internally, to make protein grouping faster // this is NOT an output and is NOT used for protein FDR calculations public void Score() { // sum the scores of the best PSM per base sequence ProteinGroupScore = AllPsmsBelowOnePercentFDR.GroupBy(p => p.BaseSequence).Select(p => p.Select(x => x.Score).Max()).Sum(); }