def setUp(self): self.transitions = transitions_def1 self.collisions = collisions_def1 class Minimal: pass self.par = Minimal() self.par.q3_window = 4.0 self.par.ppm = False self.MAX_UIS = 5 self.q3_high = 1500 self.q3_low = 300 self.par.bions = True self.par.yions = True self.par.aions = False self.par.aMinusNH3 = False self.par.bMinusH2O = False self.par.bMinusNH3 = False self.par.bPlusH2O = False self.par.yMinusH2O = False self.par.yMinusNH3 = False self.par.cions = False self.par.xions = False self.par.zions = False self.par.MMinusH2O = False self.par.MMinusNH3 = False def returnrange(): return self.q3_high, self.q3_low self.par.get_q3range_collisions = returnrange import sys self.R = Residues('mono') self.acollider = collider.SRMcollider() self.aparamset = collider.testcase()
def setUp(self): import sys self.R = Residues('mono') self.acollider = collider.SRMcollider() self.aparamset = collider.testcase() self.real_parameters = test_shared.get_default_setup_parameters() self.precursor = test_shared.ThreePeptideExample.precursor self.interfering_precursors = test_shared.ThreePeptideExample.interfering_precursors
def setUp(self): self.transitions = transitions_def1 self.collisions = collisions_def1 self.MAX_UIS = 5 self.q3_high = 1500 self.q3_low = 300 self.R = Residues('mono') self.acollider = collider.SRMcollider() self.aparamset = collider.testcase() self.par = test_shared.get_default_setup_parameters() self.par.q3_window = 4.0
def test_complete_with_isotopes(self): if not self.database_available: return #now test with isotopes enabled par = collider.testcase(testdatabase=test_database) par.quiet = True par.isotopes_up_to = 3 par.eval() par.query2_add = ' and isotope_nr = 0 ' # need to do this because we also have other isotopes in there! mycollider = collider.SRMcollider() cursor = self.db.cursor() #for historic reasons, we only select a subset of peptides exclude_pepids = [ 183, 203, 319, 345, 355, 365, 367, 385, 393, 425, 1227, 1233, 1297, 1299, 1303, 1305, 1307, 1309, 1311, 1509, 1681, 1683 ] mycollider = collider.SRMcollider() pepids = _get_unique_pepids(par, cursor, ignore_genomeoccurence=True) pepids = [p for p in pepids if p['parent_id'] not in exclude_pepids] find_clashes_small(self, mycollider, cursor, par, pepids) assert abs(mycollider.allpeps[111] - 0.888888888889) < 1e-5 assert abs(mycollider.allpeps[191] - 0.7) < 1e-5 assert abs(mycollider.allpeps[375] - 0.941176470588) < 1e-5 assert abs(mycollider.allpeps[585] - 0.875) < 1e-5 assert abs(mycollider.allpeps[609] - 0.6666666) < 1e-5 assert abs(mycollider.allpeps[929] - 0.857142857143) < 1e-5 assert abs(mycollider.allpeps[1089] - 0.7) < 1e-5 assert abs(mycollider.allpeps[1101] - 0.916666666667) < 1e-5 assert abs(mycollider.allpeps[1177] - 0.928571428571) < 1e-5 assert abs(mycollider.allpeps[1493] - 0.928571428571) < 1e-5 assert abs(mycollider.allpeps[1537] - 0.857142857143) < 1e-5 assert abs(mycollider.allpeps[1585] - 0.933333333333) < 1e-5 assert abs(mycollider.allpeps[1663] - 0.928571428571) < 1e-5 assert abs(mycollider.allpeps[1763] - 0.8125) < 1e-5 assert abs(mycollider.allpeps[1925] - 0.928571428571) < 1e-5 assert abs(mycollider.allpeps[1957] - 0.833333333333) < 1e-5 assert abs(mycollider.allpeps[1967] - 0.857142857143) < 1e-5 assert abs(mycollider.allpeps[1991] - 0.857142857143) < 1e-5 self.assertTrue( abs(sum(mycollider.allpeps.values()) - 971.215436) < 10**(-3)) self.assertEqual( len([v for v in mycollider.allpeps.values() if v == 1.0]), 922) self.assertEqual(mycollider.non_unique_count, 71) self.assertEqual(mycollider.total_count, 12502)
def test_complete_with_isotopes(self): if not self.database_available: return #now test with isotopes enabled par = collider.testcase(testdatabase=test_database) par.quiet = True par.isotopes_up_to = 3 par.eval() par.query2_add = ' and isotope_nr = 0 ' # need to do this because we also have other isotopes in there! mycollider = collider.SRMcollider() cursor = self.db.cursor() #for historic reasons, we only select a subset of peptides exclude_pepids = [183, 203, 319, 345, 355, 365, 367, 385, 393, 425, 1227, 1233, 1297, 1299, 1303, 1305, 1307, 1309, 1311, 1509, 1681, 1683] mycollider = collider.SRMcollider() pepids = _get_unique_pepids(par, cursor, ignore_genomeoccurence=True) pepids = [p for p in pepids if p['parent_id'] not in exclude_pepids] find_clashes_small(self, mycollider, cursor, par, pepids) assert abs(mycollider.allpeps[111] - 0.888888888889) < 1e-5 assert abs(mycollider.allpeps[191] - 0.7) < 1e-5 assert abs(mycollider.allpeps[375] - 0.941176470588) < 1e-5 assert abs(mycollider.allpeps[585] - 0.875) < 1e-5 assert abs(mycollider.allpeps[609] - 0.6666666) < 1e-5 assert abs(mycollider.allpeps[929] - 0.857142857143) < 1e-5 assert abs(mycollider.allpeps[1089] - 0.7) < 1e-5 assert abs(mycollider.allpeps[1101] - 0.916666666667) < 1e-5 assert abs(mycollider.allpeps[1177] - 0.928571428571) < 1e-5 assert abs(mycollider.allpeps[1493] - 0.928571428571) < 1e-5 assert abs(mycollider.allpeps[1537] - 0.857142857143) < 1e-5 assert abs(mycollider.allpeps[1585] - 0.933333333333) < 1e-5 assert abs(mycollider.allpeps[1663] - 0.928571428571) < 1e-5 assert abs(mycollider.allpeps[1763] - 0.8125) < 1e-5 assert abs(mycollider.allpeps[1925] - 0.928571428571) < 1e-5 assert abs(mycollider.allpeps[1957] - 0.833333333333) < 1e-5 assert abs(mycollider.allpeps[1967] - 0.857142857143) < 1e-5 assert abs(mycollider.allpeps[1991] - 0.857142857143) < 1e-5 self.assertTrue( abs(sum( mycollider.allpeps.values() ) - 971.215436) < 10**(-3) ) self.assertEqual( len([v for v in mycollider.allpeps.values() if v == 1.0 ] ), 922 ) self.assertEqual( mycollider.non_unique_count, 71) self.assertEqual( mycollider.total_count, 12502 )
def test_complete_without_isotopes(self): if not self.database_available: return par = collider.testcase(testdatabase=test_database) par.query2_add = ' and isotope_nr = 0 ' # still necessary, old style tables par.quiet = True mycollider = collider.SRMcollider() cursor = self.db.cursor() #for historic reasons, we only select a subset of peptides exclude_pepids = [183, 203, 319, 345, 355, 365, 367, 385, 393, 425, 1227, 1233, 1297, 1299, 1303, 1305, 1307, 1309, 1311, 1509, 1681, 1683] mycollider = collider.SRMcollider() pepids = _get_unique_pepids(par, cursor, ignore_genomeoccurence=True) pepids = [p for p in pepids if p['parent_id'] not in exclude_pepids] find_clashes_small(self, mycollider, cursor, par, pepids) do_check_complete(self, mycollider)
def test_complete_without_isotopes(self): if not self.database_available: return par = collider.testcase(testdatabase=test_database) par.query2_add = ' and isotope_nr = 0 ' # still necessary, old style tables par.quiet = True mycollider = collider.SRMcollider() cursor = self.db.cursor() #for historic reasons, we only select a subset of peptides exclude_pepids = [ 183, 203, 319, 345, 355, 365, 367, 385, 393, 425, 1227, 1233, 1297, 1299, 1303, 1305, 1307, 1309, 1311, 1509, 1681, 1683 ] mycollider = collider.SRMcollider() pepids = _get_unique_pepids(par, cursor, ignore_genomeoccurence=True) pepids = [p for p in pepids if p['parent_id'] not in exclude_pepids] find_clashes_small(self, mycollider, cursor, par, pepids) do_check_complete(self, mycollider)
def setUp(self): import sys self.acollider = collider.SRMcollider() self.aparamset = collider.testcase() self.EPSILON = 10**-5 par = collider.SRM_parameters() par.q1_window = 25 / 2.0 par.q3_window = 1 / 2.0 par.ppm = False par.q3_low = 400 par.q3_high = 1400 par.q3_range = [par.q3_low, par.q3_high] par.set_default_vars() par.eval() self.real_parameters = par self.precursor = test_shared.ThreePeptideExample.precursor self.interfering_precursors = test_shared.ThreePeptideExample.interfering_precursors self.oldstyle_precursors = tuple([(p.q1, p.modified_sequence, p.transition_group, p.q1_charge, p.isotopically_modified) for p in self.interfering_precursors])
def setUp(self): try: import MySQLdb self.database_available = True except ImportError: print """Module MySQLdb not available. Please install it if you want to use it. Use the following command (on Ubuntu systems): sudo apt-get install python-mysqldb """ self.database_available = False try: self.db = MySQLdb.connect(read_default_file=mysql_conf_file) self.database_available = True except MySQLdb.OperationalError as e: print "Could not connect to database: Please check the configuration in test/test_db.py!\n", e self.database_available = False class Minimal: def get_q3_window_transitions(self, q3): if self.ppm: return [q3 - self.q3_window * 10**(-6) *q3, q3 + self.q3_window * 10**(-6) * q3] else: return [q3 - self.q3_window, q3 + self.q3_window] self.par = Minimal() self.par.q3_window = 4.0 self.par.ppm = False self.MAX_UIS = 5 self.q3_high = 1500 self.q3_low = 300 self.par.q1_window = 1.2 / 2.0 self.par.ssrcalc_window = 9999 self.par.query2_add = ' and isotope_nr = 0 ' self.par.peptide_tables = [test_database + '.srmPeptides_human'] self.par.transition_table = test_database + '.srmTransitions_human' self.par.print_query = False self.par.select_floor = False self.par.isotopes_up_to = 3 self.par.select_by = "id" self.par.parent_charges = [2,3] self.par.bions = True self.par.yions = True self.par.aions = False self.par.aMinusNH3 = False self.par.bMinusH2O = False self.par.bMinusNH3 = False self.par.bPlusH2O = False self.par.yMinusH2O = False self.par.yMinusNH3 = False self.par.cions = False self.par.xions = False self.par.zions = False self.par.MMinusH2O = False self.par.MMinusNH3 = False def returntrue(): return True self.par.do_b_y_only = returntrue def returnrange(): return self.q3_low, self.q3_high self.par.get_q3range_collisions = returnrange #self.par.get_q3_window_transitions = get_q3_window_transitions #self.par.get_q3_window_transitions = collider.SRM_parameters.get_q3_window_transitions import sys self.R = Residues('mono') self.acollider = collider.SRMcollider() self.aparamset = collider.testcase(testdatabase=test_database)
def setUp(self): self.transitions = transitions_def1 self.collisions = collisions_def1 self.EPSILON = 10**-5 self.min_q1 = 400 self.max_q1 = 1500 par = collider.SRM_parameters() par.q1_window = 1 / 2.0 par.q3_window = 1 / 2.0 par.ssrcalc_window = 10 / 2.0 par.ppm = False par.isotopes_up_to = 3 par.q3_low = 400 par.q3_high = 1400 par.max_uis = 5 par.peptide_tables = [PEPTIDE_TABLE_NAME] par.mysql_config = '~/.my.cnf' par.sqlite_database = test_shared.SQLITE_DATABASE_LOCATION print par.sqlite_database par.use_sqlite = USE_SQLITE par.quiet = False par.bions = True par.yions = True par.aions = False par.aMinusNH3 = False par.bMinusH2O = False par.bMinusNH3 = False par.bPlusH2O = False par.yMinusH2O = False par.yMinusNH3 = False par.cions = False par.xions = False par.zions = False par.MMinusH2O = False par.MMinusNH3 = False par.q3_range = [par.q3_low, par.q3_high] par.set_default_vars() par.eval() self.par = par self.R = Residues('mono') self.acollider = collider.SRMcollider() self.aparamset = collider.testcase() self.db = par.get_db() # Get the precursors ########################################################################### myprecursors = Precursors() cursor = self.db.cursor() myprecursors.getFromDB(par, cursor, self.min_q1 - par.q1_window, self.max_q1 + par.q1_window) testrange = myprecursors.build_rangetree() self.precursors_to_evaluate = myprecursors.getPrecursorsToEvaluate( self.min_q1, self.max_q1) myprecursors.build_parent_id_lookup() myprecursors.build_transition_group_lookup() self.myprecursors = myprecursors cursor.close()
def setUp(self): self.transitions = transitions_def1 self.collisions = collisions_def1 self.EPSILON = 10**-5 self.min_q1 = 400 self.max_q1 = 1500 par = collider.SRM_parameters() par.q1_window = 1 / 2.0 par.q3_window = 1 / 2.0 par.ssrcalc_window = 10 / 2.0 par.ppm = False par.isotopes_up_to = 3 par.q3_low = 400 par.q3_high = 1400 par.max_uis = 5 par.peptide_tables = [ PEPTIDE_TABLE_NAME ] par.mysql_config = '~/.my.cnf' par.sqlite_database = test_shared.SQLITE_DATABASE_LOCATION print par.sqlite_database par.use_sqlite = USE_SQLITE par.quiet = False par.bions = True par.yions = True par.aions = False par.aMinusNH3 = False par.bMinusH2O = False par.bMinusNH3 = False par.bPlusH2O = False par.yMinusH2O = False par.yMinusNH3 = False par.cions = False par.xions = False par.zions = False par.MMinusH2O = False par.MMinusNH3 = False par.q3_range = [par.q3_low, par.q3_high] par.set_default_vars() par.eval() self.par = par self.R = Residues('mono') self.acollider = collider.SRMcollider() self.aparamset = collider.testcase() self.db = par.get_db() # Get the precursors ########################################################################### myprecursors = Precursors() cursor = self.db.cursor() myprecursors.getFromDB(par, cursor, self.min_q1 - par.q1_window, self.max_q1 + par.q1_window) testrange = myprecursors.build_rangetree() self.precursors_to_evaluate = myprecursors.getPrecursorsToEvaluate(self.min_q1, self.max_q1) myprecursors.build_parent_id_lookup() myprecursors.build_transition_group_lookup() self.myprecursors = myprecursors cursor.close()
def setUp(self): try: import MySQLdb self.database_available = True except ImportError: print """Module MySQLdb not available. Please install it if you want to use it. Use the following command (on Ubuntu systems): sudo apt-get install python-mysqldb """ self.database_available = False try: self.db = MySQLdb.connect(read_default_file=mysql_conf_file) self.database_available = True except MySQLdb.OperationalError as e: print "Could not connect to database: Please check the configuration in test/test_db.py!\n", e self.database_available = False class Minimal: def get_q3_window_transitions(self, q3): if self.ppm: return [ q3 - self.q3_window * 10**(-6) * q3, q3 + self.q3_window * 10**(-6) * q3 ] else: return [q3 - self.q3_window, q3 + self.q3_window] self.par = Minimal() self.par.q3_window = 4.0 self.par.ppm = False self.MAX_UIS = 5 self.q3_high = 1500 self.q3_low = 300 self.par.q1_window = 1.2 / 2.0 self.par.ssrcalc_window = 9999 self.par.query2_add = ' and isotope_nr = 0 ' self.par.peptide_tables = [test_database + '.srmPeptides_human'] self.par.transition_table = test_database + '.srmTransitions_human' self.par.print_query = False self.par.select_floor = False self.par.isotopes_up_to = 3 self.par.select_by = "id" self.par.parent_charges = [2, 3] self.par.bions = True self.par.yions = True self.par.aions = False self.par.aMinusNH3 = False self.par.bMinusH2O = False self.par.bMinusNH3 = False self.par.bPlusH2O = False self.par.yMinusH2O = False self.par.yMinusNH3 = False self.par.cions = False self.par.xions = False self.par.zions = False self.par.MMinusH2O = False self.par.MMinusNH3 = False def returntrue(): return True self.par.do_b_y_only = returntrue def returnrange(): return self.q3_low, self.q3_high self.par.get_q3range_collisions = returnrange #self.par.get_q3_window_transitions = get_q3_window_transitions #self.par.get_q3_window_transitions = collider.SRM_parameters.get_q3_window_transitions import sys self.R = Residues('mono') self.acollider = collider.SRMcollider() self.aparamset = collider.testcase(testdatabase=test_database)