def test_get_title_prefix():
    time.sleep(0.5)
    title = pubmed_client.get_title('PMID27754804')
    assert title
    assert title.lower().startswith('targeting autophagy')
Example #2
0
def test_get_title():
    title = pubmed_client.get_title('27754804')
    assert title
    assert title.lower().startswith('targeting autophagy')
Example #3
0
def test_get_title_prefix():
    time.sleep(0.3)
    title = pubmed_client.get_title('PMID27754804')
    assert title
    assert title.lower().startswith('targeting autophagy')
Example #4
0
        doi_cache[row[0]] = row[1]

with open('missing_dois.txt') as f:
    missing_dois = [line.strip('\n') for line in f.readlines()]

def save(doi_cache, counter):
    with open('doi_cache_%.5d.txt' % counter, 'w') as f:
        print "Writing to doi cache"
        csvwriter = csv.writer(f, delimiter='\t')
        for k, v in doi_cache.iteritems():
            csvwriter.writerow((k, v))

for counter, ref in enumerate(missing_dois):
    if doi_cache.get(ref):
        continue
    title = pubmed_client.get_title(ref)
    if not title:
        print "No title, skipping", ref
        continue
    doi = crossref_client.doi_query(title)
    if doi:
        doi_cache[ref] = doi
        print "%d: %s --> %s" % (counter, ref, doi)
    else:
        print "No DOI for %s: %s" % (ref, title)
        continue

    if counter % 100 == 0:
        save(doi_cache, counter)

save(doi_cache, counter)
def test_get_complex_title():
    time.sleep(0.5)
    title = pubmed_client.get_title('33463523')
    assert title
    assert title.lower().startswith('atomic structures')
    assert title.lower().endswith('vascular plants.')
Example #6
0
def test_get_title_prefix():
    title = pubmed_client.get_title('PMID27754804')
    assert(title)
    assert(title.startswith('Targeting autophagy'))