public static void FdrThresholding(string[] rawFiles, string decoyPrefix, double peptideFdr, double peptidePep, MascotQueryType type, bool perFileThreshold, bool debug, HashSet <string> sequences, bool onlyCollectSequences, IProteinSet proteinSet, HashSet <string> labelModificationSet, IIdentificationProvider ip) { CalcFdr(rawFiles, decoyPrefix, type, proteinSet, debug, labelModificationSet, ip); double pepThreshVal; double[] pepThreshVals = new double[rawFiles.Length]; if (peptideFdr < 1) { for (int i = 0; i < rawFiles.Length; i++) { pepThreshVals[i] = FindReverseHitThresholdValue(ip.GetIdentifications(rawFiles[i], type), peptideFdr, decoyPrefix, proteinSet); ip.Dispose(); if (peptidePep < 1) { pepThreshVals[i] = Math.Min(pepThreshVals[i], peptidePep); } } pepThreshVal = ArrayUtil.Median(pepThreshVals); if (peptidePep < 1) { pepThreshVal = Math.Min(pepThreshVal, peptidePep); } } else { for (int i = 0; i < rawFiles.Length; i++) { pepThreshVals[i] = peptidePep; } pepThreshVal = peptidePep; } if (onlyCollectSequences) { for (int i = 0; i < rawFiles.Length; i++) { CollectSequences(ip.GetIdentifications(rawFiles[i], type), perFileThreshold ? pepThreshVals[i] : pepThreshVal, sequences); ip.Dispose(); } } else { for (int i = 0; i < rawFiles.Length; i++) { ApplyReverseHitThreshold(ip.GetIdentifications(rawFiles[i], type), perFileThreshold ? pepThreshVals[i] : pepThreshVal); ip.Dispose(); } } }
private static void CalcFdr(string[] rawFiles, string decoyPrefix, MascotQueryType type, IProteinSet proteinSet, bool debug, IIdentificationProvider ip) { List <bool> correct = new List <bool>(); List <double> scores = new List <double>(); List <double> seqLen = new List <double>(); for (int i = 0; i < rawFiles.Length; i++) { Identifications ident = ip.GetIdentifications(rawFiles[i], type); int n = ident.Count; for (int j = 0; j < n; j++) { bool c = ident.IsHighestScoringCorrect(j, decoyPrefix, proteinSet); double s = ident.GetHighestAltScore(j); double l = Math.Log(ident.GetBestSequence(j).Length); if (!double.IsNaN(s) && !double.IsInfinity(s)) { correct.Add(c); scores.Add(s); seqLen.Add(l); } } ip.Dispose(); if (correct.Count > 10000000) { break; } } if (correct.Count == 0) { return; } bool write = debug && (type == MascotQueryType.Silac); BayesianInversion2D bi = new BayesianInversion2D(scores.ToArray(), seqLen.ToArray(), correct.ToArray(), write); if (write) { Write(rawFiles, bi); } for (int i = 0; i < rawFiles.Length; i++) { SetPep(ip.GetIdentifications(rawFiles[i], type), bi); ip.Dispose(); } }
public static void FilterBySequence(string[] rawFiles, string decoyPrefix, double totalPeptideFPR, double specificPeptideFPR, MascotQueryType type, bool perFileThreshold, bool debug, HashSet <string> sequences, bool onlyCollectSequences, IIdentificationProvider ip) { for (int i = 0; i < rawFiles.Length; i++) { FilterBySequence(ip.GetIdentifications(rawFiles[i], type), sequences); ip.Dispose(); } }
private static void LimitPep(string[] rawFiles, MascotQueryType type, IIdentificationProvider ip) { for (int i = 0; i < rawFiles.Length; i++) { Identifications ident = ip.GetIdentifications(rawFiles[i], type); int n = ident.Count; for (int j = 0; j < n; j++) { MascotPeptide p = ident.GetPeptidesAt(j)[0]; p.Pep = Math.Min(p.Pep, 1); } ident.Write(); ip.Dispose(); } }