How To Generate A Bibtex File From Pmids
8
6
Entering edit mode
13.2 years ago
Farhat ★ 2.9k

This is not strictly bioinformatics but I am not sure where this would fit. Anyway, close this question if it is misplaced.

I have a long list of PMIDs, I would like to generate a BiBTeX file from this. How could I go about doing this?

• 23k views
ADD COMMENT
0
Entering edit mode

Thanks! Excellent ways to do this. I wish I could mark more than one as correct.

ADD REPLY
0
Entering edit mode

Not a direct solution if you only have PMID's, but if you save your papers in Zotero it is easy to export a BiBTeX format list of citations.

ADD REPLY
7
Entering edit mode
13.2 years ago

Use ncbi efetch to download your papers as XML and use a XSLT stylesheet like pubmed2bibtex.xsl ( http://svn.gna.org/viewcvs/kbibtex/trunk/xslt/ ) to transform it to bibtex.

I've used this method to compile a recent TeX paper: see http://code.google.com/p/knime4bio/source/browse/trunk/paper20110804/Makefile

ADD COMMENT
7
Entering edit mode
13.1 years ago
Neilfws 49k

This is very easy using Bio::PubMed and Bio::MEDLINE from BioRuby.

Chris Miller has posted example code which loops through a list of PMIDs and returns citations in BibTeX.

ADD COMMENT
1
Entering edit mode

FWIW, I tried this method today and it no longer works. I'm not sure whether the package or the API changed, but I ended up using the following solution instead:

  1. install Zotero, if you haven't already.
  2. Upload your list of PMIDs here and do a pubmed search.
  3. Use Zotero to batch import from the results page.
  4. Export a bibtex from Zotero.
ADD REPLY
1
Entering edit mode

Yes it seems a few things have changed.

  • Bio::PubMed::query() no longer works (returns nil)
  • Bio::PubMed::efetch() returns an array; elements can be converted to MEDLINE objects
  • Syntax for conversion to BibTeX has altered

This works for me:

require 'bio'
id = "18265351"
Bio::NCBI.default_email = "me@me.com"
e = Bio::PubMed::efetch(id)
m = Bio::MEDLINE.new(e[0])
bib = m.reference.format("bibtex")

# => "@article{PMID:18265351,\n  author       = {Brown, T. and Mackey, K. and Du, T.},\n  title        = {Analysis of RNA by northern and slot blot hybridization.},\n  journal      = {Curr Protoc Mol Biol},\n  year         = {2004},\n  volume       = {Chapter 4},\n  pages        = {Unit 4.9},\n  url          = {http://www.ncbi.nlm.nih.gov/pubmed/18265351},\n}\n"
ADD REPLY
0
Entering edit mode

This still works. I've tried it earlier today. I was able to generate a .bib file out of a PUBMED ID list of more than 700 references.

ADD REPLY
5
Entering edit mode
13.2 years ago

jabref uses bibtex as standard storage format of references. You can directly download pubmed references from within jabref.

Mekentosj Papers also supports bibtex exports.

ADD COMMENT
0
Entering edit mode

Same for CiteULike...

ADD REPLY
5
Entering edit mode
13.1 years ago
Nick Loman ▴ 610

I did something like this a while back and blogged on it: http://pathogenomics.bham.ac.uk/blog/2011/03/creating-my-perfect-citation-system-using-latex/

The Python code is at: https://github.com/nickloman/latex-pubmed

Feel free to fork it and improve it (and send me a pull request)

ADD COMMENT
0
Entering edit mode

thanks, this is great!

ADD REPLY
0
Entering edit mode

@Nick This is great, but do you have it in Python 3 instead of Python 2?

ADD REPLY
1
Entering edit mode

I just wrote a Python 3 solution here:

ADD REPLY
2
Entering edit mode
13.2 years ago

I use BibDesk, for Macs that let me do it. I looked at my bookmark and found this page with many tools to convert to bib files. You enter all your PMID in pubmed, export to xml and then convert xml to bib. Mendley Should let you do it as well somehow. I did it once to play around and it looked smooth. Most bibliogaphic tools should let you export to RIS and then from there convert to bibtex.

ADD COMMENT
1
Entering edit mode
9.7 years ago

I normally use a combination of ris2xml and xml2bib (bibutils) similar to Stefano Berri description. If there is no easy ris export I use TexMed from http://www.bioinformatics.org, a website where you can enter a search-query and export the results as bibtex, the search-query can also be a list of pmids. Unfortunately the export needs to be taken with some caution because the tool might include unnecessary curly braces which you then have to remove.

ADD COMMENT
0
Entering edit mode
8.5 years ago
csetzkorn • 0

Hi there,

You can also use:

PubTransformer

online to achieve this. Just enter a pubmed PMID and it does the work for you.

HTH,

C

ADD COMMENT
0
Entering edit mode
7.2 years ago
by0 ▴ 110

http://pubtex.herokuapp.com/

ADD COMMENT

Login before adding your answer.

Traffic: 1874 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