<p>I have not used <code>Rpdb</code> but I have used, and would recommend, <a href="http://thegrantlab.org/bio3d/index.php" rel="nofollow noreferrer">bio3d</a>.</p>

<p>To read the PDB file 1A4G:</p>

<pre><code>library(bio3d)
pdb1a4g &lt;- read.pdb("1a4g")
</code></pre>

<p>To get the SEQRES information, there are two options. Get it from the <code>pdb</code> object directly:</p>

<pre><code>seq1a4g &lt;- pdb1a4g$seqres
</code></pre>

<p>Or call <code>pdbseq</code>:</p>

<pre><code>seq1a4g &lt;- pdbseq(pdb1a4g)
</code></pre>

<p>Using the second method, the 17th position (note this is not the same as the 17th position of the original protein sequence):</p>

<pre><code>seq1a4g[17]
 92 
"Q" 
</code></pre>

CC BY-SA 3.0
2018-02-04T11:22:36.310Z
Thank you. How come pdbfile$seqres and pdbseq(pdbfile) aren't the same? Which one is more reliable?
Adrian Smith
CC BY-SA 3.0
2018-02-04T11:53:28.940Z
The first one is just accessing a property of the `pdb` object. Think of it as having a variable attached which you can read, a bit like a column of a data frame. The second is a function which has been written to access, parse and format the data. So they're both "reliable", you choose whichever is easier to work with for your use case.
neilfws
CC BY-SA 3.0
2018-02-04T12:00:22.787Z
Thanks, but I've noticed that both functions return a different vector (as can be seen with "1d1v.pdb" file for example). How come?
Adrian Smith
CC BY-SA 3.0
2018-02-04T21:13:15.967Z
If you look at [the PDB record for 1D1V](https://files.rcsb.org/view/1D1V.pdb), there's a section titled "MISSING RESIDUES". It tells you that residues 39-66 are missing from the structure for chain A. So `pdbseq()` shows you the residues present in the structure, starting from G67. `$seqres` returns the complete sequence that you'd see in the FASTA record, including the missing residues.
neilfws
CC BY-SA 3.0
2018-01-28T21:14:43.377Z
2018-01-28T21:14:43.377Z
neilfws
<p>I'm using R and its Rpdb package to work with PDB files. I use the <code>read.pdb</code> function but, nevertheless, I couldn't find the argument which will allow me to view the <code>SEQRES</code> section and the full amino-acid sequence of the protein.</p>

<p>For example, I want to find which amino-acid is in the 17th position of the sequence and I want to extract it from the 'SRQRES' section in the PDB file (the original length of the sequence was reduced for the sake of the example):</p>

<pre><code>SEQRES   1 A  390  GLU PRO GLU TRP THR TYR PRO ARG LEU SER CYS GLN GLY          
SEQRES   2 A  390  SER THR PHE GLN LYS ALA LEU LEU ILE SER PRO HIS ARG          
SEQRES   3 A  390  PHE GLY GLU ALA ARG GLY ASN SER ALA PRO LEU ILE ILE          
SEQRES   4 A  390  ARG GLU PRO PHE ILE ALA CYS GLY PRO LYS GLU CYS LYS          
SEQRES   5 A  390  HIS PHE ALA LEU THR HIS TYR ALA ALA GLN PRO GLY GLY          
SEQRES   6 A  390  TYR TYR ASN GLY THR ARG GLU ASP ARG ASN LYS LEU ARG          
SEQRES   7 A  390  HIS LEU ILE SER VAL LYS LEU GLY LYS ILE PRO THR VAL          
SEQRES   8 A  390  GLU ASN SER ILE PHE HIS MET ALA ALA TRP SER GLY SER          
SEQRES   9 A  390  ALA CYS HIS ASP GLY ARG GLU TRP THR TYR ILE GLY VAL          
SEQRES  10 A  390  ASP GLY PRO ASP SER ASN ALA LEU ILE LYS ILE LYS TYR          
</code></pre>

<p>...   </p>

<p>The original file can be found here <a href="https://files.rcsb.org/download/1A4G.pdb" rel="nofollow noreferrer">1a4g.pdb</a>.</p>

<p>Any ideas on how to accomplish that?</p>

CC BY-SA 3.0
2018-01-27T20:01:26.243Z
Please [edit] your question and add a [minimal, reproducible](https://stackoverflow.com/help/mcve) example we can use to test our answers. Ideally, give us a PDB file we can use and the code you are trying that fails.
terdon
CC BY-SA 3.0
2018-01-27T21:15:44.533Z
Generally libraries that read PDB files interpret only a subset of records from the PDB file. I don't know Rpdb, but if it can't read SEQRES then, well, it can't. You can either code it yourself or look for another library.
marcin
<r><pdb>
How to read the "SEQRES" section from a PDB file, using R
# How to read the "SEQRES" section from a PDB file, using R

(Asked by: username_0 on 2018-01-27)

I'm using R and its Rpdb package to work with PDB files. I use the read.pdb function but, nevertheless, I couldn't find the argument which will allow me to view the SEQRES section and the full amino-acid sequence of the protein.
For example, I want to find which amino-acid is in the 17th position of the sequence and I want to extract it from the 'SRQRES' section in the PDB file (the original length of the sequence was reduced for the sake of the example):
SEQRES   1 A  390  GLU PRO GLU TRP THR TYR PRO ARG LEU SER CYS GLN GLY          
SEQRES   2 A  390  SER THR PHE GLN LYS ALA LEU LEU ILE SER PRO HIS ARG          
SEQRES   3 A  390  PHE GLY GLU ALA ARG GLY ASN SER ALA PRO LEU ILE ILE          
SEQRES   4 A  390  ARG GLU PRO PHE ILE ALA CYS GLY PRO LYS GLU CYS LYS          
SEQRES   5 A  390  HIS PHE ALA LEU THR HIS TYR ALA ALA GLN PRO GLY GLY          
SEQRES   6 A  390  TYR TYR ASN GLY THR ARG GLU ASP ARG ASN LYS LEU ARG          
SEQRES   7 A  390  HIS LEU ILE SER VAL LYS LEU GLY LYS ILE PRO THR VAL          
SEQRES   8 A  390  GLU ASN SER ILE PHE HIS MET ALA ALA TRP SER GLY SER          
SEQRES   9 A  390  ALA CYS HIS ASP GLY ARG GLU TRP THR TYR ILE GLY VAL          
SEQRES  10 A  390  ASP GLY PRO ASP SER ASN ALA LEU ILE LYS ILE LYS TYR          

...   
The original file can be found here 1a4g.pdb.
Any ideas on how to accomplish that?

**Tags:** r, pdb
> **Comments:**
> **username_1**: Please [edit] your question and add a [minimal, reproducible](https://stackoverflow.com/help/mcve) example we can use to test our answers. Ideally, give us a PDB file we can use and the code you are trying that fails.  
> **username_2**: Generally libraries that read PDB files interpret only a subset of records from the PDB file. I don't know Rpdb, but if it can't read SEQRES then, well, it can't. You can either code it yourself or look for another library.  

---

## 1 answers

### Answer by username_3 on 2018-01-28. Score: 4

I have not used Rpdb but I have used, and would recommend, bio3d.
To read the PDB file 1A4G:
library(bio3d)
pdb1a4g <- read.pdb("1a4g")

To get the SEQRES information, there are two options. Get it from the pdb object directly:
seq1a4g <- pdb1a4g$seqres

Or call pdbseq:
seq1a4g <- pdbseq(pdb1a4g)

Using the second method, the 17th position (note this is not the same as the 17th position of the original protein sequence):
seq1a4g[17]
 92 
"Q"

> **Comments:**
> **username_0**: Thank you. How come pdbfile$seqres and pdbseq(pdbfile) aren't the same? Which one is more reliable?  
> **username_3**: The first one is just accessing a property of the `pdb` object. Think of it as having a variable attached which you can read, a bit like a column of a data frame. The second is a function which has been written to access, parse and format the data. So they're both "reliable", you choose whichever is easier to work with for your use case.  
> **username_0**: Thanks, but I've noticed that both functions return a different vector (as can be seen with "1d1v.pdb" file for example). How come?  
> **username_3**: If you look at [the PDB record for 1D1V](https://files.rcsb.org/view/1D1V.pdb), there's a section titled "MISSING RESIDUES". It tells you that residues 39-66 are missing from the structure for chain A. So `pdbseq()` shows you the residues present in the structure, starting from G67. `$seqres` returns the complete sequence that you'd see in the FASTA record, including the missing residues.  

---

