public static TheoreticalProteoform make_a_theoretical(string a, double mass, int lysine_count) { ModificationMotif motif; ModificationMotif.TryGetMotif("X", out motif); Modification unmodification = new Modification("Unmodified", _target: motif, _locationRestriction: "Anywhere.", _monoisotopicMass: 0); ProteinWithGoTerms p1 = new ProteinWithGoTerms("MSSSSSSSSSSS", "T1", new List <Tuple <string, string> > { new Tuple <string, string>("", "") }, new Dictionary <int, List <Modification> > { { 0, new List <Modification> { unmodification } } }, new List <ProteolysisProduct> { new ProteolysisProduct(1, 12, "") }, "T2", "T3", true, false, new List <DatabaseReference> { new DatabaseReference("GO", ":", new List <Tuple <string, string> > { new Tuple <string, string>("term", "P:") }) }, new List <GoTerm> { new GoTerm(new DatabaseReference("GO", ":", new List <Tuple <string, string> > { new Tuple <string, string>("term", "P:") })) }); PtmSet set = new PtmSet(new List <Ptm> { new Ptm() }); var t = new TheoreticalProteoform(a, "", p1.BaseSequence, new List <ProteinWithGoTerms> { p1 }, mass, lysine_count, set, true, false, new Dictionary <InputFile, Protein[]>()); t.modified_mass = mass; return(t); }
public static TheoreticalProteoform make_a_theoretical(string a, string d, double mass, ProteinWithGoTerms p, Dictionary <InputFile, Protein[]> dict) { ModificationMotif motif; ModificationMotif.TryGetMotif("X", out motif); string mod_title = "oxidation"; Modification m = new Modification(mod_title, _modificationType: "modtype", _target: motif, _locationRestriction: "Anywhere.", _monoisotopicMass: 1); ProteinWithGoTerms p1 = new ProteinWithGoTerms("MSSSSSSSSSSS", "T1", new List <Tuple <string, string> > { new Tuple <string, string>("ordered locus", "GENE") }, new Dictionary <int, List <Modification> > { { 1, new List <Modification> { m } } }, new List <ProteolysisProduct> { new ProteolysisProduct(1, 12, "") }, "T2", "T3", true, false, new List <DatabaseReference> { new DatabaseReference("GO", ":", new List <Tuple <string, string> > { new Tuple <string, string>("term", "P:") }) }, new List <GoTerm> { new GoTerm(new DatabaseReference("GO", ":", new List <Tuple <string, string> > { new Tuple <string, string>("term", "P:") })) }); PtmSet set = new PtmSet(new List <Ptm> { new Ptm(0, m) }); return(new TheoreticalProteoform(a, d, p1.BaseSequence, new List <ProteinWithGoTerms> { p }, mass, 0, set, true, false, dict)); }
public static TheoreticalProteoform make_a_theoretical(string a, string d, double mass, ProteinWithGoTerms p, Dictionary <InputFile, Protein[]> dict) { ModificationMotif motif; ModificationMotif.TryGetMotif("K", out motif); string mod_title = "oxidation"; ModificationWithMass m = new ModificationWithMass(mod_title, new Tuple <string, string>("", mod_title), motif, ModificationSites.K, 1, new Dictionary <string, IList <string> >(), new List <double>(), new List <double>(), ""); ProteinWithGoTerms p1 = new ProteinWithGoTerms("MSSSSSSSSSSS", "T1", new List <Tuple <string, string> > { new Tuple <string, string>("ordered locus", "GENE") }, new Dictionary <int, List <Modification> > { { 1, new List <Modification> { m } } }, new int?[] { 0 }, new int?[] { 0 }, new string[] { "" }, "T2", "T3", true, false, new List <DatabaseReference> { new DatabaseReference("GO", ":", new List <Tuple <string, string> > { new Tuple <string, string>("term", "P:") }) }, new List <GoTerm> { new GoTerm(new DatabaseReference("GO", ":", new List <Tuple <string, string> > { new Tuple <string, string>("term", "P:") })) }); PtmSet set = new PtmSet(new List <Ptm> { new Ptm(0, m) }); return(new TheoreticalProteoform(a, d, new List <ProteinWithGoTerms> { p }, mass, 0, set, true, false, dict)); }
//MAKE THEORETICAL public static TheoreticalProteoform make_a_theoretical(string a, ProteinWithGoTerms p, Dictionary <InputFile, Protein[]> dict) { ModificationMotif motif; ModificationMotif.TryGetMotif("K", out motif); PtmSet set = new PtmSet(p.OneBasedPossibleLocalizedModifications.SelectMany(m => m.Value.OfType <ModificationWithMass>().SelectMany(mmm => new List <Ptm> { new Ptm(0, mmm) })).ToList()); return(new TheoreticalProteoform(a, "", new List <ProteinWithGoTerms> { p }, 100, 0, set, true, true, dict)); }
//MAKE THEORETICAL public static TheoreticalProteoform make_a_theoretical(string a, ProteinWithGoTerms p, Dictionary <InputFile, Protein[]> dict) { ModificationMotif motif; ModificationMotif.TryGetMotif("X", out motif); PtmSet set = new PtmSet(p.OneBasedPossibleLocalizedModifications.SelectMany(m => m.Value.SelectMany(mmm => new List <Ptm> { new Ptm(0, mmm) })).ToList()); TheoreticalProteoform t = new TheoreticalProteoform(a, "", p.BaseSequence, new List <ProteinWithGoTerms> { p }, 100, 0, set, true, true, dict); t.begin = 1; t.end = 4; return(t); }
public void test_same_ptmset() { PtmSet set1 = new PtmSet(new List <Ptm>() { new Ptm(1, ConstructorsForTesting.get_modWithMass("id1", 5)), new Ptm(2, ConstructorsForTesting.get_modWithMass("id2", 6)), new Ptm(2, ConstructorsForTesting.get_modWithMass("id4", 6)) }); PtmSet set2 = new PtmSet(new List <Ptm>() { new Ptm(1, ConstructorsForTesting.get_modWithMass("id1", 5)), new Ptm(2, ConstructorsForTesting.get_modWithMass("id2", 6)), new Ptm(2, ConstructorsForTesting.get_modWithMass("id4", 6)) }); Assert.IsTrue(set1.same_ptmset(set2, true)); Assert.IsTrue(set1.same_ptmset(set2, false)); set2 = new PtmSet(new List <Ptm>() { new Ptm(1, ConstructorsForTesting.get_modWithMass("id1", 5)), new Ptm(2, ConstructorsForTesting.get_modWithMass("id2", 6)), new Ptm(2, ConstructorsForTesting.get_modWithMass("id3", 6)) }); Assert.IsFalse(set1.same_ptmset(set2, true)); Assert.IsFalse(set1.same_ptmset(set2, false)); Assert.IsFalse(set2.same_ptmset(set1, true)); Assert.IsFalse(set2.same_ptmset(set1, false)); set2 = new PtmSet(new List <Ptm>() { new Ptm(1, ConstructorsForTesting.get_modWithMass("id1", 5)), new Ptm(2, ConstructorsForTesting.get_modWithMass("id2", 6)), }); Assert.IsFalse(set1.same_ptmset(set2, true)); Assert.IsFalse(set1.same_ptmset(set2, false)); Assert.IsFalse(set2.same_ptmset(set1, true)); Assert.IsFalse(set2.same_ptmset(set1, false)); }
public static TheoreticalProteoform make_a_theoretical(string a, double mass, int lysine_count) { ModificationWithMass unmodification = new ModificationWithMass("Unmodified", new Tuple <string, string>("N/A", "Unmodified"), null, ModificationSites.Any, 0, null, null, null, null); ProteinWithGoTerms p1 = new ProteinWithGoTerms("MSSSSSSSSSSS", "T1", new List <Tuple <string, string> > { new Tuple <string, string>("", "") }, new Dictionary <int, List <Modification> > { { 0, new List <Modification> { unmodification } } }, new int?[] { 0 }, new int?[] { 0 }, new string[] { "" }, "T2", "T3", true, false, new List <DatabaseReference> { new DatabaseReference("GO", ":", new List <Tuple <string, string> > { new Tuple <string, string>("term", "P:") }) }, new List <GoTerm> { new GoTerm(new DatabaseReference("GO", ":", new List <Tuple <string, string> > { new Tuple <string, string>("term", "P:") })) }); PtmSet set = new PtmSet(new List <Ptm>()); return(new TheoreticalProteoform(a, "", new List <ProteinWithGoTerms> { p1 }, mass, lysine_count, set, true, false, new Dictionary <InputFile, Protein[]>())); }
public void TestRelateTD() { Sweet.lollipop = new Lollipop(); Sweet.lollipop.neucode_labeled = false; Sweet.lollipop.maximum_missed_monos = 1; Sweet.lollipop.agg_minBiorepsWithObservations = 0; InputFile f = new InputFile("path", Purpose.Identification); Sweet.lollipop.input_files.Add(f); // Two proteoforms; lysine count equal; mass difference < 250 -- return 1 Component c1 = new Component(); c1.weighted_monoisotopic_mass = 1000.0; c1.rt_apex = 45; c1.accepted = true; c1.id = 1.ToString(); c1.intensity_sum = 1e6; c1.input_file = f; c1.charge_states = new List <ChargeState>() { new ChargeState(1, c1.intensity_sum, c1.weighted_monoisotopic_mass) }; Component c2 = new Component(); c2.weighted_monoisotopic_mass = 1000.0; c2.rt_apex = 85; c2.accepted = true; c2.input_file = f; c2.intensity_sum = 1e6; c2.charge_states = new List <ChargeState>() { new ChargeState(1, c2.intensity_sum, c2.weighted_monoisotopic_mass) }; c2.id = 2.ToString(); Component c3 = new Component(); c3.weighted_monoisotopic_mass = 1131.04; c3.rt_apex = 45; c3.accepted = true; c3.input_file = f; c3.intensity_sum = 1e6; c3.charge_states = new List <ChargeState>() { new ChargeState(1, c3.intensity_sum, c3.weighted_monoisotopic_mass) }; c3.id = 3.ToString(); Component c4 = new Component(); c4.weighted_monoisotopic_mass = 2000.00; c4.rt_apex = 45; c4.accepted = true; c4.input_file = new InputFile("path", Purpose.Identification); c4.intensity_sum = 1e6; c4.charge_states = new List <ChargeState>() { new ChargeState(1, c4.intensity_sum, c4.weighted_monoisotopic_mass) }; c4.id = 4.ToString(); Component c5 = new Component(); c5.weighted_monoisotopic_mass = 1001.0; c5.rt_apex = 45; c5.accepted = true; c5.input_file = f; c5.intensity_sum = 1e6; c5.charge_states = new List <ChargeState>() { new ChargeState(1, c5.intensity_sum, c5.weighted_monoisotopic_mass) }; c5.id = 2.ToString(); List <IAggregatable> components = new List <IAggregatable>() { c1, c2, c3, c4, c5 }; Sweet.lollipop.raw_experimental_components = components.OfType <Component>().ToList(); TopDownProteoform td1 = ConstructorsForTesting.TopDownProteoform("ACCESSION_1", 1000.0, 45); TopDownProteoform td2 = ConstructorsForTesting.TopDownProteoform("ACCESSION_2", 1001.0, 85); TopDownProteoform td3 = ConstructorsForTesting.TopDownProteoform("ACCESSION_3", 1131.04, 45); TheoreticalProteoform t1 = ConstructorsForTesting.make_a_theoretical("ACCESSION", 1000.0, 1); //need to make theoretical accession database TestProteoformCommunityRelate.prepare_for_et(new List <double>() { 0 }); Sweet.lollipop.target_proteoform_community.community_number = -100; Sweet.lollipop.theoretical_database.theoreticals_by_accession = new Dictionary <int, Dictionary <string, List <TheoreticalProteoform> > >(); Sweet.lollipop.theoretical_database.theoreticals_by_accession.Add(-100, new Dictionary <string, List <TheoreticalProteoform> >()); Sweet.lollipop.theoretical_database.theoreticals_by_accession[-100].Add(t1.accession, new List <TheoreticalProteoform>() { t1 }); //need to make decon error top "deconvolution error" ModificationMotif motif; ModificationMotif.TryGetMotif("S", out motif); Modification m = new Modification("id", _modificationType: "modtype", _target: motif, _locationRestriction: "Anywhere.", _monoisotopicMass: 1); Sweet.lollipop.theoretical_database.all_mods_with_mass.Add(m); PtmSet set = new PtmSet(new List <Ptm> { new Ptm(-1, m) }); Sweet.lollipop.theoretical_database.all_possible_ptmsets.Add(set); Sweet.lollipop.modification_ranks.Add(-1.0023, 2); Sweet.lollipop.theoretical_database.possible_ptmset_dictionary.Add(-1.0, new List <PtmSet>() { set }); //need missing error Modification m2 = new Modification("id", _modificationType: "modtype", _target: motif, _locationRestriction: "Anywhere.", _monoisotopicMass: 1); Sweet.lollipop.theoretical_database.all_mods_with_mass.Add(m2); PtmSet set2 = new PtmSet(new List <Ptm> { new Ptm(-1, m2) }); Sweet.lollipop.theoretical_database.all_possible_ptmsets.Add(set2); Sweet.lollipop.modification_ranks.Add(-87.03, 2); Sweet.lollipop.theoretical_database.possible_ptmset_dictionary.Add(-87.0, new List <PtmSet>() { set2 }); Sweet.lollipop.target_proteoform_community.theoretical_proteoforms = new List <TheoreticalProteoform>() { t1 }.ToArray(); Sweet.lollipop.topdown_proteoforms = new List <TopDownProteoform> { td1, td2, td3 }; Sweet.lollipop.add_td_proteoforms = true; Sweet.lollipop.aggregate_proteoforms(Sweet.lollipop.validate_proteoforms, Sweet.lollipop.raw_neucode_pairs, Sweet.lollipop.raw_experimental_components, Sweet.lollipop.raw_quantification_components, 0); List <ProteoformRelation> relations = Sweet.lollipop.target_proteoform_community.relate(Sweet.lollipop.target_proteoform_community.experimental_proteoforms, Sweet.lollipop.target_proteoform_community.theoretical_proteoforms, ProteoformComparison.ExperimentalTheoretical, true, Environment.CurrentDirectory, true); List <DeltaMassPeak> peaks = Sweet.lollipop.target_proteoform_community.accept_deltaMass_peaks(relations, new Dictionary <string, List <ProteoformRelation> >()); //should have 4 experimental proteoforms -- 3 topdown, 1 not topdown experimental Assert.AreEqual(3, Sweet.lollipop.target_proteoform_community.experimental_proteoforms.Count(e => e.topdown_id)); Assert.AreEqual(4, Sweet.lollipop.target_proteoform_community.experimental_proteoforms.Count()); Assert.AreEqual(1, relations.Count); Assert.AreEqual(1, relations.Count(r => r.RelationType == ProteoformComparison.ExperimentalTheoretical && (r.connected_proteoforms[0] as ExperimentalProteoform).topdown_id)); Assert.AreEqual(1, td1.relationships.Count(r => r.RelationType == ProteoformComparison.ExperimentalTheoretical && (r.connected_proteoforms[0] as ExperimentalProteoform).topdown_id)); Assert.AreEqual(0, td2.relationships.Count()); Assert.AreEqual(0, td3.relationships.Count()); //accession 3 has higher score... gets td Sweet.lollipop.clear_td(); td3 = ConstructorsForTesting.TopDownProteoform("ACCESSION_3", 1000.0, 45); TopDownHit h3 = new TopDownHit(); h3.score = 100; td3.topdown_hits = new List <TopDownHit>() { h3 }; TopDownHit h4 = new TopDownHit(); h4.score = 1; TopDownProteoform td4 = ConstructorsForTesting.TopDownProteoform("ACCESSION_4", 1001.0, 45); td4.topdown_hits = new List <TopDownHit>() { h4 }; Sweet.lollipop.topdown_proteoforms = new List <TopDownProteoform> { td4, td3 }; Sweet.lollipop.topdown_proteoforms.OrderBy(p => p.modified_mass); Sweet.lollipop.aggregate_proteoforms(Sweet.lollipop.validate_proteoforms, Sweet.lollipop.raw_neucode_pairs, Sweet.lollipop.raw_experimental_components, Sweet.lollipop.raw_quantification_components, 0); Assert.AreEqual(0, Math.Round(td3.modified_mass - td3.matching_experimental.modified_mass, 0)); Assert.IsNull(td4.matching_experimental); }