コード例 #1
0
__license__     = "BSD 3-Clause license"
__version__     = "0.1"

import vivotools as vt
from datetime import datetime
from Bio import Entrez

print datetime.now(),"Start"

pmids = [
    "18068940",
    "18089571",
    "19206997",
    "21822356",
    "19247798",
    "21493414",
    "12099768",
    "11410031",
    "20143936",
    "16934145"
    ]

for pmid in pmids:
    handle = Entrez.efetch(db="pubmed", id=pmid, retmode="xml")
    records = Entrez.parse(handle)
    for record in records:
        print "\n",pmid,"\n", \
            vt.string_from_document(vt.document_from_pubmed(record))

print datetime.now(),"Finish"
コード例 #2
0
#
#  to get PubMed publications from the Harvard service, we need a person's email address and name.  Middle can be empty ("")
#
first = "Michael"
middle = ""
last = "Conlon"
email = "*****@*****.**"
#
# call the Harvard Catalyst service to get a list of PMIDs for this author
#

print "Results for ",first,middle,last,email
result = vivotools.catalyst_pmid_request(first,middle,last,email)

dom = parseString(result) # create a document Object Model (DOM) from the Harvard Catalyst result
#
#  For each PMID in the DOM, grab the ID from the DOM, call Pubmed, display the results
#
for node in dom.getElementsByTagName('PMID'):
    pmid = node.toxml()
    pmid = pmid.replace('<PMID>','')
    pmid = pmid.replace('</PMID>','')
    handle = Entrez.efetch(db="pubmed", id=pmid, retmode="xml")
    records = Entrez.parse(handle)
    for record in records:
        doc = vivotools.document_from_pubmed(record)
        [found,uri] = vivotools.find_title(doc['title'],title_dictionary)
        print
        print found,uri
        print vivotools.string_from_document(doc)
コード例 #3
0
                [pubmed_rdf, sub] = vivotools.update_pubmed(publication_uri,\
                    value.fields['doi'])
                if sub != "":
                    raise Exception("Non empty subtraction RDF"+\
                        "for Update PubMed")

            # Publication

            publication_rdf = make_publication_rdf(value,\
                title,publication_uri,datetime_uri,authorship_uris)
            print >>rdf_file, datetime_rdf, publisher_rdf, journal_rdf,\
                publisher_journal_rdf, author_rdf, authorship_rdf,\
                author_in_authorship_rdf, journal_publication_rdf,\
                publication_rdf, pubmed_rdf
            print >> rdf_file, "<!-- End RDF for " + title + " -->"
            print >>lst_file, vivotools.string_from_document(document),\
                'VIVO uri', publication_uri, '\n'
            update_disambiguation_report(authors, publication_uri)
        else:
            title_report[title][0] = "Found"
            title_report[title][1] = uri
            print >> rdf_file, "<!-- Found: " + title + " No RDF necessary -->"
print >> rdf_file, vivotools.rdf_footer()

#
# Reports
#
print >> rpt_file, """

Publisher Report
コード例 #4
0
                [pubmed_rdf, sub] = vivotools.update_pubmed(publication_uri,\
                    value.fields['doi'])
                if sub != "":
                    raise Exception("Non empty subtraction RDF"+\
                        "for Update PubMed")

            # Publication

            publication_rdf = make_publication_rdf(value,\
                title,publication_uri,datetime_uri,authorship_uris)
            print >>rdf_file, datetime_rdf, publisher_rdf, journal_rdf,\
                publisher_journal_rdf, author_rdf, authorship_rdf,\
                author_in_authorship_rdf, journal_publication_rdf,\
                publication_rdf, pubmed_rdf
            print >>rdf_file, "<!-- End RDF for " + title + " -->"
            print >>lst_file, vivotools.string_from_document(document),\
                'VIVO uri', publication_uri, '\n'
            update_disambiguation_report(authors, publication_uri)
        else:
            title_report[title][0] = "Found"
            title_report[title][1] = uri
            print >>rdf_file, "<!-- Found: " + title + " No RDF necessary -->"
print >>rdf_file, vivotools.rdf_footer()

#
# Reports
#
print >>rpt_file,"""

Publisher Report
コード例 #5
0
    if 'date' in pub and 'publication_type' in pub and \
    pub['publication_type'] == 'academic-article':
        key = pub['date']['year']+pub['title']
        publications[key] = pub
last_pub = min(25, len(publications))
npub = 0
for key in sorted(publications.keys(), reverse=True):
    npub = npub + 1
    if npub > last_pub:
        break
    pub = publications[key]
    para_props = ParagraphPropertySet()
    para_props.SetFirstLineIndent(-720)
    para_props.SetLeftIndent(720)
    p = Paragraph(ss.ParagraphStyles.Normal, para_props)
    p.append(str(npub), ". ", vt.string_from_document(pub))
    section.append(p)

# Section D -- Research Support

p = Paragraph(ss.ParagraphStyles.Heading3)
p.append("D.", TAB, "Research Support")
section.append(p)

grants = {}
print person['grants']
for grant in person['grants']:
    if 'end_date' in grant and 'title' in grant and \
    datetime.datetime(int(grant['end_date']['date']['year']),
        int(grant['end_date']['date']['month']),
        int(grant['end_date']['date']['day'])) + \
コード例 #6
0
        for grant in person['grants']:
            try:
                print 'grant',\
                      int(grant['start_date']['date']['year']), int(year)
            except:
                continue
            if int(grant['start_date']['date']['year']) >= int(year):
                para_props = ParagraphPropertySet()
                para_props.SetFirstLineIndent(TabPropertySet.DEFAULT_WIDTH*-1)
                para_props.SetLeftIndent(TabPropertySet.DEFAULT_WIDTH*2)
                p = Paragraph(ss.ParagraphStyles.Normal, para_props)
                p.append(vt.string_from_grant(grant))
                section.append(p)

    if len(person['publications']) > 0:
        for publication in person['publications']:
            try:
                print 'pub', int(publication['date']['year']), int(year)
            except:
                continue
            if int(publication['date']['year']) >= int(year):
                para_props = ParagraphPropertySet()
                para_props.SetFirstLineIndent(TabPropertySet.DEFAULT_WIDTH*-1)
                para_props.SetLeftIndent(TabPropertySet.DEFAULT_WIDTH*2)
                p = Paragraph(ss.ParagraphStyles.Normal, para_props)
                p.append(vt.string_from_document(publication))
                section.append(p)

print str(datetime.datetime.now())
Renderer().Write(doc, file("report.rtf", "w"))
コード例 #7
0
#  to get PubMed publications from the Harvard service, we need a person's email address and name.  Middle can be empty ("")
#
first = "Michael"
middle = ""
last = "Conlon"
email = "*****@*****.**"
#
# call the Harvard Catalyst service to get a list of PMIDs for this author
#

print "Results for ",first,middle,last,email
result = vivotools.catalyst_pmid_request(first,middle,last,email)

dom = parseString(result) # create a document Object Model (DOM) from the Harvard Catalyst result
#
#  For each PMID in the DOM, grab the ID from the DOM, call Pubmed, display the results
#
for node in dom.getElementsByTagName('PMID'):
    pmid = node.toxml()
    pmid = pmid.replace('<PMID>','')
    pmid = pmid.replace('</PMID>','')
    handle = Entrez.efetch(db="pubmed", id=pmid, retmode="xml")
    records = Entrez.parse(handle)
    for record in records:
        doc = vivotools.document_from_pubmed(record)
        [found,uri] = vivotools.find_title(doc['title'],title_dictionary)
        print
        print found,uri
        print vivotools.string_from_document(doc)

コード例 #8
0
    if 'date' in pub and 'publication_type' in pub and \
    pub['publication_type'] == 'academic-article':
        key = pub['date']['year'] + pub['title']
        publications[key] = pub
last_pub = min(25, len(publications))
npub = 0
for key in sorted(publications.keys(), reverse=True):
    npub = npub + 1
    if npub > last_pub:
        break
    pub = publications[key]
    para_props = ParagraphPropertySet()
    para_props.SetFirstLineIndent(-720)
    para_props.SetLeftIndent(720)
    p = Paragraph(ss.ParagraphStyles.Normal, para_props)
    p.append(str(npub), ". ", vt.string_from_document(pub))
    section.append(p)

# Section D -- Research Support

p = Paragraph(ss.ParagraphStyles.Heading3)
p.append("D.", TAB, "Research Support")
section.append(p)

grants = {}
print person['grants']
for grant in person['grants']:
    if 'end_date' in grant and 'title' in grant and \
    datetime.datetime(int(grant['end_date']['date']['year']),
        int(grant['end_date']['date']['month']),
        int(grant['end_date']['date']['day'])) + \
コード例 #9
0
"""

__author__ = "Michael Conlon"
__copyright__ = "Copyright 2013, University of Florida"
__license__ = "BSD 3-Clause license"
__version__ = "0.1"

import vivotools as vt
from datetime import datetime
import json

print datetime.now(), "Start"
publications = [
    "http://vivo.ufl.edu/individual/n2592711416",
    "http://vivo.ufl.edu/individual/n49408",
    "http://vivo.ufl.edu/individual/n5988333327",
    "http://vivo.ufl.edu/individual/n697590874",
    "http://vivo.ufl.edu/individual/n7170943995",
    "http://vivo.ufl.edu/individual/no-such-pub",
    "http://vivo.ufl.edu/individual/n536643140",
    "http://vivo.ufl.edu/individual/n5202165124",
    "http://vivo.ufl.edu/individual/n898775618",
    "http://vivo.ufl.edu/individual/n5755807043"
]
for publication in publications:
    pub = vt.get_publication(publication, get_authors=True)
    print "\n", json.dumps(pub, indent=4)
    print vt.string_from_document(pub)
print datetime.now(), "Finish"
コード例 #10
0
"""

__author__      = "Michael Conlon"
__copyright__   = "Copyright 2013, University of Florida"
__license__     = "BSD 3-Clause license"
__version__     = "0.1"

import vivotools as vt
from datetime import datetime
import json

print datetime.now(),"Start"
publications = [
    "http://vivo.ufl.edu/individual/n2592711416",
    "http://vivo.ufl.edu/individual/n49408",
    "http://vivo.ufl.edu/individual/n5988333327",
    "http://vivo.ufl.edu/individual/n697590874",
    "http://vivo.ufl.edu/individual/n7170943995",
    "http://vivo.ufl.edu/individual/no-such-pub",
    "http://vivo.ufl.edu/individual/n536643140",
    "http://vivo.ufl.edu/individual/n5202165124",
    "http://vivo.ufl.edu/individual/n898775618",
    "http://vivo.ufl.edu/individual/n5755807043"
    ]
for publication in publications:
    pub = vt.get_publication(publication, get_authors=True)
    print "\n",json.dumps(pub, indent=4)
    print vt.string_from_document(pub)
print datetime.now(),"Finish"