Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
    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
Ejemplo n.º 3
0
    def setUp(self):

        import sys, os, time

        self.DDB = DDB
        self.R = Residues('mono')

        self.pep1 = (500, 'PEPTIDE', 1, 1)
        self.pep2 = (400, 'CEPC[160]IDM[147]E', 2, 2)
        self.charge = 2

        self.q3_low = 300
        self.q3_high = 1500

        self.transitions_12_between300_1500 = test_shared.transitions_12_between300_1500
        self.pep1_yseries = test_shared.pep1_yseries
        self.pep1_bseries = test_shared.pep1_bseries
Ejemplo n.º 4
0
    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()
Ejemplo n.º 5
0
        transitions = [(p.peak, i) for i, p in enumerate(peaks)
                       if p.experimental_height > threshold]
    nr_transitions = len(transitions)
    if nr_transitions == 0: continue  #no transitions in this window
    if (nr_transitions > 31):
        print "Skipping", spectrum.modified_sequence, "too many transitions (%s)" % nr_transitions
        continue

    peptide_obj.fix_mprophet_sequence_bug(
    )  # fix mProphet-bug (modified cysteins are [C160] instead of C[160]

    #
    # Get all interfering precursors, (w/o the current peptide)
    precursors = mycollider._get_all_precursors(par, peptide_obj, cursor)

    R = Residues('mono')
    q3_low, q3_high = par.get_q3range_collisions()
    #
    # check for q3_low and q3_high values, if the transitions are outside this
    # range, we will not find collisions for those == incorrect results
    #
    for t in transitions:
        if t[0] < q3_low or t[0] > q3_high:
            err = "\n"+ "Error: Found transition %s out of range\n" % t[0] + \
            "Please adjust the --q3_low and --q3_high parameters to get correct results\n"
            print err
            sys.stderr.write(err)
            sys.exit()

    get_precursor_time += time.time() - tmp_time
    tmp_time = time.time()
Ejemplo n.º 6
0
    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()
Ejemplo n.º 7
0
    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)