Prior to running, there should be 2 connections. These are for the MySQLWorkbench.
Counts are determined using this SQL syntax
SELECT COUNT(*) FROM information_schema.PROCESSLIST;
All counts are run from MySQLWorkbench
In [1]:
import sys, os
sys.path.insert(0,'/global/homes/b/bpb/repos/metatlas')
import metatlas.metatlas_objects as metob
After importing metob, there are still only the 2 connections
In [2]:
ids = metob.retrieve('CompoundIdentification',name='serine')#unique_id='c964f97a6d794856b3c2d50334fc0f40')
Reconnecting to database
select * from `compoundidentifications` where (username = "bpb" and name = "serine" and unique_id = head_id)
select * from `compoundidentifications_frag_references` where source_id in ("02298e3aa2de498795134d517bc4da38" , "04323e964f5e405a8b255e9276961af0" , "0c108a5c755649c794c0caeb72cb36cb" , "102fe0388b2240d6b9b581c7c8ddf46b" , "116250745db84a7d9edee9c98a2587a0" , "1a376ab37fd64c89a0a3e181f283e221" , "2872d2d2e4924e6aa70fc7ba6d9f20b8" , "2ac261f8520c42a581e419335a4095c0" , "2c30a9c2e8d84c76a2e3e6fc5b9adfc2" , "2e8f8e6b21a643078411b8e0baa8d9c1" , "2e9a235fd0c0443895b407f7c6d12c38" , "2fa0785d32f648d39f71fabd8f8f1255" , "3683d9c835884ba2853f98c808c4d314" , "36d50346edf64748a1ba3e473262b493" , "3a3db6454a2f464dbbeefbee57585aca" , "3d3518f1e4a945a39987e3cdac4b7a81" , "3dedeeb1bd0f487aa0ed8f012a8e7c09" , "461a0415333a477db499d1115aa8558c" , "463b66545b16417386e1f58b29f5f592" , "4cf48929fe27477abc2dfb3eafb41307" , "4d535b0bcbce489186e4095dbc8e7323" , "5214df663df141ee92744666b0f2c117" , "6ee8b9f1717346f5a4660da7c96768e3" , "7af30de856d049019594b366894de646" , "86dbaf8763a0489da43dbdbf54692fe5" , "89d4e21c576e45e290b0491c5dfa6a5b" , "8bf30c67adf14bf98061a62aa3b8414e" , "8decf1c7d6454ac2ba0af001e273ab65" , "8e9650c8af1e43e58c82b8d17149b390" , "91a3051d93204ad49d6d71e8336251c0" , "92415a085faf4c9986eb16623cceaae3" , "a8aea5fec9ff4e95bce1d68f6c5ca8c2" , "b04375c2fd644b9aa6f3ccc541fe5795" , "b353132e071f4cb19d05549742e0af85" , "ba7ec96d170e42019cd8d37a61d03a04" , "bbcaf243f06147529185f4c7d1788a76" , "c17e2398a9bd48af94714493a635f984" , "c964f97a6d794856b3c2d50334fc0f40" , "d66ccd3b27ea4bdea4839fa04ed7f1af" , "defe45fe34734d20b9a582da5a2ce192" , "e9c70b8317c140258066068119c2edff" , "ec12c7f4db1b43d483db049cc2502197" , "efedfe5d031c4d68bab7bbbcad83567a" , "f8ced8e104a643ddba7f70df4ccd3893
select * from `compoundidentifications_rt_references` where source_id in ("02298e3aa2de498795134d517bc4da38" , "04323e964f5e405a8b255e9276961af0" , "0c108a5c755649c794c0caeb72cb36cb" , "102fe0388b2240d6b9b581c7c8ddf46b" , "116250745db84a7d9edee9c98a2587a0" , "1a376ab37fd64c89a0a3e181f283e221" , "2872d2d2e4924e6aa70fc7ba6d9f20b8" , "2ac261f8520c42a581e419335a4095c0" , "2c30a9c2e8d84c76a2e3e6fc5b9adfc2" , "2e8f8e6b21a643078411b8e0baa8d9c1" , "2e9a235fd0c0443895b407f7c6d12c38" , "2fa0785d32f648d39f71fabd8f8f1255" , "3683d9c835884ba2853f98c808c4d314" , "36d50346edf64748a1ba3e473262b493" , "3a3db6454a2f464dbbeefbee57585aca" , "3d3518f1e4a945a39987e3cdac4b7a81" , "3dedeeb1bd0f487aa0ed8f012a8e7c09" , "461a0415333a477db499d1115aa8558c" , "463b66545b16417386e1f58b29f5f592" , "4cf48929fe27477abc2dfb3eafb41307" , "4d535b0bcbce489186e4095dbc8e7323" , "5214df663df141ee92744666b0f2c117" , "6ee8b9f1717346f5a4660da7c96768e3" , "7af30de856d049019594b366894de646" , "86dbaf8763a0489da43dbdbf54692fe5" , "89d4e21c576e45e290b0491c5dfa6a5b" , "8bf30c67adf14bf98061a62aa3b8414e" , "8decf1c7d6454ac2ba0af001e273ab65" , "8e9650c8af1e43e58c82b8d17149b390" , "91a3051d93204ad49d6d71e8336251c0" , "92415a085faf4c9986eb16623cceaae3" , "a8aea5fec9ff4e95bce1d68f6c5ca8c2" , "b04375c2fd644b9aa6f3ccc541fe5795" , "b353132e071f4cb19d05549742e0af85" , "ba7ec96d170e42019cd8d37a61d03a04" , "bbcaf243f06147529185f4c7d1788a76" , "c17e2398a9bd48af94714493a635f984" , "c964f97a6d794856b3c2d50334fc0f40" , "d66ccd3b27ea4bdea4839fa04ed7f1af" , "defe45fe34734d20b9a582da5a2ce192" , "e9c70b8317c140258066068119c2edff" , "ec12c7f4db1b43d483db049cc2502197" , "efedfe5d031c4d68bab7bbbcad83567a" , "f8ced8e104a643ddba7f70df4ccd3893
select * from `compoundidentifications_compound` where source_id in ("02298e3aa2de498795134d517bc4da38" , "04323e964f5e405a8b255e9276961af0" , "0c108a5c755649c794c0caeb72cb36cb" , "102fe0388b2240d6b9b581c7c8ddf46b" , "116250745db84a7d9edee9c98a2587a0" , "1a376ab37fd64c89a0a3e181f283e221" , "2872d2d2e4924e6aa70fc7ba6d9f20b8" , "2ac261f8520c42a581e419335a4095c0" , "2c30a9c2e8d84c76a2e3e6fc5b9adfc2" , "2e8f8e6b21a643078411b8e0baa8d9c1" , "2e9a235fd0c0443895b407f7c6d12c38" , "2fa0785d32f648d39f71fabd8f8f1255" , "3683d9c835884ba2853f98c808c4d314" , "36d50346edf64748a1ba3e473262b493" , "3a3db6454a2f464dbbeefbee57585aca" , "3d3518f1e4a945a39987e3cdac4b7a81" , "3dedeeb1bd0f487aa0ed8f012a8e7c09" , "461a0415333a477db499d1115aa8558c" , "463b66545b16417386e1f58b29f5f592" , "4cf48929fe27477abc2dfb3eafb41307" , "4d535b0bcbce489186e4095dbc8e7323" , "5214df663df141ee92744666b0f2c117" , "6ee8b9f1717346f5a4660da7c96768e3" , "7af30de856d049019594b366894de646" , "86dbaf8763a0489da43dbdbf54692fe5" , "89d4e21c576e45e290b0491c5dfa6a5b" , "8bf30c67adf14bf98061a62aa3b8414e" , "8decf1c7d6454ac2ba0af001e273ab65" , "8e9650c8af1e43e58c82b8d17149b390" , "91a3051d93204ad49d6d71e8336251c0" , "92415a085faf4c9986eb16623cceaae3" , "a8aea5fec9ff4e95bce1d68f6c5ca8c2" , "b04375c2fd644b9aa6f3ccc541fe5795" , "b353132e071f4cb19d05549742e0af85" , "ba7ec96d170e42019cd8d37a61d03a04" , "bbcaf243f06147529185f4c7d1788a76" , "c17e2398a9bd48af94714493a635f984" , "c964f97a6d794856b3c2d50334fc0f40" , "d66ccd3b27ea4bdea4839fa04ed7f1af" , "defe45fe34734d20b9a582da5a2ce192" , "e9c70b8317c140258066068119c2edff" , "ec12c7f4db1b43d483db049cc2502197" , "efedfe5d031c4d68bab7bbbcad83567a" , "f8ced8e104a643ddba7f70df4ccd3893
select * from `compoundidentifications_mz_references` where source_id in ("02298e3aa2de498795134d517bc4da38" , "04323e964f5e405a8b255e9276961af0" , "0c108a5c755649c794c0caeb72cb36cb" , "102fe0388b2240d6b9b581c7c8ddf46b" , "116250745db84a7d9edee9c98a2587a0" , "1a376ab37fd64c89a0a3e181f283e221" , "2872d2d2e4924e6aa70fc7ba6d9f20b8" , "2ac261f8520c42a581e419335a4095c0" , "2c30a9c2e8d84c76a2e3e6fc5b9adfc2" , "2e8f8e6b21a643078411b8e0baa8d9c1" , "2e9a235fd0c0443895b407f7c6d12c38" , "2fa0785d32f648d39f71fabd8f8f1255" , "3683d9c835884ba2853f98c808c4d314" , "36d50346edf64748a1ba3e473262b493" , "3a3db6454a2f464dbbeefbee57585aca" , "3d3518f1e4a945a39987e3cdac4b7a81" , "3dedeeb1bd0f487aa0ed8f012a8e7c09" , "461a0415333a477db499d1115aa8558c" , "463b66545b16417386e1f58b29f5f592" , "4cf48929fe27477abc2dfb3eafb41307" , "4d535b0bcbce489186e4095dbc8e7323" , "5214df663df141ee92744666b0f2c117" , "6ee8b9f1717346f5a4660da7c96768e3" , "7af30de856d049019594b366894de646" , "86dbaf8763a0489da43dbdbf54692fe5" , "89d4e21c576e45e290b0491c5dfa6a5b" , "8bf30c67adf14bf98061a62aa3b8414e" , "8decf1c7d6454ac2ba0af001e273ab65" , "8e9650c8af1e43e58c82b8d17149b390" , "91a3051d93204ad49d6d71e8336251c0" , "92415a085faf4c9986eb16623cceaae3" , "a8aea5fec9ff4e95bce1d68f6c5ca8c2" , "b04375c2fd644b9aa6f3ccc541fe5795" , "b353132e071f4cb19d05549742e0af85" , "ba7ec96d170e42019cd8d37a61d03a04" , "bbcaf243f06147529185f4c7d1788a76" , "c17e2398a9bd48af94714493a635f984" , "c964f97a6d794856b3c2d50334fc0f40" , "d66ccd3b27ea4bdea4839fa04ed7f1af" , "defe45fe34734d20b9a582da5a2ce192" , "e9c70b8317c140258066068119c2edff" , "ec12c7f4db1b43d483db049cc2502197" , "efedfe5d031c4d68bab7bbbcad83567a" , "f8ced8e104a643ddba7f70df4ccd3893
In [3]:
len(ids)
Out[3]:
44
This retrieve command leaves an extra connection. There are now three connections.
The third will be persistent until it times out (at least a couple hours).
In [4]:
frags = [f for f in ids if f.frag_references]
select * from `fragmentationreferences` where (unique_id = "ee411b298e974842a5ecb87be4dd249b")
select * from `lcmsruns` where (unique_id = "864a1365f2ee43179c9bace0ba2641c8")
select * from `fragmentationreferences_mz_intensities` where source_id in ("ee411b298e974842a5ecb87be4dd249b
This command creates two new processes. There are now 5 connections.
In [5]:
print frags[0]
select * from `compounds` where (unique_id = "20a6f472ad3d4e1aab58337c754ebbbc")
select * from `mzintensitypairs` where (unique_id = "d53c45c2b8e44f39bcbcdac62d4e1537")
select * from `mzintensitypairs` where (unique_id = "162e36dee74942edbd45b51f50d191ee")
select * from `mzintensitypairs` where (unique_id = "16cf1da0427b44d393aebbad9b8bd41c")
select * from `mzintensitypairs` where (unique_id = "dff134c530434134881feb3072edc928")
select * from `mzintensitypairs` where (unique_id = "704e0208754545d188c23ed7e2129a04")
select * from `mzintensitypairs` where (unique_id = "86a7995859d7438e9d2bf33aa3f76f2b")
select * from `mzintensitypairs` where (unique_id = "2d34ca3a90424d75af97f25e0889c93a")
select * from `mzintensitypairs` where (unique_id = "d0ec98c09278495f91ac902f0b603b9e")
select * from `mzintensitypairs` where (unique_id = "83573dd21fd04db58dc1d882935010eb")
select * from `mzintensitypairs` where (unique_id = "2dd26ed10b0b46b6b098bf6335f6bfe1")
select * from `mzintensitypairs` where (unique_id = "4ba02b14672f4ae8870430893d6093de")
{'compound': [{'chebi_id': u'CHEBI:17115///CHEBI:33384///CHEBI:32836///CHEBI:32837',
'chebi_url': u'http://www.ebi.ac.uk/chebi/searchId.do?chebiId=CHEBI:17115///http://www.ebi.ac.uk/chebi/searchId.do?chebiId=CHEBI:33384///http://www.ebi.ac.uk/chebi/searchId.do?chebiId=CHEBI:32836///http://www.ebi.ac.uk/chebi/searchId.do?chebiId=CHEBI:32837',
'creation_time': '2016-06-17T18:11:02',
'description': u'A serinate that is the conjugate base of L-serine, obtained by deprotonation of the carboxy group.///A serine zwitterion obtained by transfer of a proton from the carboxy to the amino group of L-serine.///The L-enantiomer of serine.///A serinium that is the conjugate acid of L-serine, obtained by protonation of the amino group.',
'formula': u'C3H7NO3',
'head_id': u'20a6f472ad3d4e1aab58337c754ebbbc',
'hmdb_id': u'HMDB00187',
'hmdb_url': u'http://www.hmdb.ca/metabolites/HMDB00187',
'img_abc_id': u'',
'inchi': u'InChI=1S/C3H7NO3/c4-2(1-5)3(6)7/h2,5H,1,4H2,(H,6,7)/t2-/m0/s1',
'inchi_key': u'MTCFGRXMJLQNBG-REOHCLBHSA-N',
'iupac_name': u'',
'kegg_id': u'C00065',
'kegg_url': u'http://www.genome.jp/dbget-bin/www_bget?C00065',
'last_modified': '2016-06-17T18:11:02',
'lipidmaps_id': u'',
'lipidmaps_url': u'',
'metacyc_id': u'SER',
'mono_isotopic_molecular_weight': 105.042593084,
'name': u'L-serine',
'neutralized_2d_inchi': u'InChI=1S/C3H7NO3/c4-2(1-5)3(6)7/h2,5H,1,4H2,(H,6,7)',
'neutralized_2d_inchi_key': u'MTCFGRXMJLQNBG-UHFFFAOYSA-N',
'neutralized_inchi': u'InChI=1S/C3H7NO3/c4-2(1-5)3(6)7/h2,5H,1,4H2,(H,6,7)/t2-/m0/s1',
'neutralized_inchi_key': u'MTCFGRXMJLQNBG-REOHCLBHSA-N',
'num_free_radicals': 0,
'number_components': 1,
'permanent_charge': 0,
'prev_uid': u'origin',
'pubchem_compound_id': u'5951',
'pubchem_url': u'http://pubchem.ncbi.nlm.nih.gov/compound/5951',
'source': u'chebi///msmls///wikidata///metacyc///hmdb',
'synonyms': u'L-serine///serine///56-45-1///(S)-2-Amino-3-hydroxypropanoic acid///(S)-Serine///beta-Hydroxyalanine///L-ser///L-(-)-Serine///Serine, L-///L-3-Hydroxy-alanine///beta-Hydroxy-L-alanine///L-2-Amino-3-hydroxypropionic acid///2-Amino-3-hydroxypropionic acid///(-)-Serine///L-3-Hydroxy-2-aminopropionic acid///Serinum [Latin]///L-Serin///(S)-(-)-Serine///Serina [Spanish]///Serine (VAN)///b-Hydroxy-L-alanine///H-Ser-OH///(S)-2-Amino-3-hydroxypropionic acid///Serinum///SER (IUPAC abbrev)///(2S)-2-amino-3-hydroxypropanoic acid///(S)-alpha-Amino-beta-hydroxypropionic acid///alpha-Amino-beta-hydroxypropionic acid///HSDB 680///2-Amino-3-hydroxypropanoic acid, (S)-///3-hydroxy-L-Alanine///CHEBI:17115///Serine [USAN:INN]///Propanoic acid, 2-amino-3-hydroxy-, (S)-///(S)-a-Amino-b-hydroxypropionic acid///(S)-2-amino-3-hydroxy-Propanoic acid///BRN 1721404///L-3-Hydroxy-2-aminopropionate///3-Hydroxyalanine///UNII-452VLY9402///(S)-a-Amino-b-hydroxypropionate///(S)-b-Amino-3-hydroxypropionate///(S)-2-Amino-3-hydroxypropanoate///MTCFGRXMJLQNBG-REOHCLBHSA-N///(S)-2-amino-3-hydroxy-Propanoate///(S)-beta-Amino-3-hydroxypropionate///EINECS 200-274-3///(S)-b-Amino-3-hydroxypropionic acid///MFCD00064224///NSC 118365',
'unique_id': u'20a6f472ad3d4e1aab58337c754ebbbc',
'username': u'bpb',
'wikipedia_url': u''}],
'creation_time': '2016-08-10T17:36:58',
'description': u'No description',
'frag_references': [{'collision_energy': 0.0,
'creation_time': '2016-08-10T17:36:59',
'description': u'No description',
'enabled': True,
'head_id': u'ee411b298e974842a5ecb87be4dd249b',
'last_modified': '2016-08-10T17:37:52',
'lcms_run': {'acquisition_time': None,
'creation_time': '2016-02-10T17:08:10',
'description': u'20160119_KZ_HILIC_Avena_exu_uptake 20160119_pHILIC___POS_MSMS_KZ_RootCass_4_MeOH_____Run237.mzML',
'experiment': u'20160119_KZ_HILIC_Avena_exu_uptake',
'hdf5_file': u'/global/project/projectdirs/metatlas/raw_data/katezh/20160119_KZ_HILIC_Avena_exu_uptake/20160119_pHILIC___POS_MSMS_KZ_RootCass_4_MeOH_____Run237.h5',
'head_id': u'864a1365f2ee43179c9bace0ba2641c8',
'injection_volume': None,
'injection_volume_units': 'uL',
'last_modified': '2016-02-10T19:10:53',
'method': None,
'mzml_file': u'/global/project/projectdirs/metatlas/raw_data/katezh/20160119_KZ_HILIC_Avena_exu_uptake/20160119_pHILIC___POS_MSMS_KZ_RootCass_4_MeOH_____Run237.mzML',
'name': u'20160119_pHILIC___POS_MSMS_KZ_RootCass_4_MeOH_____Run237.mzML',
'pass_qc': None,
'prev_uid': u'origin',
'sample': None,
'unique_id': u'864a1365f2ee43179c9bace0ba2641c8',
'username': u'pasteur'},
'mz_intensities': [{'creation_time': '2016-08-10T17:36:59',
'description': u'No description',
'head_id': u'd53c45c2b8e44f39bcbcdac62d4e1537',
'intensity': 1192.43,
'last_modified': '2016-08-10T17:37:52',
'mz': 51.9229,
'name': u'Untitled',
'prev_uid': u'origin',
'unique_id': u'd53c45c2b8e44f39bcbcdac62d4e1537',
'username': u'bpb'},
{'creation_time': '2016-08-10T17:36:59',
'description': u'No description',
'head_id': u'162e36dee74942edbd45b51f50d191ee',
'intensity': 1447.72,
'last_modified': '2016-08-10T17:37:52',
'mz': 56.7214,
'name': u'Untitled',
'prev_uid': u'origin',
'unique_id': u'162e36dee74942edbd45b51f50d191ee',
'username': u'bpb'},
{'creation_time': '2016-08-10T17:36:59',
'description': u'No description',
'head_id': u'16cf1da0427b44d393aebbad9b8bd41c',
'intensity': 238468.0,
'last_modified': '2016-08-10T17:37:52',
'mz': 60.0454,
'name': u'Untitled',
'prev_uid': u'origin',
'unique_id': u'16cf1da0427b44d393aebbad9b8bd41c',
'username': u'bpb'},
{'creation_time': '2016-08-10T17:36:59',
'description': u'No description',
'head_id': u'dff134c530434134881feb3072edc928',
'intensity': 1343.89,
'last_modified': '2016-08-10T17:37:52',
'mz': 70.0132,
'name': u'Untitled',
'prev_uid': u'origin',
'unique_id': u'dff134c530434134881feb3072edc928',
'username': u'bpb'},
{'creation_time': '2016-08-10T17:36:59',
'description': u'No description',
'head_id': u'704e0208754545d188c23ed7e2129a04',
'intensity': 6348.91,
'last_modified': '2016-08-10T17:37:52',
'mz': 70.0297,
'name': u'Untitled',
'prev_uid': u'origin',
'unique_id': u'704e0208754545d188c23ed7e2129a04',
'username': u'bpb'},
{'creation_time': '2016-08-10T17:36:59',
'description': u'No description',
'head_id': u'86a7995859d7438e9d2bf33aa3f76f2b',
'intensity': 1557.26,
'last_modified': '2016-08-10T17:37:52',
'mz': 78.3879,
'name': u'Untitled',
'prev_uid': u'origin',
'unique_id': u'86a7995859d7438e9d2bf33aa3f76f2b',
'username': u'bpb'},
{'creation_time': '2016-08-10T17:36:59',
'description': u'No description',
'head_id': u'2d34ca3a90424d75af97f25e0889c93a',
'intensity': 1425.1,
'last_modified': '2016-08-10T17:37:52',
'mz': 81.8921,
'name': u'Untitled',
'prev_uid': u'origin',
'unique_id': u'2d34ca3a90424d75af97f25e0889c93a',
'username': u'bpb'},
{'creation_time': '2016-08-10T17:36:59',
'description': u'No description',
'head_id': u'd0ec98c09278495f91ac902f0b603b9e',
'intensity': 1545.08,
'last_modified': '2016-08-10T17:37:52',
'mz': 83.8573,
'name': u'Untitled',
'prev_uid': u'origin',
'unique_id': u'd0ec98c09278495f91ac902f0b603b9e',
'username': u'bpb'},
{'creation_time': '2016-08-10T17:36:59',
'description': u'No description',
'head_id': u'83573dd21fd04db58dc1d882935010eb',
'intensity': 38169.3,
'last_modified': '2016-08-10T17:37:52',
'mz': 88.0401,
'name': u'Untitled',
'prev_uid': u'origin',
'unique_id': u'83573dd21fd04db58dc1d882935010eb',
'username': u'bpb'},
{'creation_time': '2016-08-10T17:36:59',
'description': u'No description',
'head_id': u'2dd26ed10b0b46b6b098bf6335f6bfe1',
'intensity': 1470.74,
'last_modified': '2016-08-10T17:37:52',
'mz': 89.2828,
'name': u'Untitled',
'prev_uid': u'origin',
'unique_id': u'2dd26ed10b0b46b6b098bf6335f6bfe1',
'username': u'bpb'},
{'creation_time': '2016-08-10T17:36:59',
'description': u'No description',
'head_id': u'4ba02b14672f4ae8870430893d6093de',
'intensity': 13497.4,
'last_modified': '2016-08-10T17:37:52',
'mz': 106.05,
'name': u'Untitled',
'prev_uid': u'origin',
'unique_id': u'4ba02b14672f4ae8870430893d6093de',
'username': u'bpb'}],
'name': u'Untitled',
'polarity': 'positive',
'precursor_mz': 106.05,
'prev_uid': u'origin',
'ref_type': u'',
'technique': 'cid',
'unique_id': u'ee411b298e974842a5ecb87be4dd249b',
'username': u'bpb'}],
'head_id': u'2fa0785d32f648d39f71fabd8f8f1255',
'identification_grade': None,
'intensity_references': [],
'last_modified': '2016-08-10T17:37:52',
'mz_references': [],
'name': u'serine',
'prev_uid': u'origin',
'rt_references': [],
'unique_id': u'2fa0785d32f648d39f71fabd8f8f1255',
'username': u'bpb'}
This print command bumps it up to 8 connections. These connections are persistent for hours.
In [ ]:
Content source: metabolite-atlas/metatlas
Similar notebooks: