# The Lab Notes

The main theme of our research is to understand how gene regulation and genome organization tie in with each other. The Lab Notes are the latest headlines from the lab, featuring a collection of random thoughts and useful code snippets.

## How to convert PubMed references to BibTeX

Time and again, you need to write a paper in LaTeX with at lot of citations from PubMed. And we all know that PubMed does not support the BibTex format. Fortunately, you do not have to go through the pain of a manual conversion. If you are familiar with basic scripting, this can be done fairly easily with the following steps.

Write your TeX document with pubmed citation numbers. Each article on pubmed has a pmid which consists of numbers only, which is the key of the PubMed record of this article. For instance, when you cite the PubMed article 22999052 in your TeX document you would write

\citep{pmid22999052}

Extract the pmids from the tex document. For instance, if your TeX document is called document.tex, at the Linux command line you can do this with

grep -o "pmid[0-9]*" document.tex | sort -u | sed 's/pmid//'

Use the eFetch API to get the PubMed records in XML format. Assuming that you now have a comma-separated list of pmids somewhere ready (in the example below, the pmids are 22999052,21813512), paste the following in your browser text box (or open this link in a new...