I have a list of about 4000 PDB IDs and would like to get the actual names of the proteins (e.g. lactate dehydrogenase, cytochrome c). I tried the batch header section at the Protein Databank Download page but it refused to accept my PDB IDs in formats (xxxx or xxxx.pdb, individually or space-separated) that worked in an interactive search for the protein structure.

Any suggestions?

  • 1
    $\begingroup$ Have you tried writing a PyMol script? $\endgroup$
    – M__
    Commented Oct 31, 2020 at 13:08
  • 1
    $\begingroup$ Perhaps you could use ftp.wwpdb.org/pub/pdb/derived_data/index/entries.idx which contains HEADER and COMPOUND fields extracted from all PDB entries. $\endgroup$
    – marcin
    Commented Oct 31, 2020 at 13:20
  • 1
    $\begingroup$ @Michael — Could you clarify please. A script tTo do what on what? And why in PyMol? $\endgroup$
    – David
    Commented Oct 31, 2020 at 15:34
  • 1
    $\begingroup$ @marcin — Thanks, but the problem with the HEADER and COMPOUND fields is that they are such utter unparsable anarchy. I could write a script to get these fields from all my pdb files, but take for example 102L — I would get as HEADER "HYDROLASE(O-GLYCOSYL)" (useless) and as COMPOUND "HOW AMINO-ACID INSERTIONS ARE ALLOWED IN AN ALPHA-HELIX OF T4 LYSOZYME ENTEROBACTERIA PHAGE T4" where the name of the protein — Lysozyme — is buried. The prehistoric format of pdb files is the problem, but surely someone, somewhere has done something with them. $\endgroup$
    – David
    Commented Oct 31, 2020 at 15:40
  • 1
    $\begingroup$ In which case, going from PDB to Uniprot using SIFTS https://www.ebi.ac.uk/pdbe/docs/sifts/quick.html is the best bet as the Uniprot entries will have all the synonyms you could have for. $\endgroup$ Commented Oct 31, 2020 at 17:48

2 Answers 2


You can use one of the UniProt Protein APIs.

As you said you have your pdb entries in a text file line by line you can, like this example.txt containing:


Using the commandline, you can use a little script like this to download the name, if it is available for the given pdb entry.

while read line;
 curl -X GET --header 'Accept:application/json' "https://www.ebi.ac.uk/proteins/api/proteins/pdb:$line" | 
 jq -r '.[].protein.recommendedName.fullName.value'  |
 sed "s/^/$line\t/" >> pdb_names.txt;
done < example.txt;

You need to have curl, sed and jq installed on your system.

This gives you following output in pdb_names.txt

1brr    Bacteriorhodopsin
4lzm    Endolysin
2dyi    Ribosome maturation factor RimM


if you want to speed it up, you can run it with parallel.

parallel -j 4 'curl -X GET --header "Accept:application/json" "https://www.ebi.ac.uk/proteins/api/proteins/pdb:{}" |   jq -r ".[]. .protein.recommendedName.fullName.value"  |  sed "s/^/{}\t/" >> pdb_names_parallel.txt' :::: example.txt

With the -j option you call how many jobs should run in parallel. The limit of the UniProt API is 200 request per second per user.

Update 7. Nov 2020

To get another info beside the protein name, you need to know how the JSON response from UniProt looks like.

To get also the scientific name, you can run following command:

parallel -j 4 'curl -X GET --header "Accept:application/json" "https://www.ebi.ac.uk/proteins/api/proteins/pdb:{}" | jq -r ".[] | .protein.recommendedName.fullName.value + \" - \" + .organism.names[0].value"  |  sed "s/^/{}\t/" >> pdb_names_parallel.txt' :::: example.txt

As result you get this:

