Skip to content

How can I get the biological half life? #143

@thiswillbeyourgithub

Description

@thiswillbeyourgithub

Hi,

Neat package, thanks for making it.

I'm trying to get the biological half life of some compounds. If we go for example to pubchem's page for acetaminophen: link

Image

Which does not look super structured but I believe I can manage the parsing of that kind of snippets.

But I couldn't get my hands on this "Biological Half-Life" section from the API. Here is a quick and dirty script for example:

import json
import pubchempy as pcp

acet = pcp.get_compounds("acetaminophen", "name")[0]
assays = pcp.get_assays(acet.aids)

relevant = []
for a in assays:
    try:  # Note: I had to add a try block here because of an exception you might want to look into
        if "half" in json.dumps(a.to_dict()) and "life" in json.dumps(a.to_dict()).lower():
            relevant.append(a)
    except Exception:
        pass

for r in relevant:
    print(json.dumps(r.to_dict(), indent=2))
import code ; code.interact(local=locals())

As we can see from the image, the information seems to be from Drugbank. I created an account over there but couldn't managed to get an API key nor to even get their pricing (!).

So what am I missing here?

Edit: I mean I cat get this using the above script:

"Abstract: 1 The rate of absorption of oral paracetamol depends
 on the rate of gastric emptying and is usually rapid and complete.
 The mean systemic availability is about 75%. 2 Paracetamol is exte
nsively metabolized and the plasma half-life is 1.5-2.5 hours. Abou
t 55% and 30% of a therapeutic dose is excreted in the urine as glu
curonide and sulphate conjugates, respectively, whereas mercapturic
 acid and cysteine conjugates (representing conversion to a potenti
ally toxic intermediate metabolite) each account for some 4% of the
 dose. Paracetamol metabolism is age- and dose-dependent. 3 With he
patotoxic doses, paracetamol metabolism is impaired and the half-li
fe prolonged. Sulphate conjugation is saturated and the proportion 
excreted as mercapturic acid and cysteine conjugates is increased. 
4 The renal clearance of paracetamol depends on urine flow rate by 
not pH. The renal clearances of the glucuronide and sulphate conjug
ates often exceed the glomerular filtration rate and are independen
t of urine flow and pH. 5 Phenacetin absorption depends on formulat
ion. It is extensively metabolized to paracetamol and minor metabol
ites are probably responsible for toxicity."

But I would really prefer getting the same snippet as on the website.

Thanks.

edit2: Created PR #144 to address the issue I had with some assays crashnig the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions