public static bool Run() { string outputPath = @"C:\_IRIC\DATA\Test\testMhc\Stats\"; vsCSVWriter writer = new vsCSVWriter(outputPath + "output.csv"); writer.AddLine("File,# MS1s,# MSMS,1 Charge,2 Charge,3 Charge,4 Charge,5 Charge,6 Charge,7 Charge,8 Charge,9 Charge,10 Charge,11 Charge,12 Charge,13 Charge,14 Charge"); DBOptions options = MhcSample.CreateOptions(outputPath); string[] files = new string[] { @"N:\Thibault\-=Proteomics_Raw_Data=-\ELITE\JUL29_2013\Settepeptides_300713_10uL.raw", @"N:\Thibault\-=Proteomics_Raw_Data=-\ELITE\JUL29_2013\Settepeptides_300713_10uL_MS60_MSMS15.raw", @"N:\Thibault\-=Proteomics_Raw_Data=-\ELITE\JUL29_2013\Settepeptides_300713_10uL_MS60_MSMS30.raw", @"N:\Thibault\-=Proteomics_Raw_Data=-\ELITE\JUL29_2013\Settepeptides_300713_10uL_MS60_MSMS60.raw", @"N:\Thibault\-=Proteomics_Raw_Data=-\ELITE\JUL29_2013\Settepeptides_300713_10uL_MS120_MSMS15.raw", @"N:\Thibault\-=Proteomics_Raw_Data=-\ELITE\JUL29_2013\Settepeptides_300713_10uL_MS120_MSMS30.raw", @"N:\Thibault\-=Proteomics_Raw_Data=-\ELITE\JUL29_2013\Settepeptides_300713_10uL_MS120_MSMS60.raw" }; foreach (string file in files) { pwiz.CLI.msdata.MSDataFile msFile = new pwiz.CLI.msdata.MSDataFile(file); Spectra spectra = Spectra.Load(msFile, options, file); spectra.Sort(ProductSpectrum.AscendingPrecursorMassComparison); Dictionary <Track, Precursor> DicOfComputedTracks = new Dictionary <Track, Precursor>(); int[] charges = new int[14]; foreach (Track track in spectra.tracks) { if (!DicOfComputedTracks.ContainsKey(track)) { DicOfComputedTracks.Add(track, null); int charge = 0; foreach (Precursor precursor in Queries.GetIsotopes(track, options, spectra.tracks, null)) { if (precursor.Charge > 0) { charge = precursor.Charge; } if (!DicOfComputedTracks.ContainsKey(precursor.Track)) { DicOfComputedTracks.Add(precursor.Track, precursor); } } charges[charge]++; } } string line = file + "," + spectra.MS1s.Count + "," + spectra.Count; for (int i = 0; i < charges.Length; i++) { line += "," + charges[i]; } writer.AddLine(line); } writer.WriteToFile(); return(true); }
public static bool Run() { //TODO test GPU instead DBOptions dbOptions = MhcSample.CreateOptions(""); Dictionary <string, int> sequences = new Dictionary <string, int>(); List <Protein> proteins = Propheus.ReadProteomeFromFasta(Path.Combine(Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]), "UnitTest", "proteins.fasta"), false, dbOptions);//ETLPAMCNVYYVNCMAPLTE string sequence = proteins[0].BaseSequence; double[] proteinMasses = new double[sequence.Length]; List <double> precursors = new List <double>(); for (int i = 0; i < sequence.Length; i++) { for (int j = i + dbOptions.MinimumPeptideLength - 1; j < sequence.Length; j++) { int size = j - i + 1; if (size <= dbOptions.MaximumPeptideLength) { string subStr = sequence.Substring(i, j - i + 1); if (!sequences.ContainsKey(subStr)) { sequences.Add(subStr, 1); } else { sequences[subStr]++; } double mass = Constants.WATER_MONOISOTOPIC_MASS; for (int k = 0; k < subStr.Length; k++) { mass += AminoAcidMasses.GetMonoisotopicMass(subStr[k]); } precursors.Add(mass); } } proteinMasses[i] = AminoAcidMasses.GetMonoisotopicMass(sequence[i]); } precursors.Sort(); Queries queries = new Queries(dbOptions, precursors.ToArray()); Digestion ps = new Digestion(dbOptions); List <Protein> lProt = new List <Protein>(); lProt.Add(proteins[0]); //for each protein, build matrix of mass //Trinity_Gpu.ProteinDigest pg = new Trinity_Gpu.ProteinDigest(precursors.ToArray(), sequence.Length); //Test twice to test that precursor list stays in gpu memory for (int iter = 0; iter < 2; iter++) { Dictionary <string, int> sequencesTmp = new Dictionary <string, int>(sequences); foreach (Tuple <Peptide, int> item in ps.DigestProteomeOnTheFlyNoEnzyme(lProt, queries)) { sequencesTmp[item.Item1.BaseSequence] -= 1;//TODO add modifications } /* * foreach (Trinity_Gpu.ProteinPrecursorMatch match in pg.Execute(proteinMasses, 0.00005, 10000000))//TODO compute correct tolerance window * { * int size = match.proteinEndPos - match.proteinStartPos; * string str = sequence.Substring(match.proteinStartPos, size); * if (size >= dbOptions.MinimumPeptideLength) * { * sequencesTmp[str] -= 1;//TODO add modifications * } * }//*/ foreach (int val in sequencesTmp.Values) { if (val != 0) { return(false);//*/ } } } //pg.Dispose(); return(true); }