1brr    Bacteriorhodopsin - Halobacterium salinarum (strain ATCC 700922 / JCM 11081 / NRC-1)
4lzm    Endolysin - Enterobacteria phage T4
2dyi    Ribosome maturation factor RimM - Thermus thermophilus (strain HB8 / ATCC 27634 / DSM 579)
  • $\begingroup$ sed should also be available for you. You can install jq and parallel with brew $\endgroup$
    – Mr_Z
    Commented Nov 4, 2020 at 19:56
  • $\begingroup$ Many thanks. Got this running. Only problem is that on OS X the \t tab escape does not work (it is apparently non-standard) and none of the answers here worked for me. However it is easy enough to insert a tab after the four-character PDB ID programmatically. $\endgroup$
    – David
    Commented Nov 5, 2020 at 12:52
  • $\begingroup$ Check this answer stackoverflow.com/a/6392271 for your tab problem. $\endgroup$
    – Mr_Z
    Commented Nov 5, 2020 at 12:59
  • $\begingroup$ Thanks again. I know it is bad form to ask supplementary questions, but could you possibly provide a link in your answer to the particular page in the API which describes the need to specify all of the four "dotted" terms. I went to ebi.ac.uk/proteins/api to try to find out how to construct a query to get the species (so I didn't have to ask) but must be looking in the wrong place. I can find an example XML for a protein under proteins/proteins that includes some of these terms, and various unpromising json thingies. NCBI provides intelligible APIs (or used to) — whereas EBI… $\endgroup$
    – David
    Commented Nov 7, 2020 at 16:58
  • $\begingroup$ I've updated my answer. The dotted format is not a problem of the API. It is just how jq is getting the keys from the JSON formatted result. stedolan.github.io/jq/manual/#Basicfilters gives you a basic overview of how to use jq. $\endgroup$
    – Mr_Z
    Commented Nov 7, 2020 at 19:49

Assuming you can use R, have you tried with biomaRt? For example, using 2bhl (my PhD lover :D)

ensembl <- useMart("ensembl",dataset="hsapiens_gene_ensembl")

# get list of all available info
filters <- listFilters(ensembl)
attributes <- listAttributes(ensembl)

      filters = 'pdb', 
      values = "2bhl", 
      mart = ensembl)


hgnc_symbol ensembl_gene_id entrezgene_id protein_id description
1         G6PD ENSG00000160211          2539   ADO22353 glucose-6-phosphate dehydrogenase [Source:HGNC Symbol;Acc:HGNC:4057]
2         G6PD ENSG00000160211          2539   CAA27309 glucose-6-phosphate dehydrogenase [Source:HGNC Symbol;Acc:HGNC:4057]
3         G6PD ENSG00000160211          2539   AAA63175 glucose-6-phosphate dehydrogenase [Source:HGNC Symbol;Acc:HGNC:4057]
4         G6PD ENSG00000160211          2539   AAA52500 glucose-6-phosphate dehydrogenase [Source:HGNC Symbol;Acc:HGNC:4057]
5         G6PD ENSG00000160211          2539   AAA52501 glucose-6-phosphate dehydrogenase [Source:HGNC Symbol;Acc:HGNC:4057]
6         G6PD ENSG00000160211          2539   CAA39089 glucose-6-phosphate dehydrogenase [Source:HGNC Symbol;Acc:HGNC:4057]
7 ...

I am sure if you look at all the available filters and attributes, you can pinpoint the ID you are looking for.

  • $\begingroup$ Thanks. I can reproduce that, but only paint by numbers with R. How would I modify that to loop through a list of 4000 proteins and ensure the pdb ID was included in the output? $\endgroup$
    – David
    Commented Oct 31, 2020 at 18:34
  • $\begingroup$ You can add 'pdb' to the list of attributes. That will add a column with the pdb id. c('pdb','hgnc_symbol',....), $\endgroup$
    – fra
    Commented Oct 31, 2020 at 22:51
  • $\begingroup$ Ok. Get it. Thanks. $\endgroup$
    – David
    Commented Nov 1, 2020 at 0:39
  • $\begingroup$ I am not sure how your input file is (csv, vector, data.frame), but to run on multiple pdbs, you need to change yourvalues (values= c("2bhl","pdbID2","pdbID3",...)) $\endgroup$
    – fra
    Commented Nov 1, 2020 at 11:05
  • $\begingroup$ My input is just a text file of filenames, one per line, generated from a unix ls command. I can convert it into a string of the type you suggest, although I wonder if there is any limit on the length of such strings. Referencing a text file would be preferable if it is possible. $\endgroup$
    – David
    Commented Nov 1, 2020 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.