Pubchem Patents Bulk Download
1
0
Entering edit mode
5.3 years ago
nmegz4ever • 0

The ftp download site of pubchem gives only downloads for Compound information. Is there a way to bulk download patent data for each compound?

Pubchem Patent • 1.9k views
ADD COMMENT
0
Entering edit mode

Please provide some details what exactly you need including a link to the respective page. See How To Ask Good Questions On Technical And Scientific Forums

ADD REPLY
0
Entering edit mode
5.0 years ago

here is some python code you can use if you have a CID in mind

cid=2446
pubchemapi = "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/{0}/xrefs/PatentID/JSON".format(cid)
try:
    url=urllib.request.urlopen(pubchemapi)
except urllib.error.HTTPError as err:
    print("tried {} will sleep on it".format(pubchemapi))
    time.sleep(5)
    try:
        url=urllib.request.urlopen(pubchemapi)
    except urllib.error.HTTPError as err:
        print("can't find {0}".format(cid))
        return(None)
pbcresp = json.loads(url.read().decode())
patents = pbcresp['InformationList']['Information'][0]['PatentID']

for patent in patents:
    if patent.startswith('US'):
        patentapi = "https://pubchem.ncbi.nlm.nih.gov/rest/pug_view/data/patent/{0}/JSON?heading=Patent+Submission+Date".format(patent)
        try:
            url=urllib.request.urlopen(patentapi)
        except urllib.error.HTTPError as err:
            print("tried {} will sleep on it".format(patentapi))
            time.sleep(5)
            try:
                url=urllib.request.urlopen(patentapi)
            except urllib.error.HTTPError as err:
                print("can't find {0}".format(cid))
                continue
        patresp = json.loads(url.read().decode('latin-1'))
        submissiondate = patresp['Record']['Section'][0]["Information"][0]["Value"]["DateISO8601"][0]
        print("{0} {1} {2}".format(cid,patent,submissiondate))
ADD COMMENT

Login before adding your answer.

Traffic: 2051 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6