public void TestBuild() { var aas = new Aminoacids(); aas['*'].ResetMass(79.9799, 79.9799); aas['C'].ResetMass(160.1652, 160.1652); var builder = new CIDPeptideYSeriesBuilder <IonTypePeak>() { CurAminoacids = aas }; List <IonTypePeak> pkl = builder.Build("CGETVES*GDEKDLAK"); //Output(pkl, IonType.Y); Assert.AreEqual(14, pkl.Count); AssertPeak(pkl[0], IonType.Y, 1, 147.1134); AssertPeak(pkl[1], IonType.Y, 2, 218.1505); AssertPeak(pkl[2], IonType.Y, 3, 331.2345); AssertPeak(pkl[3], IonType.Y, 4, 446.2615); AssertPeak(pkl[4], IonType.Y, 5, 574.3564); AssertPeak(pkl[5], IonType.Y, 6, 703.3990); AssertPeak(pkl[6], IonType.Y, 7, 818.4260); AssertPeak(pkl[7], IonType.Y, 8, 875.4474); AssertPeak(pkl[8], IonType.Y, 9, 1042.4594); AssertPeak(pkl[9], IonType.Y, 10, 1171.5020); AssertPeak(pkl[10], IonType.Y, 11, 1270.5704); AssertPeak(pkl[11], IonType.Y, 12, 1371.6181); AssertPeak(pkl[12], IonType.Y, 13, 1500.6606); AssertPeak(pkl[13], IonType.Y, 14, 1557.6821); }
public CIDFragmentationBuilder(int charge, Aminoacids aas) { builders.Add(new CIDPeptideBSeriesBuilder <T>() { CurAminoacids = aas }); builders.Add(new CIDPeptideYSeriesBuilder <T>() { CurAminoacids = aas }); if (charge >= 2) { builders.Add(new CIDPeptideB2SeriesBuilder <T>() { CurAminoacids = aas }); builders.Add(new CIDPeptideY2SeriesBuilder <T>() { CurAminoacids = aas }); } }
public void TestBuild() { var aas = new Aminoacids(); aas['*'].ResetMass(79.9799, 79.9799); aas['C'].ResetMass(160.1652, 160.1652); var builder = new CIDPeptideBSeriesBuilder <IonTypePeak>() { CurAminoacids = aas }; List <IonTypePeak> pkl = builder.Build("R.CGETVES*GDEKDLAK.A"); //Output(pkl, IonType.B); Assert.AreEqual(14, pkl.Count); AssertPeak(pkl[0], IonType.B, 1, 161.1730); AssertPeak(pkl[1], IonType.B, 2, 218.1945); AssertPeak(pkl[2], IonType.B, 3, 347.2371); AssertPeak(pkl[3], IonType.B, 4, 448.2848); AssertPeak(pkl[4], IonType.B, 5, 547.3532); AssertPeak(pkl[5], IonType.B, 6, 676.3958); AssertPeak(pkl[6], IonType.B, 7, 843.4077); AssertPeak(pkl[7], IonType.B, 8, 900.4292); AssertPeak(pkl[8], IonType.B, 9, 1015.4561); AssertPeak(pkl[9], IonType.B, 10, 1144.4987); AssertPeak(pkl[10], IonType.B, 11, 1272.5937); AssertPeak(pkl[11], IonType.B, 12, 1387.6206); AssertPeak(pkl[12], IonType.B, 13, 1500.7047); AssertPeak(pkl[13], IonType.B, 14, 1571.7418); }
public void TestBuild() { var aas = new Aminoacids(); aas['*'].ResetMass(79.9799, 79.9799); aas['C'].ResetMass(160.1652, 160.1652); var builder = new CIDPeptideBSeriesBuilder<IonTypePeak>() { CurAminoacids = aas }; List<IonTypePeak> pkl = builder.Build("R.CGETVES*GDEKDLAK.A"); //Output(pkl, IonType.B); Assert.AreEqual(14, pkl.Count); AssertPeak(pkl[0], IonType.B, 1, 161.1730); AssertPeak(pkl[1], IonType.B, 2, 218.1945); AssertPeak(pkl[2], IonType.B, 3, 347.2371); AssertPeak(pkl[3], IonType.B, 4, 448.2848); AssertPeak(pkl[4], IonType.B, 5, 547.3532); AssertPeak(pkl[5], IonType.B, 6, 676.3958); AssertPeak(pkl[6], IonType.B, 7, 843.4077); AssertPeak(pkl[7], IonType.B, 8, 900.4292); AssertPeak(pkl[8], IonType.B, 9, 1015.4561); AssertPeak(pkl[9], IonType.B, 10, 1144.4987); AssertPeak(pkl[10], IonType.B, 11, 1272.5937); AssertPeak(pkl[11], IonType.B, 12, 1387.6206); AssertPeak(pkl[12], IonType.B, 13, 1500.7047); AssertPeak(pkl[13], IonType.B, 14, 1571.7418); }
protected override void InitializeAminoacids(out Aminoacids samAminoacids, out Aminoacids refAminoacids) { samAminoacids = new Aminoacids(); refAminoacids = new Aminoacids(); refAminoacids['R'].CompositionStr = "Cx6H12ONx4"; refAminoacids['K'].CompositionStr = "Cx6H12ONx2"; }
public void TestInitTerminalLoss() { var item = new MS2Item() { Charge = 3, Precursor = 376.52331, Peptide = "-.EHSSL^AYWK.-" }; var aas = new Aminoacids(); aas['^'].ResetMass(7.017,7.017); item.InitTerminalLoss(aas, 6, 2); Assert.AreEqual(12, item.TerminalLoss.Count); Assert.AreEqual("LAYWK", item.TerminalLoss[3].Sequence); Assert.IsTrue(item.TerminalLoss[3].IsNterminal); Assert.AreEqual("AYWK", item.TerminalLoss[4].Sequence); Assert.IsTrue(item.TerminalLoss[4].IsNterminal); Assert.AreEqual(7.017, (item.TerminalLoss[3].Precursor - item.TerminalLoss[4].Precursor) * 3 - aas['L'].MonoMass, 0.001); Assert.AreEqual("EHSSL", item.TerminalLoss[9].Sequence); Assert.IsFalse(item.TerminalLoss[9].IsNterminal); Assert.AreEqual("EHSS", item.TerminalLoss[10].Sequence); Assert.IsFalse(item.TerminalLoss[10].IsNterminal); Assert.AreEqual(7.017, (item.TerminalLoss[9].Precursor - item.TerminalLoss[10].Precursor) * 3 - aas['L'].MonoMass, 0.001); //item.TerminalLoss.ForEach(m => Console.WriteLine(m.Precursor.ToString() + "\t" + m.Sequence)); }
public void TestInitTerminalLoss() { var item = new MS2Item() { Charge = 3, Precursor = 376.52331, Peptide = "-.EHSSL^AYWK.-" }; var aas = new Aminoacids(); aas['^'].ResetMass(7.017, 7.017); item.InitTerminalLoss(aas, 6, 2); Assert.AreEqual(12, item.TerminalLoss.Count); Assert.AreEqual("LAYWK", item.TerminalLoss[3].Sequence); Assert.IsTrue(item.TerminalLoss[3].IsNterminal); Assert.AreEqual("AYWK", item.TerminalLoss[4].Sequence); Assert.IsTrue(item.TerminalLoss[4].IsNterminal); Assert.AreEqual(7.017, (item.TerminalLoss[3].Precursor - item.TerminalLoss[4].Precursor) * 3 - aas['L'].MonoMass, 0.001); Assert.AreEqual("EHSSL", item.TerminalLoss[9].Sequence); Assert.IsFalse(item.TerminalLoss[9].IsNterminal); Assert.AreEqual("EHSS", item.TerminalLoss[10].Sequence); Assert.IsFalse(item.TerminalLoss[10].IsNterminal); Assert.AreEqual(7.017, (item.TerminalLoss[9].Precursor - item.TerminalLoss[10].Precursor) * 3 - aas['L'].MonoMass, 0.001); //item.TerminalLoss.ForEach(m => Console.WriteLine(m.Precursor.ToString() + "\t" + m.Sequence)); }
public void TestBuild() { var aas = new Aminoacids(); aas['*'].ResetMass(79.9799, 79.9799); aas['C'].ResetMass(160.1652, 160.1652); var builder = new CIDPeptideYSeriesBuilder<IonTypePeak>() { CurAminoacids = aas }; List<IonTypePeak> pkl = builder.Build("CGETVES*GDEKDLAK"); //Output(pkl, IonType.Y); Assert.AreEqual(14, pkl.Count); AssertPeak(pkl[0], IonType.Y, 1, 147.1134); AssertPeak(pkl[1], IonType.Y, 2, 218.1505); AssertPeak(pkl[2], IonType.Y, 3, 331.2345); AssertPeak(pkl[3], IonType.Y, 4, 446.2615); AssertPeak(pkl[4], IonType.Y, 5, 574.3564); AssertPeak(pkl[5], IonType.Y, 6, 703.3990); AssertPeak(pkl[6], IonType.Y, 7, 818.4260); AssertPeak(pkl[7], IonType.Y, 8, 875.4474); AssertPeak(pkl[8], IonType.Y, 9, 1042.4594); AssertPeak(pkl[9], IonType.Y, 10, 1171.5020); AssertPeak(pkl[10], IonType.Y, 11, 1270.5704); AssertPeak(pkl[11], IonType.Y, 12, 1371.6181); AssertPeak(pkl[12], IonType.Y, 13, 1500.6606); AssertPeak(pkl[13], IonType.Y, 14, 1557.6821); }
public ProteinCarbonRangePredictor() { var aas = new Aminoacids(); this.maxCarbonPercentAminoacid = aas.GetMaxCarbonPercentAminoacid(); this.minCarbonPercentAminoacid = aas.GetMinCarbonPercentAminoacid(); }
public PepXmlModifications(MascotModification mods) { var aas = new Aminoacids(); foreach (var mod in mods.StaticModification) { var item = new PepXmlModificationItem() { IsVariable = false }; AssignModification(aas, mod, item); this.Add(item); } foreach (var mod in mods.DynamicModification) { var item = new PepXmlModificationItem() { IsVariable = true, Symbol = mod.Symbol.ToString() }; AssignModification(aas, mod, item); this.Add(item); } }
protected override void DoRealGo() { Aminoacids aas = Aminoacids.ParseModificationFromOutFileLine(modification.Text); IPeptideMassCalculator calc; if (isMonoisotopic.Checked) { calc = new MonoisotopicPeptideMassCalculator(aas); } else { calc = new AveragePeptideMassCalculator(aas); } string seq = PeptideUtils.GetMatchedSequence(sequence.Text); double value; if (isMH.Checked) { value = calc.GetMz(seq, 1); } else { value = calc.GetMass(seq); } txtResult.Text = value.ToString(); }
private static void AssignModification(Aminoacids aas, MascotModificationEntry mod, PepXmlModificationItem item) { if (mod.Type.Equals("N-term")) { item.IsProteinTerminal = true; item.IsTerminalN = true; item.IsAminoacid = false; item.MassDiff = mod.DeltaMass; item.Mass = Atom.H.MonoMass + item.MassDiff; } else if (mod.Type.Equals("C-term")) { item.IsProteinTerminal = true; item.IsTerminalN = false; item.IsAminoacid = false; item.MassDiff = mod.DeltaMass; item.Mass = Atom.H.MonoMass + Atom.O.MonoMass + item.MassDiff; } else { item.IsProteinTerminal = false; item.IsTerminalN = false; item.IsAminoacid = true; item.Aminoacid = mod.Name; item.MassDiff = mod.DeltaMass; item.Mass = aas[mod.Type[0]].MonoMass + item.MassDiff; } }
public Aminoacids GetAminoacids() { var mod = ModificationUtils.ParseFromOutFileLine(this.Modification); var result = new Aminoacids(); mod.ForEach(m => result[m.Key].ResetMass(m.Value, m.Value)); return(result); }
public static void AddAcidCount(this List <Cluster> clusters, Aminoacids acid) { foreach (var cluster in clusters.Where(cluster => cluster.Contains((int)acid))) { cluster.Count++; return; } }
public void TestGetCarbonRange() { string peptide = "MAAHRRWLLMSFLFLEVILLEAAK"; Aminoacids aas = new Aminoacids(); double residueMass = aas.MonoResiduesMass(peptide); int expect = aas.AtomCount(peptide, Atom.C); CarbonRange carbonRange = new ProteinCarbonRangePredictor().GetCarbonRange(residueMass); Assert.Greater(expect, carbonRange.Min); Assert.Less(expect, carbonRange.Max); }
public void TestGetCarbonPercentAminoacid() { Aminoacids aas = new Aminoacids(); Aminoacid maxAA = aas.GetMaxCarbonPercentAminoacid(); Assert.AreEqual("Phe", maxAA.ThreeName); Aminoacid minAA = aas.GetMinCarbonPercentAminoacid(); Assert.AreEqual("Cys", minAA.ThreeName); }
public Aminoacids ParseAminoacids(string fileName) { SQLiteDBHelper sqlite = new SQLiteDBHelper(fileName); var result = new Aminoacids(); var aaReader = sqlite.ExecuteReader("select OneLetterCode, MonoisotopicMass, AverageMass from Aminoacids", null); while (aaReader.Read()) { var aa = aaReader.GetString(0); if (string.IsNullOrEmpty(aa) || aa == " ") { continue; } var monomass = aaReader.GetDouble(1); var avemass = aaReader.GetDouble(2); if (monomass == 0.0 || avemass == 0.0) { continue; } result[aa[0]].ResetMass(monomass, avemass); } var staticModReader = sqlite.ExecuteReader("select ParameterName, ParameterValue from ProcessingNodeParameters", null); while (staticModReader.Read()) { var name = staticModReader.GetString(0); var value = staticModReader.GetString(1); if (name.StartsWith("StatMod_")) { var parts = value.Split('#'); if (parts.Length == 2) { var aaid = int.Parse(parts[0]); var modid = int.Parse(parts[1]); var aareader = sqlite.ExecuteReader(string.Format("select aa.OneLetterCode, aam.DeltaMass from Aminoacids as aa, AminoacidModifications as aam where aa.AminoacidID={0} and aam.AminoacidModificationID={1}", aaid, modid), null); while (aareader.Read()) { var aaChar = aareader.GetString(0)[0]; var aaDeltaMass = aareader.GetDouble(1); var curAminoacid = result[aaChar]; curAminoacid.ResetMass(curAminoacid.MonoMass + aaDeltaMass, curAminoacid.AverageMass + aaDeltaMass); } } } } return(result); }
private void InitTheoreticalPeaks() { Aminoacids aas = new Aminoacids(); aas.SetModification(StaticModification); aas.SetModification(DynamicModification); CIDFragmentationBuilder <MatchedPeak> builder = new CIDFragmentationBuilder <MatchedPeak> (ExperimentalPeakList.PrecursorCharge, aas); ionSeries = builder.GetIonSeries(PeptideUtils.GetMatchedSequence(Peptide)); }
public override void InitializeByTag(double tagMH) { var aas = new Aminoacids(); var minb = aas['G'].MonoMass + tagMH; var h2o = Atom.H.MonoMass * 2 + Atom.O.MonoMass; this.lowBYFreeWindow = aas['K'].MonoMass + tagMH + h2o; this.highBYFreeWindow = aas['K'].MonoMass + tagMH + Atom.H.MonoMass + Atom.O.MonoMass; this.highBYFreeWindowDescription = "PrecursorMass-Lys-Label-OH"; }
private List <TargetVariant> GetExtensionDeltaMass() { var result = new List <TargetVariant>(); var aa = new Aminoacids(); var validAA = (from a in aa.GetVisibleAminoacids() where a != 'I' select a).ToArray(); foreach (var ai in validAA) { result.Add(new TargetVariant() { Source = string.Empty, Target = new HashSet <string>(new[] { ai.ToString() }), DeltaMass = aa[ai].MonoMass }); foreach (var aj in validAA) { result.Add(new TargetVariant() { Source = string.Empty, Target = new HashSet <string>(new[] { ai.ToString() + aj.ToString() }), DeltaMass = aa[ai].MonoMass + aa[aj].MonoMass }); foreach (var ak in validAA) { result.Add(new TargetVariant() { Source = string.Empty, Target = new HashSet <string>(new[] { ai.ToString() + aj.ToString() + ak.ToString() }), DeltaMass = aa[ai].MonoMass + aa[aj].MonoMass + aa[ak].MonoMass }); } } } var grp = result.GroupBy(m => m.DeltaMass).ToList().ConvertAll(l => l.ToList()); result.Clear(); foreach (var g in grp) { var tv = g.First(); for (int i = 1; i < g.Count; i++) { tv.Target.UnionWith(g[i].Target); } result.Add(tv); } return(result); }
private Dictionary <char, List <TargetVariant> > GetSubstitutionDeltaMass() { var result = new Dictionary <char, List <TargetVariant> >(); var aa = new Aminoacids(); var validAA = aa.GetVisibleAminoacids(); foreach (var ai in validAA) { foreach (var aj in validAA) { if (ai == aj) { continue; } if (this.IsSingleNucleotideMutationOnly && !MutationUtils.IsSingleNucleotideMutation(ai, aj)) { continue; } if (this.IgnoreDeamidatedMutation && MutationUtils.IsDeamidatedMutation(ai, aj)) { continue; } if (!result.ContainsKey(ai)) { result[ai] = new List <TargetVariant>(); } var deltaMass = aa[aj].MonoMass - aa[ai].MonoMass; if (Math.Abs(deltaMass) < MinimumAminoacidSubstitutionDeltaMass) { continue; } result[ai].Add(new TargetVariant() { Source = ai.ToString(), Target = new HashSet <string>(new[] { aj.ToString() }), DeltaMass = deltaMass, TargetType = VariantType.SingleAminoacidPolymorphism }); } } foreach (var v in result.Values) { v.Sort((m1, m2) => m1.DeltaMass.CompareTo(m2.DeltaMass)); } return(result); }
public void TestBuildInfo() { var aas = new Aminoacids(); var addedMass1 = 20.3847; var addedMass2 = 40.3847; aas['*'].ResetMass(addedMass1, addedMass1); aas['#'].ResetMass(addedMass2, addedMass2); var s1 = aas.BuildInfo("R.A#D*K.L"); Assert.AreEqual(3, s1.Count); Assert.AreEqual('A', s1[0].Aminoacid); Assert.AreEqual(aas['A'].MonoMass + addedMass2, s1[0].Mass, 0.0001); Assert.AreEqual(aas['D'].MonoMass + addedMass1, s1[1].Mass, 0.0001); Assert.AreEqual(aas['K'].MonoMass, s1[2].Mass, 0.0001); }
protected void InitCalculator() { { var sample = new Aminoacids(); sample.SetVisible(false); var reference = new Aminoacids(); reference.SetVisible(false); var sampleNterm = new AtomComposition(""); var sampleCterm = new AtomComposition(""); var refNterm = new AtomComposition(""); var refCterm = new AtomComposition(""); foreach (SectionInfo si in this.sections) { if (si.ItemName.Length == 1) { char aa = si.ItemName[0]; sample[aa].CompositionStr = si.SampleAtomMap.ToString(); sample[aa].ResetMass(Atom.GetMonoMass(si.SampleAtomMap), Atom.GetAverageMass(si.SampleAtomMap)); sample[aa].Visible = true; reference[aa].CompositionStr = si.ReferenceAtomMap.ToString(); reference[aa].ResetMass(Atom.GetMonoMass(si.ReferenceAtomMap), Atom.GetAverageMass(si.ReferenceAtomMap)); reference[aa].Visible = true; } else if (si.ItemName.Equals("NTERM")) { sampleNterm = si.SampleAtomMap; refNterm = si.ReferenceAtomMap; } else if (si.ItemName.Equals("CTERM")) { sampleCterm = si.SampleAtomMap; refCterm = si.ReferenceAtomMap; } else { throw new Exception("What is it? " + si.ItemName[0]); } } this.sampleCalculator = AllocatePeptideMassCalculator(sample, this.getMassFromComposition(sampleNterm), this.getMassFromComposition(sampleCterm)); this.referenceCalculator = AllocatePeptideMassCalculator(reference, this.getMassFromComposition(refNterm), this.getMassFromComposition(refCterm)); this.sampleAtomCompositionCalculator = new PeptideAtomCompositionCalculator(sampleNterm, sampleCterm, sample); this.referenceAtomCompositionCalculator = new PeptideAtomCompositionCalculator(refNterm, refCterm, reference); } }
public void InitTerminalLoss(Aminoacids aa, int maxTerminalLossLength, int minSequenceLength) { this.TerminalLoss = new List <TerminalLossItem>(); var seq = PeptideUtils.GetMatchedSequence(this.Peptide); var pureseq = PeptideUtils.GetPureSequence(this.Peptide); var pos = 0; var index = 0; var maxIndex = Math.Min(maxTerminalLossLength, pureseq.Length - minSequenceLength); var deltaMass = 0.0; while (index < maxIndex) { deltaMass += aa[seq[pos]].MonoMass; if (!char.IsUpper(seq[pos + 1])) { pos++; continue; } index++; pos++; var precursorLoss = this.Precursor - deltaMass / this.Charge; this.TerminalLoss.Add(new TerminalLossItem(true, pureseq.Substring(index), precursorLoss)); } index = 0; pos = seq.Length - 1; deltaMass = 0.0; while (index < maxIndex) { deltaMass += aa[seq[pos]].MonoMass; if (!char.IsUpper(seq[pos])) { pos--; continue; } index++; pos--; var precursorLoss = this.Precursor - deltaMass / this.Charge; this.TerminalLoss.Add(new TerminalLossItem(false, pureseq.Substring(0, pureseq.Length - index), precursorLoss)); } }
public void TestTransferTo() { var aas = new Aminoacids(); int count; var actual = SnpCode.TransferTo(aas['I'], aas['L'], out count); Assert.AreEqual(1, count); Assert.AreEqual("AUU->CUU ! AUC->CUC ! AUA->UUA ! AUA->CUA", actual); actual = SnpCode.TransferTo(aas['I'], aas['.'], out count); Assert.AreEqual(int.MaxValue, count); Assert.AreEqual(string.Empty, actual); actual = SnpCode.TransferTo(aas['.'], aas['I'], out count); Assert.AreEqual(int.MaxValue, count); Assert.AreEqual(string.Empty, actual); }
private string[] DoStatistic(string fileName, Aminoacids aas, MascotPeptideTextFormat format, Dictionary <string, Sequence> proMap, IClassification <IIdentifiedPeptide> classification, string mutHeader, MascotPeptideTextFormat mutPepFormat, List <List <IGrouping <string, IIdentifiedPeptide> > > curtype, string curname) { var pairedMut = (from r in curtype where r.Count > 1 select r).ToList(); var dic = pairedMut.GroupBy(m => GetMaxScore(m[0]).Spectrum.Query.FileScan.LongFileName); var pairedOne2OneMut = (from d in dic where d.Count() == 1 from s in d select s).ToList(); var pairedOne2OneFile = fileName + curname + ".paired.one2one.mut"; var pairedOne2OnePeptideFile = OutputPairedResult(aas, format, proMap, classification, mutHeader, mutPepFormat, pairedOne2OneMut, pairedOne2OneFile); var pairedOne2MultipleMut = pairedMut.Except(pairedOne2OneMut).OrderBy(m => GetMaxScore(m[0]).Spectrum.Query.FileScan.LongFileName).ToList(); var pairedOne2MultipleFile = fileName + curname + ".paired.one2multiple.mut"; var pairedOne2MultiplePeptideFile = OutputPairedResult(aas, format, proMap, classification, mutHeader, mutPepFormat, pairedOne2MultipleMut, pairedOne2MultipleFile); var unpairedFile = fileName + curname + ".unpaired.mut"; var unpairedMut = (from r in curtype where r.Count == 1 select r).ToList(); using (StreamWriter sw = new StreamWriter(unpairedFile)) { sw.WriteLine("Index\t" + mutHeader + "\tSequence\tPepCount"); int resIndex = 0; foreach (var res in unpairedMut) { resIndex++; var curMutSpectrum = GetMaxScore(res[0]); var mutSeq = curMutSpectrum.PureSequence; sw.WriteLine("${0}\t{1}\t{2}\t{3}", resIndex, mutPepFormat.PeptideFormat.GetString(curMutSpectrum.Spectrum), mutSeq, res[0].Count()); } } var unpairedPeptideFile = unpairedFile + ".peptides"; SavePeptidesFile(unpairedMut, format, unpairedPeptideFile); return(new string[] { pairedOne2OneFile, pairedOne2OnePeptideFile, pairedOne2MultipleFile, pairedOne2MultiplePeptideFile, unpairedFile, unpairedPeptideFile }); }
//[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 void TestBuild() { var aas = new Aminoacids(); aas['*'].ResetMass(79.9799, 79.9799); aas['C'].ResetMass(160.1652, 160.1652); var builder = new CIDPeptideB2SeriesBuilder <IonTypePeak>() { CurAminoacids = aas }; List <IonTypePeak> pkl = builder.Build("APYMEEQLQLLMCKYPEMT*LEDK"); //Output(pkl, IonType.B2); Assert.IsTrue(pkl.All(m => m.Charge == 2)); Assert.AreEqual(22, pkl.Count); AssertPeak(pkl[0], IonType.B2, 1, 36.5264); AssertPeak(pkl[1], IonType.B2, 2, 85.0528); AssertPeak(pkl[2], IonType.B2, 3, 166.5844); AssertPeak(pkl[3], IonType.B2, 4, 232.1047); AssertPeak(pkl[4], IonType.B2, 5, 296.6260); AssertPeak(pkl[5], IonType.B2, 6, 361.1473); AssertPeak(pkl[6], IonType.B2, 7, 425.1765); AssertPeak(pkl[7], IonType.B2, 8, 481.7186); AssertPeak(pkl[8], IonType.B2, 9, 545.7479); AssertPeak(pkl[9], IonType.B2, 10, 602.2899); AssertPeak(pkl[10], IonType.B2, 11, 658.8319); AssertPeak(pkl[11], IonType.B2, 12, 724.3522); AssertPeak(pkl[12], IonType.B2, 13, 804.4348); AssertPeak(pkl[13], IonType.B2, 14, 868.4823); AssertPeak(pkl[14], IonType.B2, 15, 950.0139); AssertPeak(pkl[15], IonType.B2, 16, 998.5403); AssertPeak(pkl[16], IonType.B2, 17, 1063.0616); AssertPeak(pkl[17], IonType.B2, 18, 1128.5818); AssertPeak(pkl[18], IonType.B2, 19, 1219.0956); AssertPeak(pkl[19], IonType.B2, 20, 1275.6377); AssertPeak(pkl[20], IonType.B2, 21, 1340.1590); AssertPeak(pkl[21], IonType.B2, 22, 1397.6724); }
public IPeptideMassCalculator GetPeptideMassCalculator() { bool isMono = IsPrecursorMonoisotopic(); var aas = new Aminoacids(); Dictionary <char, double> staticModifications = GetStaticAminoacidModification(); foreach (char aa in staticModifications.Keys) { aas[aa].ResetMass(aas[aa].MonoMass + staticModifications[aa], aas[aa].AverageMass + staticModifications[aa]); } var diff = new[] { '*', '#', '@', '^', '~', '$' }; int i = 0; foreach (double mod in Diff_search_options.Values) { aas[diff[i++]].ResetMass(mod, mod); } double nterm = isMono ? Atom.H.MonoMass : Atom.H.AverageMass; double cterm = isMono ? Atom.H.MonoMass + Atom.O.MonoMass : Atom.H.AverageMass + Atom.O.AverageMass; if (this.term_diff_search_options.First != 0.0 || this.term_diff_search_options.Second != 0.0) { throw new Exception( "Term dynamic modification has not been implemented into this function, call author to fix it."); } IPeptideMassCalculator result; if (isMono) { result = new MonoisotopicPeptideMassCalculator(aas, nterm, cterm); } else { result = new AveragePeptideMassCalculator(aas, nterm, cterm); } return(result); }
public void TestBuild() { var aas = new Aminoacids(); aas['*'].ResetMass(79.9799, 79.9799); aas['C'].ResetMass(160.1652, 160.1652); var builder = new CIDPeptideB2SeriesBuilder<IonTypePeak>() { CurAminoacids = aas }; List<IonTypePeak> pkl = builder.Build("APYMEEQLQLLMCKYPEMT*LEDK"); //Output(pkl, IonType.B2); Assert.IsTrue(pkl.All(m => m.Charge == 2)); Assert.AreEqual(22, pkl.Count); AssertPeak(pkl[0], IonType.B2, 1, 36.5264); AssertPeak(pkl[1], IonType.B2, 2, 85.0528); AssertPeak(pkl[2], IonType.B2, 3, 166.5844); AssertPeak(pkl[3], IonType.B2, 4, 232.1047); AssertPeak(pkl[4], IonType.B2, 5, 296.6260); AssertPeak(pkl[5], IonType.B2, 6, 361.1473); AssertPeak(pkl[6], IonType.B2, 7, 425.1765); AssertPeak(pkl[7], IonType.B2, 8, 481.7186); AssertPeak(pkl[8], IonType.B2, 9, 545.7479); AssertPeak(pkl[9], IonType.B2, 10, 602.2899); AssertPeak(pkl[10], IonType.B2, 11, 658.8319); AssertPeak(pkl[11], IonType.B2, 12, 724.3522); AssertPeak(pkl[12], IonType.B2, 13, 804.4348); AssertPeak(pkl[13], IonType.B2, 14, 868.4823); AssertPeak(pkl[14], IonType.B2, 15, 950.0139); AssertPeak(pkl[15], IonType.B2, 16, 998.5403); AssertPeak(pkl[16], IonType.B2, 17, 1063.0616); AssertPeak(pkl[17], IonType.B2, 18, 1128.5818); AssertPeak(pkl[18], IonType.B2, 19, 1219.0956); AssertPeak(pkl[19], IonType.B2, 20, 1275.6377); AssertPeak(pkl[20], IonType.B2, 21, 1340.1590); AssertPeak(pkl[21], IonType.B2, 22, 1397.6724); }
public void TestBuild() { var aas = new Aminoacids(); var builder = new ETDPeptideCSeriesBuilder <IonTypePeak>(2000, 3) { CurAminoacids = aas }; aas['*'].ResetMass(1217.117, 1217.117); List <IonTypePeak> pkl = builder.Build("SRN*LTK"); AssertPeak(pkl[0], IonType.C, 1, 105.0664); AssertPeak(pkl[1], IonType.C, 2, 261.1675); AssertPeak(pkl[2], IonType.C, 3, 1592.3274); AssertPeak(pkl[3], IonType.C, 4, 1705.4115); AssertPeak(pkl[4], IonType.C, 5, 1806.4592); //pkl.ForEach(p => Console.Out.WriteLine(MyConvert.Format("{0}{1}\t{2:0.0000}", p.PeakType, p.PeakIndex, p.Mz))); }
public void TestBuild() { var aas = new Aminoacids(); var builder = new ETDPeptideCSeriesBuilder<IonTypePeak>(2000, 3) { CurAminoacids = aas }; aas['*'].ResetMass(1217.117, 1217.117); List<IonTypePeak> pkl = builder.Build("SRN*LTK"); AssertPeak(pkl[0], IonType.C, 1, 105.0664); AssertPeak(pkl[1], IonType.C, 2, 261.1675); AssertPeak(pkl[2], IonType.C, 3, 1592.3274); AssertPeak(pkl[3], IonType.C, 4, 1705.4115); AssertPeak(pkl[4], IonType.C, 5, 1806.4592); //pkl.ForEach(p => Console.Out.WriteLine(MyConvert.Format("{0}{1}\t{2:0.0000}", p.PeakType, p.PeakIndex, p.Mz))); }
protected override void DoRealGo() { MassCalculator averageCalc = new MassCalculator(Atom.AverageMassFunction); MassCalculator monoCalc = new MassCalculator(Atom.MonoMassFunction); Aminoacids aas = new Aminoacids(); aas['C'].ResetMass(aas['C'].MonoMass + 57.0215, aas['C'].AverageMass + 57.0215); StringBuilder sb = new StringBuilder(); double totalMass = 0.0; if (peptideSequence.Text.Length > 0) { double averageMass = aas.AveragePeptideMass(peptideSequence.Text); sb.Append(MyConvert.Format("PeptideMass={0:0.0000}; ", averageMass)); totalMass = averageMass; } if (glycanStructure.Text.Length > 0) { AtomComposition ac = new AtomComposition(glycanStructure.Text); double averageMass = averageCalc.GetMass(ac); sb.Append(MyConvert.Format("GlycanMass={0:0.0000}; ", averageMass)); if (totalMass > 0) { totalMass += averageMass - 18.0; sb.Append(MyConvert.Format("TotalMass={0:0.0000}; ", totalMass)); for (int charge = 2; charge <= 4; charge++) { sb.Append(MyConvert.Format("Charge{0}={1:0.0000}; ", charge, (totalMass + charge) / charge)); } } } txtResultInfo.Text = sb.ToString(); }
public void TestBuild() { var aas = new Aminoacids(); aas['*'].ResetMass(79.9799, 79.9799); aas['C'].ResetMass(160.1652, 160.1652); var builder = new CIDPeptideY2SeriesBuilder <IonTypePeak>() { CurAminoacids = aas }; List <IonTypePeak> pkl = builder.Build("APYMEEQLQLLMCKYPEMT*LEDK"); //Output(pkl, IonType.Y2); Assert.AreEqual(22, pkl.Count); AssertPeak(pkl[0], IonType.Y2, 1, 74.0606); AssertPeak(pkl[1], IonType.Y2, 2, 131.5741); AssertPeak(pkl[2], IonType.Y2, 3, 196.0954); AssertPeak(pkl[3], IonType.Y2, 4, 252.6374); AssertPeak(pkl[4], IonType.Y2, 5, 343.1512); AssertPeak(pkl[5], IonType.Y2, 6, 408.6714); AssertPeak(pkl[6], IonType.Y2, 7, 473.1927); AssertPeak(pkl[7], IonType.Y2, 8, 521.7191); AssertPeak(pkl[8], IonType.Y2, 9, 603.2508); AssertPeak(pkl[9], IonType.Y2, 10, 667.2982); AssertPeak(pkl[10], IonType.Y2, 11, 747.3808); AssertPeak(pkl[11], IonType.Y2, 12, 812.9011); AssertPeak(pkl[12], IonType.Y2, 13, 869.4431); AssertPeak(pkl[13], IonType.Y2, 14, 925.9851); AssertPeak(pkl[14], IonType.Y2, 15, 990.0144); AssertPeak(pkl[15], IonType.Y2, 16, 1046.5565); AssertPeak(pkl[16], IonType.Y2, 17, 1110.5858); AssertPeak(pkl[17], IonType.Y2, 18, 1175.1071); AssertPeak(pkl[18], IonType.Y2, 19, 1239.6284); AssertPeak(pkl[19], IonType.Y2, 20, 1305.1486); AssertPeak(pkl[20], IonType.Y2, 21, 1386.6803); AssertPeak(pkl[21], IonType.Y2, 22, 1435.2066); }
public void TestIsRnaEditing() { var aas = new Aminoacids(); var aasstr = aas.GetVisibleAminoacids(); for (int i = 0; i < aasstr.Length; i++) { for (int j = 0; j < aasstr.Length; j++) { if(i == j) { continue; } string mutationstr; if (aas[aasstr[i]].IsRnaEditing(aas[aasstr[j]], out mutationstr)) { Console.WriteLine(aasstr[i] + "->" + aasstr[j] + " : " + mutationstr); } } } }
public void TestPeptideAtomCompositionCalculator() { AtomComposition nterm = new AtomComposition("H"); AtomComposition cterm = new AtomComposition("OH"); Aminoacids aas = new Aminoacids(); PeptideAtomCompositionCalculator calc = new PeptideAtomCompositionCalculator(nterm, cterm, aas); //Terminal only IPeptideInfo terminalInfo = new IdentifiedPeptideInfo("",0.0,0); AtomComposition terminalActual = calc.GetAtomComposition(terminalInfo); Assert.AreEqual(2, terminalActual[Atom.H]); Assert.AreEqual(1, terminalActual[Atom.O]); //A:C3H5NO IPeptideInfo peptideInfo = new IdentifiedPeptideInfo("A", 0.0, 0); AtomComposition peptideActual = calc.GetAtomComposition(peptideInfo); Assert.AreEqual(3, peptideActual[Atom.C]); Assert.AreEqual(7, peptideActual[Atom.H]); Assert.AreEqual(1, peptideActual[Atom.N]); Assert.AreEqual(2, peptideActual[Atom.O]); }
public void TestBuild() { var aas = new Aminoacids(); aas['*'].ResetMass(79.9799, 79.9799); aas['C'].ResetMass(160.1652, 160.1652); var builder = new CIDPeptideY2SeriesBuilder<IonTypePeak>() { CurAminoacids = aas }; List<IonTypePeak> pkl = builder.Build("APYMEEQLQLLMCKYPEMT*LEDK"); //Output(pkl, IonType.Y2); Assert.AreEqual(22, pkl.Count); AssertPeak(pkl[0], IonType.Y2, 1, 74.0606); AssertPeak(pkl[1], IonType.Y2, 2, 131.5741); AssertPeak(pkl[2], IonType.Y2, 3, 196.0954); AssertPeak(pkl[3], IonType.Y2, 4, 252.6374); AssertPeak(pkl[4], IonType.Y2, 5, 343.1512); AssertPeak(pkl[5], IonType.Y2, 6, 408.6714); AssertPeak(pkl[6], IonType.Y2, 7, 473.1927); AssertPeak(pkl[7], IonType.Y2, 8, 521.7191); AssertPeak(pkl[8], IonType.Y2, 9, 603.2508); AssertPeak(pkl[9], IonType.Y2, 10, 667.2982); AssertPeak(pkl[10], IonType.Y2, 11, 747.3808); AssertPeak(pkl[11], IonType.Y2, 12, 812.9011); AssertPeak(pkl[12], IonType.Y2, 13, 869.4431); AssertPeak(pkl[13], IonType.Y2, 14, 925.9851); AssertPeak(pkl[14], IonType.Y2, 15, 990.0144); AssertPeak(pkl[15], IonType.Y2, 16, 1046.5565); AssertPeak(pkl[16], IonType.Y2, 17, 1110.5858); AssertPeak(pkl[17], IonType.Y2, 18, 1175.1071); AssertPeak(pkl[18], IonType.Y2, 19, 1239.6284); AssertPeak(pkl[19], IonType.Y2, 20, 1305.1486); AssertPeak(pkl[20], IonType.Y2, 21, 1386.6803); AssertPeak(pkl[21], IonType.Y2, 22, 1435.2066); }
public override void InitializeByTag(double tagMH) { var aas = new Aminoacids(); var minb = aas['G'].MonoMass + tagMH; var h2o = Atom.H.MonoMass * 2 + Atom.O.MonoMass; var miny = Math.Min(aas['K'].MonoMass + tagMH + h2o, aas['R'].MonoMass + h2o + Atom.H.MonoMass); this.lowBYFreeWindow = Math.Min(minb, miny); var massR = aas['R'].MonoMass + h2o; var massK = aas['K'].MonoMass + tagMH + Atom.H.MonoMass + Atom.O.MonoMass; this.highBYFreeWindow = Math.Min(massR, massK); if (massR < massK) { this.highBYFreeWindowDescription = "PrecursorMass-Arg-H2O"; } else { this.highBYFreeWindowDescription = "PrecursorMass-Lys-Label-OH"; } }
public void TestIsRnaEditing() { var aas = new Aminoacids(); var aasstr = aas.GetVisibleAminoacids(); for (int i = 0; i < aasstr.Length; i++) { for (int j = 0; j < aasstr.Length; j++) { if (i == j) { continue; } string mutationstr; if (aas[aasstr[i]].IsRnaEditing(aas[aasstr[j]], out mutationstr)) { Console.WriteLine(aasstr[i] + "->" + aasstr[j] + " : " + mutationstr); } } } }
private void WriteModifications(SequestParam sp) { var aas = new Aminoacids(); foreach (SequestStaticModification ssm in sp.StaticModification.Keys) { double addMass = sp.StaticModification[ssm]; if (addMass != 0.0) { switch (ssm) { case SequestStaticModification.add_Cterm_peptide: case SequestStaticModification.add_Cterm_protein: case SequestStaticModification.add_Nterm_peptide: case SequestStaticModification.add_Nterm_protein: break; default: char aa = SequestParam.ModificationToAminoacid(ssm); this.sw.WriteLine( " <aminoacid_modification aminoacid=\"{0}\" massdiff=\"{1:0.0000}\" mass=\"{2:0.0000}\" variable=\"N\"/>", aa, addMass, aas[aa].MonoMass + addMass); break; } } } foreach (String aminoacids in sp.Diff_search_options.Keys) { double addMass = sp.Diff_search_options[aminoacids]; foreach (char aa in aminoacids) { this.sw.WriteLine( " <aminoacid_modification aminoacid=\"{0}\" massdiff=\"{1:0.0000}\" mass=\"{2:0.0000}\" variable=\"Y\"/>", aa, addMass, aas[aa].MonoMass + addMass); } } }
private void WriteModifications(StreamWriter sw, PepXmlModifications sp) { var aas = new Aminoacids(); foreach (var ssm in sp) { if (ssm.MassDiff != 0.0) { if (ssm.IsAminoacid) { sw.Write(" <aminoacid_modification aminoacid=\"{0}\" massdiff=\"{1:0.0000}\" mass=\"{2:0.0000}\" variable=\"{3}\"", ssm.Aminoacid, ssm.MassDiff, ssm.Mass, ssm.IsVariable ? "Y" : "N"); } else { sw.Write(" <terminal_modification terminus=\"{0}\" massdiff=\"{1:0.0000}\" mass=\"{2:0.0000}\" variable=\"{3}\" protein_terminus=\"{4}\"", ssm.IsTerminalN ? "n" : "c", ssm.MassDiff, ssm.Mass, ssm.IsVariable ? "Y" : "N", ssm.IsProteinTerminal ? (ssm.IsTerminalN ? "n" : "c") : ""); } if (string.IsNullOrEmpty(ssm.Symbol)) { sw.WriteLine("/>"); } else { sw.WriteLine(" symbol=\"{0}\"/>", ssm.Symbol); } } } }