Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

to_dic bugs on Substance #59

Open
HYUNSEONG-KIM opened this issue Aug 18, 2021 · 0 comments
Open

to_dic bugs on Substance #59

HYUNSEONG-KIM opened this issue Aug 18, 2021 · 0 comments

Comments

@HYUNSEONG-KIM
Copy link

Some data in Pubchem does not provides compound value while other data source provides. In this case, to_dataframe or to_dict funtion generate error no "compound"

    """
    Some substances of pubchem data doesnot provide compound key
    for c in self.record['compound']:
        if c['id']['type'] == CompoundIdType.STANDARDIZED:
            return c['id']['id']['cid']

    """
    if 'compound' in self.record:
        for c in self.record['compound']:
            if c['id']['type'] == CompoundIdType.STANDARDIZED:
                return c['id']['id']['cid']

I think it can be fixed with checking whether Substances has a "compound" key in record

example case bug occurres:
pcp.get_substances("65983-31-5", "name")

It return almost 21 substance from pubchem server and 20th substance

Substance(342573178) has no "compound" key in record, therefore it generates errors when you use to_dataframe or to_dict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant