Question: Downloading fasta sequence for a PDB entry
0
gravatar for henriquezvera.95
18 days ago by
henriquezvera.950 wrote:

I would like to know if it is possible to download the sequence FASTA of a pdb file using biopython

biopython genome • 96 views
ADD COMMENTlink modified 14 days ago by Sej Modha4.4k • written 18 days ago by henriquezvera.950

[ Please read before posting a question ] -- How To Ask A Good Question - what have you tried so far?

You can use NCBI unix eutils

esearch -db protein -query '1REV[All Fields] AND pdb[filter]'|efetch -format fasta
ADD REPLYlink modified 17 days ago • written 17 days ago by Sej Modha4.4k

There was a post some time ago:

How download a sequence fasta from PDB using biopython / python?

ADD REPLYlink written 14 days ago by natasha.sernova3.6k
0
gravatar for Joe
15 days ago by
Joe14k
United Kingdom
Joe14k wrote:

Kind of a hacky solution (since it downloads the PDB first technically) but here's something you can use as a one-liner:

$ wget -O - https://files.rcsb.org/download/1A80.pdb 2>/dev/null \
   | python -c "import sys; from Bio import SeqIO; SeqIO.convert(sys.stdin, 'pdb-atom', sys.stdout, 'fasta')"
>1A80:A
TVPSIVLNDGNSIPQLGYGVFKVPPADTQRAVEEALEVGYRHIDTAAIYGNEEGVGAAIA
ASGIARDDLFITTKLWNDRHDGDEPAAAIAESLAKLALDQVDLYLVHWPTPAADNYVHAW
EKMIELRAAGLTRSIGVSNHLVPHLERIVAATGVVPAVNQIELHPAYQQREITDWAAAHD
VKIESWGPLGQGKYDLFGAEPVTAAAAAHGKTPAQAVLRWHLQKGFVVFPKSVRRERLEE
NLDVFDFDLTDTEIAAIDAMDPGDGSGRVSAHPDEVD

Just replace 1A80 in the wget link to whatever the PDB ID you're interested in is. BioPython doesn't have the ability to download the data inherently, so you need to pass it the file somehow. I've elected to do this in the shell, but you could also do this natively with python, but its more complicated (IMO).

If you want to save it as a file, stick a redirect to a file at the end of the command:

(previous command)... > pdbsequence.fa
ADD COMMENTlink modified 15 days ago • written 15 days ago by Joe14k
0
gravatar for Sej Modha
14 days ago by
Sej Modha4.4k
Glasgow, UK
Sej Modha4.4k wrote:

ADD COMMENTlink written 14 days ago by Sej Modha4.4k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1986 users visited in the last hour