Ejemplo n.º 1
0
    def test_getMinNeededTransitions_2(self):
        pep = test_shared.runpep2
        transitions = test_shared.runtransitions2
        precursors = test_shared.runprecursors2
        transitions = tuple([ (t[0], i) for i,t in enumerate(transitions)])
        par = self.par
        q3_high = self.q3_high
        q3_low = self.q3_low
        R = self.R
        par.max_uis = len(transitions) +  1

        collisions = list(collider.SRMcollider._get_all_collisions_calculate_sub(
                collider.SRMcollider(), precursors, par, R, q3_low, q3_high))
        m = self.acollider._getMinNeededTransitions(par, transitions, collisions)
        #negative result, the transitions are not sufficient
        self.assertEqual(m, -1)

        m = c_integrated.getMinNeededTransitions(transitions, tuple(precursors), 
            par.max_uis, par.q3_window, par.ppm, par)
        # TODO fix this
        # self.assertEqual(m, 16)

        #now also test with lower q3 window
        par.q3_window = 1.0
        collisions = list(collider.SRMcollider._get_all_collisions_calculate_sub(
                collider.SRMcollider(), precursors, par, R, q3_low, q3_high))
        m = self.acollider._getMinNeededTransitions(par, transitions, collisions)
        self.assertEqual(m, 6)

        m = c_integrated.getMinNeededTransitions(transitions, tuple(precursors), 
            par.max_uis, par.q3_window, par.ppm, par)
        self.assertEqual(m, 6)
Ejemplo n.º 2
0
    def test_getMinNeededTransitions_1(self):
        pep = test_shared.runpep1
        transitions = test_shared.runtransitions1
        precursors = test_shared.runprecursors1
        transitions = tuple([ (t[0], i) for i,t in enumerate(transitions)])
        par = self.par
        q3_high = self.q3_high
        q3_low = self.q3_low
        R = self.R
        par.max_uis = 15

        collisions = list(collider.SRMcollider._get_all_collisions_calculate_sub(
                collider.SRMcollider(), precursors, par, R, q3_low, q3_high))
        m = self.acollider._getMinNeededTransitions(par, transitions, collisions)
        self.assertEqual(m, 8)

        m = c_integrated.getMinNeededTransitions(transitions, tuple(precursors), 
            par.max_uis, par.q3_window, par.ppm, par)
        self.assertEqual(m, 8)

        #now also test with lower q3 window
        par.q3_window = 1.0
        collisions = list(collider.SRMcollider._get_all_collisions_calculate_sub(
                collider.SRMcollider(), precursors, par, R, q3_low, q3_high))
        m = self.acollider._getMinNeededTransitions(par, transitions, collisions)
        self.assertEqual(m, 4)

        m = c_integrated.getMinNeededTransitions(transitions, tuple(precursors), 
            par.max_uis, par.q3_window, par.ppm, par)
        self.assertEqual(m, 4)
Ejemplo n.º 3
0
    def test_getmintrans1(self):
        print '\nTesting _getMinNeededTransitions'
        pep = test_shared.runpep1
        transitions = test_shared.runtransitions1
        precursors = test_shared.runprecursors1
        transitions = tuple([ (t[0], i) for i,t in enumerate(transitions)])
        par = self.par
        q3_high = self.q3_high
        q3_low = self.q3_low
        R = self.R
        par.max_uis = 15

        collisions = list(collider.SRMcollider._get_all_collisions_calculate_sub(
                collider.SRMcollider(), precursors, par, R, q3_low, q3_high))
        st = time.time()
        m = collider.SRMcollider()._getMinNeededTransitions(par, transitions, collisions)
        oldtime = time.time() - st

        import c_integrated
        st = time.time()
        m = c_integrated.getMinNeededTransitions(transitions, tuple(precursors), 
            par.max_uis, par.q3_window, par.ppm, par)
        ctime = time.time() - st

        print ctime, oldtime
        print "Speedup:", oldtime / ctime
Ejemplo n.º 4
0
    def test_getmintrans1(self):
        print '\nTesting _getMinNeededTransitions'
        pep = test_shared.runpep1
        transitions = test_shared.runtransitions1
        precursors = test_shared.runprecursors1
        transitions = tuple([(t[0], i) for i, t in enumerate(transitions)])
        par = self.par
        q3_high = self.q3_high
        q3_low = self.q3_low
        R = self.R
        par.max_uis = 15

        collisions = list(
            collider.SRMcollider._get_all_collisions_calculate_sub(
                collider.SRMcollider(), precursors, par, R, q3_low, q3_high))
        st = time.time()
        m = collider.SRMcollider()._getMinNeededTransitions(
            par, transitions, collisions)
        oldtime = time.time() - st

        import c_integrated
        st = time.time()
        m = c_integrated.getMinNeededTransitions(transitions,
                                                 tuple(precursors),
                                                 par.max_uis, par.q3_window,
                                                 par.ppm, par)
        ctime = time.time() - st

        print ctime, oldtime
        print "Speedup:", oldtime / ctime
Ejemplo n.º 5
0
    elif use_randomized_transitions: 
        import c_getnonuis
        transitions = c_getnonuis.calculate_transitions_ch(
            ((pep['q1'], pep['mod_sequence'], p_id),), [1], 0, 20000)
        #get random fragment ions
        from random import shuffle
        shuffle(transitions)
        transitions = [ (t[0], 0) for t in transitions[:10] ]

    nr_transitions = len( transitions )
    if nr_transitions == 0: continue #no transitions in this window
    try:
        import c_integrated
        if background: precursors = self._get_all_precursors(bgpar, pep, cursor, bysequence=True)
        else: precursors = self._get_all_precursors(bgpar, pep, cursor)
        min_needed = c_integrated.getMinNeededTransitions(tuple(transitions), tuple(precursors), 
            par.max_uis, par.q3_window, par.ppm)
    except ImportError:
        if background: collisions = self._get_all_collisions(bgpar, pep, cursor, bysequence=True, transitions=transitions)
        else: collisions = self._get_all_collisions(bgpar, pep, cursor, transitions=transitions)
        min_needed = self._getMinNeededTransitions(par, transitions, collisions)

    self.min_transitions.append( [p_id, min_needed] )
    end = time.time()
    if not par.quiet: progressm.update(1)
self.total_time = end - start