PubmedSpreadsheet Generation Code
From GersteinInfo
(Difference between revisions)
Line 6: | Line 6: | ||
from GoogleSpreadsheet import GoogleSpreadsheet | from GoogleSpreadsheet import GoogleSpreadsheet | ||
from datetime import datetime<br \> | from datetime import datetime<br \> | ||
- | master_spreadsheet_id = " | + | master_spreadsheet_id = "******************" |
worksheet_id = "od6" | worksheet_id = "od6" | ||
master_spreadsheet = GoogleSpreadsheet(master_spreadsheet_id, worksheet_id)<br \> | master_spreadsheet = GoogleSpreadsheet(master_spreadsheet_id, worksheet_id)<br \> |
Revision as of 11:03, 16 September 2011
parse_pmids.py:
#!/usr/bin/python
import os, sys
from GoogleSpreadsheet import GoogleSpreadsheet
from datetime import datetime
master_spreadsheet_id = "******************"
worksheet_id = "od6"
master_spreadsheet = GoogleSpreadsheet(master_spreadsheet_id, worksheet_id)
ncbiquery = "/home/mpw6/new_papers/ncbiquery.txt"
ncbiFile = open(ncbiquery,'w')
def buildQuery(master_spreadsheet, ncbiFile):
start = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id="
pmids =
end = "&rettype=xml&retmode=file"
for row in master_spreadsheet:
if row['pmid']:
pmids += row['pmid'].lstrip('\) + ','
pmids = pmids[:-1]
out = start + pmids + end + '\n'
ncbiFile.write(out)
buildQuery(master_spreadsheet, ncbiFile)