public void test_bottom_up_PSMs() { Sweet.lollipop = new Lollipop(); Sweet.lollipop.et_high_mass_difference = 2; Sweet.lollipop.et_low_mass_difference = -2; Sweet.lollipop.neucode_labeled = false; Sweet.lollipop.carbamidomethylation = false; Sweet.lollipop.enter_input_files(new string[] { Path.Combine(TestContext.CurrentContext.TestDirectory, "testHits.psmtsv") }, Lollipop.acceptable_extensions[7], Lollipop.file_types[7], Sweet.lollipop.input_files, false); Sweet.lollipop.enter_input_files(new string[] { Path.Combine(TestContext.CurrentContext.TestDirectory, "uniprot_yeast_test_12entries.xml") }, Lollipop.acceptable_extensions[2], Lollipop.file_types[2], Sweet.lollipop.input_files, false); Sweet.lollipop.theoretical_database.get_theoretical_proteoforms(TestContext.CurrentContext.TestDirectory); Assert.AreEqual(10, Sweet.lollipop.theoretical_database.bottom_up_psm_by_accession.Count); Sweet.lollipop.min_bu_peptides = 0; ExperimentalProteoform e = ConstructorsForTesting.ExperimentalProteoform("E1"); e.modified_mass = 1816.0128; //Q3E770 - no bottomup-peptides var relations = Sweet.lollipop.target_proteoform_community.relate(new ExperimentalProteoform[] { e }, Sweet.lollipop.target_proteoform_community.theoretical_proteoforms, ProteoformComparison.ExperimentalTheoretical, TestContext.CurrentContext.TestDirectory, false); Assert.AreEqual(1, relations.Count); Sweet.lollipop.min_bu_peptides = 1; relations = Sweet.lollipop.target_proteoform_community.relate(new ExperimentalProteoform[] { e }, Sweet.lollipop.target_proteoform_community.theoretical_proteoforms, ProteoformComparison.ExperimentalTheoretical, TestContext.CurrentContext.TestDirectory, false); Assert.AreEqual(0, relations.Count); e.modified_mass = 29260.9826; //P0CX35 Sweet.lollipop.min_bu_peptides = 1; relations = Sweet.lollipop.target_proteoform_community.relate(new ExperimentalProteoform[] { e }, Sweet.lollipop.target_proteoform_community.theoretical_proteoforms, ProteoformComparison.ExperimentalTheoretical, TestContext.CurrentContext.TestDirectory, false); Assert.AreEqual(0, relations.Count); //modified peptide, no mod theoretical with this accession so returns 0 e.modified_mass = 59841.6191; //P32329 relations = Sweet.lollipop.target_proteoform_community.relate(new ExperimentalProteoform[] { e }, Sweet.lollipop.target_proteoform_community.theoretical_proteoforms, ProteoformComparison.ExperimentalTheoretical, TestContext.CurrentContext.TestDirectory, false); Assert.AreEqual(1, relations.Count); Assert.AreEqual(0, Proteoform.get_possible_PSMs("Q3E770", new PtmSet(new List <Ptm>()), 3, 20).Count()); Assert.AreEqual(0, Proteoform.get_possible_PSMs("P0CX35", new PtmSet(new List <Ptm>()), 3, 20).Count()); Assert.AreEqual(1, Proteoform.get_possible_PSMs("P0CX35", Sweet.lollipop.theoretical_database.possible_ptmset_dictionary[80].Where(p => p.ptm_description.Contains("Phospho")).First(), 2, 500).Count()); Assert.AreEqual(0, Proteoform.get_possible_PSMs("P0CX35", Sweet.lollipop.theoretical_database.possible_ptmset_dictionary[80].Where(p => p.ptm_description.Contains("Phospho")).First(), 1, 5).Count()); }
public static ProteoformRelation make_relation(Proteoform p1, Proteoform p2, ProteoformComparison c, double delta_mass) { ProteoformRelation pp = new ProteoformRelation(p1, p2, c, delta_mass, TestContext.CurrentContext.TestDirectory); p1.relationships.Add(pp); p2.relationships.Add(pp); return(pp); }
public void TestInitialize() { // Myoglobin (Uniprot P68082) with N-terminal methionine removed string proForma = "GLSDGEWQQVLNVWGKVEADIAGHGQEVLIRLFTGHPETLEKFDKFKHLKTEAEMKASEDLKKHGTVVLTALGGILKKKGHHEAELKPLAQSHATKHKIPIKYLEFISDAIIHVLHSKHPGDFGADAQGAMTKALELFRNDIAAKYKELGFQG"; myo = new Proteoform(proForma); // Histone H4 (Uniprot P62805) PFR1033 proForma = "S[Acetyl|formula:C2H2O]GRGKGGKGLGKGGAKRHRK[Dimethyl|formula:C2H4]VLRDNIQGITKPAIRRLARRGGVKRISGLIYEETRGVLKVFLENVIRDAVTYTEHAKRKTVTAMDVVYALKRQGRTLYGFGG"; h4 = new Proteoform(proForma); }
public void TestInitialize() { // myoglobin string proForma = "GLSDGEWQQVLNVWGKVEADIAGHGQEVLIRLFTGHPETLEKFDKFKHLKTEAEMKASEDLKKHGTVVLTALGGILKKKGHHEAELKPLAQSHATKHKIPIKYLEFISDAIIHVLHSKHPGDFGADAQGAMTKALELFRNDIAAKYKELGFQG"; Proteoform myo = new Proteoform(proForma); // create b5 ion var frag = myo.MakeFragment(5, 'b'); trans = new Transition(myo, frag, 7, 4); }
//MAKE RELATION public static void make_relation(Proteoform p1, Proteoform p2) { ProteoformRelation pp = new ProteoformRelation(p1, p2, ProteoformComparison.ExperimentalExperimental, 0, TestContext.CurrentContext.TestDirectory); DeltaMassPeak ppp = new DeltaMassPeak(pp, new HashSet <ProteoformRelation> { pp }); pp.peak = ppp; pp.Accepted = true; ppp.Accepted = true; p1.relationships.Add(pp); p2.relationships.Add(pp); }
/// <summary> /// Initializes a Transition instance. /// </summary> /// <param name="parent">Proteoform that represents parent ion</param> /// <param name="frag">Fragment that represents fragment ion</param> /// <param name="parentCharge">Charge of parent ion</param> /// <param name="fragCharge">Charge of fragment ion</param> public Transition(Proteoform parent, Fragment frag, int parentCharge, int fragCharge) { // Set member values this.Precursor = parent; this.Fragment = frag; this.PrecursorCharge = parentCharge; this.FragmentCharge = fragCharge; // Generate isotopic distributions using the Mercury7 algorithm IIsotopeDistGenerator gen = new Mercury7(); this.PrecursorDistribution = gen.GenerateChargedIsotopicDistribution(parent.GetFormula(), parentCharge); this.FragmentDistribution = gen.GenerateChargedIsotopicDistribution(frag.GetFormula(), fragCharge); }
public void test_distinct_by() { Proteoform a = new Proteoform("a"); Proteoform b = new Proteoform("b"); Proteoform c = new Proteoform("c"); Proteoform c1 = new Proteoform("c"); List <Proteoform> z = new List <Proteoform> { a, b, c, c1 }; z.DistinctBy(p => p.accession); Assert.AreEqual(4, z.Count); z = z.DistinctBy(p => p.accession).ToList(); Assert.AreEqual(3, z.Count); }
public void nodes_table_gives_meaningful_unmodified_theoreticals() { Proteoform p = ConstructorsForTesting.make_a_theoretical(); ProteoformFamily f = new ProteoformFamily(p); f.construct_family(); string node_table = CytoscapeScript.get_cytoscape_nodes_tsv(new List <ProteoformFamily> { f }, null, CytoscapeScript.color_scheme_names[0], Lollipop.edge_labels[0], Lollipop.node_labels[0], Lollipop.node_positioning[0], 2, f.theoretical_proteoforms, false, Lollipop.gene_name_labels[1]); Assert.True(node_table.Contains(CytoscapeScript.unmodified_theoretical_label)); Assert.AreNotEqual(f.theoretical_proteoforms[0].accession, CytoscapeScript.get_proteoform_shared_name(p, Lollipop.node_labels[0], 2)); }
public void nodes_table_gives_meaningful_modified_theoreticals2() { ModificationMotif motif; ModificationMotif.TryGetMotif("K", out motif); Modification m = new Modification("id", _modificationType: "modtype", _target: motif, _locationRestriction: "Anywhere.", _monoisotopicMass: 1); Proteoform p = ConstructorsForTesting.make_a_theoretical(); ProteoformFamily f = new ProteoformFamily(p); f.construct_family(); string node_table = CytoscapeScript.get_cytoscape_nodes_tsv(new List <ProteoformFamily> { f }, null, CytoscapeScript.color_scheme_names[0], Lollipop.edge_labels[0], Lollipop.node_labels[0], Lollipop.node_positioning[0], 2, f.theoretical_proteoforms, false, Lollipop.gene_name_labels[1]); Assert.True(node_table.Contains(CytoscapeScript.modified_theoretical_label)); Assert.AreNotEqual(f.theoretical_proteoforms[0].accession, CytoscapeScript.get_proteoform_shared_name(p, Lollipop.node_labels[0], 2)); }
public void nodes_table_gives_meaningful_modified_theoreticals2() { ModificationMotif motif; ModificationMotif.TryGetMotif("K", out motif); ModificationWithMass m = new ModificationWithMass("oxidation", new Tuple <string, string>("", ""), motif, ModificationSites.K, 1, new Dictionary <string, IList <string> >(), new List <double>(), new List <double>(), ""); Proteoform p = ConstructorsForTesting.make_a_theoretical(); ProteoformFamily f = new ProteoformFamily(p); f.construct_family(); string node_table = CytoscapeScript.get_cytoscape_nodes_tsv(new List <ProteoformFamily> { f }, false, CytoscapeScript.color_scheme_names[0], Lollipop.edge_labels[0], Lollipop.node_labels[0], Lollipop.node_positioning[0], 2, f.theoretical_proteoforms, false, Lollipop.gene_name_labels[1]); Assert.True(node_table.Contains(CytoscapeScript.modified_theoretical_label)); Assert.AreNotEqual(f.theoretical_proteoforms[0].accession, CytoscapeScript.get_proteoform_shared_name(p, Lollipop.node_labels[0], 2)); }