def test_get_charged_mass(self): pep = test_shared.runpep2 transitions = test_shared.runtransitions2 precursors = test_shared.runprecursors_obj2 par = self.par q3_high = self.q3_high q3_low = self.q3_low precursors = [ (p.q1, p.modified_sequence, p.transition_group) for p in precursors] colldensity = c_getnonuis.calculate_density( tuple(transitions), precursors, q3_low, q3_high, par.q3_window, par.ppm) self.assertEqual(colldensity, [1916, 1800, 2601, 3127, 4525, 4975, 3155, 3091, 2127, 3494, 4519, 5546, 4505, 4429, 5604])
precursors = [ p for p in allprecursors if p[2] != pep['peptide_key'] and p[4] > ssrcalc_low and p[4] < ssrcalc_high ] elif not use_db: # Use the rangetree # correct rounding errors, s.t. we get the same results as before! # use the rangetree ssrcalc_low = ssrcalc - par.ssrcalc_window + 0.001 ssrcalc_high = ssrcalc + par.ssrcalc_window - 0.001 precursor_ids = tuple( c_rangetree.query_tree(q1_low, ssrcalc_low, q1_high, ssrcalc_high)) precursors = [ parentid_lookup[myid[0]] for myid in precursor_ids #dont select myself if parentid_lookup[myid[0]][2] != pep['peptide_key'] ] #now calculate collisions in this area of the space colldensity = c_getnonuis.calculate_density(transitions, precursors, q3_low, q3_high, par.q3_window, par.ppm) assert MAX_UIS == 1 nonuseable = len([c for c in colldensity if c > 0]) prepare.append((nonuseable, nr_transitions, p_id, 1, exp_key)) progressm.update(1) cursor.executemany( 'insert into %s' % restable + ' (non_useable_UIS, total_UIS, \ parent_key, uisorder, exp_key) values (%s,%s,%s,%s,%s)', prepare)
precursors = [p for p in allprecursors if p[2] != pep['peptide_key'] ] else: ssrcalc_low = ssrcalc - par.ssrcalc_window ssrcalc_high = ssrcalc + par.ssrcalc_window precursors = [p for p in allprecursors if p[2] != pep['peptide_key'] and p[4] > ssrcalc_low and p[4] < ssrcalc_high ] elif not use_db: # Use the rangetree # correct rounding errors, s.t. we get the same results as before! # use the rangetree ssrcalc_low = ssrcalc - par.ssrcalc_window + 0.001 ssrcalc_high = ssrcalc + par.ssrcalc_window - 0.001 precursor_ids = tuple(c_rangetree.query_tree( q1_low, ssrcalc_low, q1_high, ssrcalc_high ) ) precursors = [parentid_lookup[myid[0]] for myid in precursor_ids #dont select myself if parentid_lookup[myid[0]][2] != pep['peptide_key']] #now calculate collisions in this area of the space colldensity = c_getnonuis.calculate_density( transitions, precursors, q3_low, q3_high, par.q3_window, par.ppm) assert MAX_UIS == 1 nonuseable = len( [c for c in colldensity if c >0 ] ) prepare.append( (nonuseable, nr_transitions, p_id , 1, exp_key) ) progressm.update(1) cursor.executemany('insert into %s' % restable + ' (non_useable_UIS, total_UIS, \ parent_key, uisorder, exp_key) values (%s,%s,%s,%s,%s)' , prepare)