# Get protein names corresponding to PDB ID

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?

• Have you tried writing a PyMol script?
– M__
Oct 31 '20 at 13:08
• 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. Oct 31 '20 at 13:20
• @Michael — Could you clarify please. A script tTo do what on what? And why in PyMol? Oct 31 '20 at 15:34
• @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. Oct 31 '20 at 15:40
• 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. Oct 31 '20 at 17:48

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:

1brr
4lzm
2dyi


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;
do
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


Update

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)

• sed should also be available for you. You can install jq and parallel with brew
– Mr_Z
Nov 4 '20 at 19:56
• 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. Nov 5 '20 at 12:52
– Mr_Z
Nov 5 '20 at 12:59
• 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… Nov 7 '20 at 16:58
• 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.
– Mr_Z
Nov 7 '20 at 19:49

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

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

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

getBM(attributes=c('hgnc_symbol','ensembl_gene_id','entrezgene_id',
'protein_id','description',"superfamily"),
filters = 'pdb',
values = "2bhl",
mart = ensembl)


Returns

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.

• 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? Oct 31 '20 at 18:34
• You can add 'pdb' to the list of attributes. That will add a column with the pdb id. c('pdb','hgnc_symbol',....),
– fra
Oct 31 '20 at 22:51
• Ok. Get it. Thanks. Nov 1 '20 at 0:39
• 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",...))
– fra
Nov 1 '20 at 11:05
• 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. Nov 1 '20 at 11:43