Created
January 22, 2019 15:19
-
-
Save cthoyt/fcd27023b7578668d1071c794ad0977a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pubchempy as pcp | |
keys = '''MXDPZUIOZWKRAA-UZOALHFESA-K | |
MJUVRTYWUMPBTR-MRXNPFEDSA-N | |
HJBWBFZLDZWPHF-UHFFFAOYSA-N | |
HZIYEEMJNBKMJH-UHFFFAOYSA-N | |
CPZBLNMUGSZIPR-NVXWUHKLSA-N | |
GKDRMWXFWHEQQT-UHFFFAOYSA-N | |
KSMAGQUYOIHWFS—UHFFFAOYSA-N | |
OFZJKCQENFPZBH-UHFFFAOYSA-N | |
XUZMUHLSFXCVMG-UHFFFAOYSA-N | |
YZBLFMPOMVTDJY-LSGXYNIPSA-N | |
QHMBSVQNZZTUGM—ZWKOTPCHSA-N | |
IYDYFVUFSPQPPV—PEXOCOHZSA-N | |
ACWZRVQXLIRSDF-UHFFFAOYSA-N | |
CMJCXYNUCSMDBY-ZDUSSCGKSA-N | |
MJUYRTYWUMPBTR-MRXNPFEDSA-N | |
WIJZXSAJMHAVGX-DHLKQENFSA-N | |
LBHLFPGPEGDCJG—UHFFFAOYSA-N | |
HEAUOKZIVMZVQL-VULOTQADSA-N | |
NOZIJMHMKORZBA-KJCUYJGMSA-N | |
'''.split() | |
results = [] | |
for key in keys: | |
compounds = pcp.get_compounds(keys[0], namespace='inchikey') | |
print(compounds) | |
results.append(compounds) | |
print(results[0][0].iupac_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The repr from the
pubchempy.Compund
class prints the compound identifier, but doingresults[0][0].cid
would actually be a better way to get at that (of course, after noticing they're all the same)