def add_test(self): ''' Test the add funtion on a temporary result class Args: key (tuple): | file_name | formula | charge | label_percentiles value (tuple): | spec_id | rt | score | scaling_factor | peaks ''' tmp_results = pyqms.Results() keys = [ ('BSA1.mzML', 'C(37)H(59)N(9)O(16)', 2, (('N', '0.000'), )), ] values = [ (1337, 13.37, 1, 100, [(443.7112649, 100, 1, 443.7112649, 100)]), ] for key, value in zip(keys, values): tmp_results.add(key, value) assert len(tmp_results.index['files']) == 1 assert len(tmp_results.keys()) == 1 return
def setUp(self): self.results = pyqms.Results( lookup={ 'formula to molecule': { 'C(37)H(59)N(9)O(16)': ['DDSPDLPK'], 'C(43)H(75)N(15)O(17)S(2)': ['CCTESLVNR#Carbamidomethyl:1;Carbamidomethyl:2'] }, 'molecule to formula': { 'DDSPDLPK': 'C(37)H(59)N(9)O(16)', 'CCTESLVNR#Carbamidomethyl:1;Carbamidomethyl:2': 'C(43)H(75)N(15)O(17)S(2)' }, }) keys = [ ('BSA1.mzML', 'C(37)H(59)N(9)O(16)', 2, (('N', '0.000'), )), ('BSA1.mzML', 'C(37)H(59)N(9)O(16)', 2, (('N', '0.000'), )), ('BSA2.mzML', 'C(43)H(75)N(15)O(17)S(2)', 3, (('N', '0.010'), )), ] values = [ # mmz, mi, rel_icmz, ci (1337, 13.37, 1, 100, [(443.7112649, 100, 1, 443.7112649, 1)]), (1338, 13.38, 0.9, 100, [(443.7112649, 100, 1, 443.7112649, 1)]), (1337, 13.37, 1, 10, [(569.7526156, 10, 1, 569.7526156, 1)]) ] for key, value in zip(keys, values): self.results.add(key, value)
def add_test(self): """ Test the add funtion on a temporary result class Args: key (tuple): | file_name | formula | charge | label_percentiles value (tuple): | spec_id | rt | score | scaling_factor | peaks """ tmp_results = pyqms.Results() keys = [("BSA1.mzML", "C(37)H(59)N(9)O(16)", 2, (("N", "0.000"), ))] values = [(1337, 13.37, 1, 100, [(443.7112649, 100, 1, 443.7112649, 100)])] for key, value in zip(keys, values): tmp_results.add(key, value) assert len(tmp_results.index["files"]) == 1 assert len(tmp_results.keys()) == 1 return
def setUp(self): self.results = pyqms.Results( lookup={ "formula to molecule": { "C(37)H(59)N(9)O(16)": ["DDSPDLPK"], "C(43)H(75)N(15)O(17)S(2)": ["CCTESLVNR#Carbamidomethyl:1;Carbamidomethyl:2"], }, "molecule to formula": { "DDSPDLPK": "C(37)H(59)N(9)O(16)", "CCTESLVNR#Carbamidomethyl:1;Carbamidomethyl:2": "C(43)H(75)N(15)O(17)S(2)", }, }) keys = [ ("BSA1.mzML", "C(37)H(59)N(9)O(16)", 2, (("N", "0.000"), )), ("BSA1.mzML", "C(37)H(59)N(9)O(16)", 2, (("N", "0.000"), )), ("BSA2.mzML", "C(43)H(75)N(15)O(17)S(2)", 3, (("N", "0.010"), )), ] values = [ # mmz, mi, rel_icmz, ci (1337, 13.37, 1, 100, [(443.7112649, 100, 1, 443.7112649, 1)]), (1338, 13.38, 0.9, 100, [(443.7112649, 100, 1, 443.7112649, 1)]), (1337, 13.37, 1, 10, [(569.7526156, 10, 1, 569.7526156, 1)]), ] for key, value in zip(keys, values): self.results.add(key, value)
def group_14N_15N_pairs_test(self): tmp_metabolic_labeling_class = pyqms.Results( params={ 'PERCENTILE_FORMAT_STRING': '{0:.3f}', 'BUILD_RESULT_INDEX': True }) keys = [ ('run1', 'C(37)H(59)N(9)O(16)', 2, (('N', '0.000'), )), ('run1', 'C(37)H(59)N(9)O(16)', 2, (('N', '0.990'), )), ] values = [ (1337, 13.37, 1, 100, [(443.7112649, 100, 1, 443.7112649, 1)]), (1337, 13.37, 0.9, 200, [(452.7112649, 100, 1, 443.7112649, 1)]), ] for key, value in zip(keys, values): tmp_metabolic_labeling_class.add(key, value) all_key_pairs = [] for light_key, heavy_key in tmp_metabolic_labeling_class._group_14N_15N_pairs( ): all_key_pairs.append((light_key, heavy_key)) print(all_key_pairs) assert len(all_key_pairs) == 1 # assert sorted(keys) == sorted(all_key_pairs) return
#!/usr/bin/env python3.4 # encoding: utf-8 import pyqms import sys R = pyqms.Results() R.lookup = {} R.lookup['molecule fixed label variations'] = { 'ORGINAL_MOLECULE': [ 'R0_C1_R0', # you flip ! 'R0_C0_R0', 'K0_C1_K0', # you flip ! 'K1_C0_K1', # you flip ! 'R0_C1_R1', # decoys since mixed states 'R1_C1_R1' ] } VARIANTS = { (('R0', 'R1'), ): [ ['R0_C0_R0', 'R1_C0_R1'], ['R0_C1_R0', 'R1_C1_R1'], ], (('K0', 'K1'), ): [ ['K0_C1_K0', 'K1_C1_K1'], ], (('k0', 'K1'), ): [ ['K0_C1_K0', 'K1_C1_K1'], ], (('R0', 'R1'), ('K0', 'K1')): [