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)