public void InitializeIsotopicIons(double ppmTolerance, double minimumPercentage = 0.05, int maxProfileLength = int.MaxValue) { var atomComposition = aas.GetPeptideAtomComposition(this.Sequence); var profiles = profileBuilder.GetProfile(atomComposition, this.Charge, minimumPercentage).Take(maxProfileLength); this.IsotopicIons = (from peak in profiles select new IsotopicIon() { Mz = peak.Mz, Intensity = peak.Intensity, }).ToArray(); var diff = this.TheoreticalMz - this.IsotopicIons[0].Mz; //Replace the ion m/z to real ion m/z but keep the distance between ions in case of the peptide contains modification foreach (var ion in this.IsotopicIons) { ion.Mz += diff; var mzdiff = PrecursorUtils.ppm2mz(ion.Mz, ppmTolerance); ion.MinimumMzWithinTolerance = ion.Mz - mzdiff; ion.MaximumMzWithinTolerance = ion.Mz + mzdiff; } this.IsotopicIntensities = (from ion in this.IsotopicIons select ion.Intensity).ToArray(); }
//[Test] public void TestWuyinPeptide() { List<String> lines = FileUtils.ReadFile(@"C:\Documents and Settings\sheng\Desktop\sequences.txt"); var aas = new Aminoacids(); foreach (String line in lines) { AtomComposition ac = aas.GetPeptideAtomComposition(line); ac.Add(new AtomComposition("H2O")); List<double> profile = this.ip.GetProfile(ac, 10); Console.WriteLine(line); Console.WriteLine(ac); foreach (double d in profile) { Console.WriteLine(d); } Console.WriteLine(); } }
//[Test] public void TestWuyinPeptide() { List <String> lines = FileUtils.ReadFile(@"C:\Documents and Settings\sheng\Desktop\sequences.txt"); var aas = new Aminoacids(); foreach (String line in lines) { AtomComposition ac = aas.GetPeptideAtomComposition(line); ac.Add(new AtomComposition("H2O")); List <double> profile = this.ip.GetProfile(ac, 10); Console.WriteLine(line); Console.WriteLine(ac); foreach (double d in profile) { Console.WriteLine(d); } Console.WriteLine(); } }
public O18QuantificationPeptideProcessor(IFileFormat <O18QuantificationSummaryItem> fileFormat, bool isPostDigestionLabelling, string rawFilename, string peptide, double purityOfO18Water, List <O18QuanEnvelope> envelopes, double mzTolerance, string additionalFormula, double scanPercentageStart, double scanPercentageEnd) { _fileFormat = fileFormat; _isPostDigestionLabelling = isPostDigestionLabelling; _rawFilename = new FileInfo(rawFilename).FullName; _peptide = peptide; _additionalFormula = additionalFormula; _atomComposition = _aas.GetPeptideAtomComposition(peptide); if (!string.IsNullOrEmpty(additionalFormula)) { var additionalAtomComposition = new AtomComposition(additionalFormula); _atomComposition.Add(additionalAtomComposition); } _profile = _cp.GetProfile(_atomComposition, 0, 10); _purityOfO18Water = purityOfO18Water; _envelopes = envelopes; _scanPercentageStart = scanPercentageStart; _scanPercentageEnd = scanPercentageEnd; }
public override IEnumerable <string> Process() { var annos = new AnnotationFormat().ReadFromFile(boundaryFile); var aas = new Aminoacids(); var pbuilder = new EmassProfileBuilder(); var chroFormat = new ChromatographProfileTextWriter(); foreach (var ann in annos) { var chroFile = Path.Combine(ann.Annotations["ChroDirectory"] as string, ann.Annotations["ChroFile"] as string) + ".tsv"; var peptide = (ann.Annotations["PeptideId"] as string).StringBefore("_"); var start = double.Parse(ann.Annotations["ChroLeft"] as string); var end = double.Parse(ann.Annotations["ChroRight"] as string); var chro = chroFormat.ReadFromFile(chroFile); var chroFiltered = chro.Profiles.Where(l => l.RetentionTime >= start && l.RetentionTime <= end).ToArray(); //all observed isotopimers, start from 1, transfer to zero-based var allIsotopics = (from f in chroFiltered from s in f select s.Isotopic - 1).Distinct().OrderBy(l => l).ToArray(); //get minimum intensity of each isotopimer var minIntensities = (from iso in allIsotopics select(from f in chroFiltered where f.Count > iso select f[iso].Intensity).Min()).ToArray(); //how many isotopic should I trust? var iso0 = (from f in chroFiltered select f.First().Intensity).ToArray(); int maxIso = 1; for (int i = 2; i < allIsotopics.Length; i++) { var isoi = (from f in chroFiltered select f.Count > i ? f[i].Intensity : minIntensities[i]).ToArray(); var corr = MathNet.Numerics.Statistics.Correlation.Pearson(iso0, isoi); if (corr < minPearsonCorrelation) { maxIso = i; break; } } var maxIsoArray = allIsotopics.Where(l => l <= maxIso).ToArray(); //get observed profile in each scan var observedIons = (from f in chroFiltered select(from iso in maxIsoArray select f.Count > iso ? f[iso].Intensity : minIntensities[iso]).ToArray()).ToArray(); var atomComposition = aas.GetPeptideAtomComposition(peptide); var hatom = (int)(Math.Round(aas.ExchangableHAtom(peptide))); for (int h2 = 0; h2 < hatom; h2++) { } var profiles = pbuilder.GetProfile(atomComposition, 1, 3); var isotopicIons = (from peak in profiles select new IsotopicIon() { Mz = peak.Mz, Intensity = peak.Intensity, }).ToArray(); } return(null); }