Skip to main content

Command line tool to create BibTeX bibliographic entries for given publication identifiers

Project description

pubid2bib

pubid2bib (Publication Identifier to BibTeX) is a command line tool to fetch bibliographic entries for given publication identifiers using online services offered by PubMed, DOI and Google.

Usage:

pubid2bib publicationId1 publicationId2 ... publicationIdN

Where publicationIds are well formed PMIDs or DOIs for scientific papers or ISBNs for books.

Example:

pubid2bib 31726262 10.1021/acs.jced.5b00684 0735619670

Will create three BibTeX files in the current path, named:

  • "Removal of dental alloys and titanium attenuates trace metals and biological effects on liver and kidney.bib"
  • "Thermodynamic Properties of R-227ea, R-365mfc, R-115, and R-13I1.bib"
  • "Code Complete.bib"

The filenames will be the publication's titles and the bibliographic entries will conform to Bibtex @article and @book formats.

Install

pubid2bib is a standalone Python script. You need Python 3 installed and you need to be able to execute Python scripts on your platform.

Inspiration

The fantastic web service TexMed allows to search scientific articles in PubMed and create BibTex bibliographic entries for them. This was the inspiration for pubid2bib.

In one sense, pubid2bib is more limited, it needs you to find the publication identifiers first, to create the BibTex entries. But, it is more general in another sense, because you can use DOIs for published scientific articles that are not found in PubMed and also ISBNs for books. Furthermore, pubid2bib can be called from scripts.

Scripting

From bash

Asumming you have a file called publications.txt with publication identifiers in each line, e.g.:

38942015
38917788
38935715

You can have a bash script that calls pubid2bib for each identifier:

#!/bin/bash

input="publications.txt"

while read -r pmid
do
    echo "${pmid}"
    pubid2bib "${pmid}"
done < "$input"

From Python

You can use the function dispatch for each identifier

#!/usr/bin/env python


if __name__ == '__main__':
    from pubid2bib import dispatch
    with open('publications.txt', 'r') as file_object:
        try:
            paperIds = file_object.readlines()
            for pid in paperIds:
                print(pid[:-1])
                dispatch(pid[:-1])
        except (IOError, OSError):
            print('Error reading file')

Abbreviations

PMID: PubMed identifier

DOI: Digital Object Identifier

ISBN: International Standard Book Number

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pubid2bib-0.0.1.tar.gz (47.6 kB view details)

Uploaded Source

Built Distribution

pubid2bib-0.0.1-py3-none-any.whl (47.5 kB view details)

Uploaded Python 3

File details

Details for the file pubid2bib-0.0.1.tar.gz.

File metadata

  • Download URL: pubid2bib-0.0.1.tar.gz
  • Upload date:
  • Size: 47.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pubid2bib-0.0.1.tar.gz
Algorithm Hash digest
SHA256 fa48e72a93be338ef494731fe875fe33e4a6812048789e5ea08dde33176f17c1
MD5 a00904a2e23fb2c5df1b3b9bd77db4e5
BLAKE2b-256 86a49f584fb66ab043d79f12852686db9ed078a383c3aa34d8209b2d9ff71d83

See more details on using hashes here.

File details

Details for the file pubid2bib-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pubid2bib-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 47.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pubid2bib-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cf608d7019484d66981dc6fe98136d5a2b65f482a394c8e528b53b84b729c43b
MD5 1a3ac3659fa2dec9c7b6cba74c213c97
BLAKE2b-256 613544ef4364e6b4248974a97739e7ce7bed8c355ead40d3964f1ead1907ab63

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page