Answers.Body: <p>If your file is in PDB format as the one shown <a href="https://files.rcsb.org/view/6C4A.pdb" rel="nofollow noreferrer">here</a> in .pdb format then you can simply extract your desired fields using <a href="https://www.gnu.org/software/sed/manual/sed.html" rel="nofollow noreferrer">sed</a> which is a programming language used to parse and transform text. As for this<a href="https://files.rcsb.org/view/6C4A.pdb" rel="nofollow noreferrer"> structure </a>i.e 6C4A in .pdb format HETNAM and HETSYN can be extracted using sed as follows:</p>
  
  <pre><code>sed  -n -e '/HETNAM/ p' -e '/HETSYN/ p'  6C4A.pdb
  
  HETNAM     EJA S-[(1Z)-2-CARBOXY-N-HYDROXYETHANIMIDOYL]-L-CYSTEINE              
  HETNAM     PYR PYRUVIC ACID                                                     
  HETNAM      MG MAGNESIUM ION                                                    
  HETNAM     3NP 3-NITROPROPANOIC ACID                                            
  HETNAM     PEG DI(HYDROXYETHYL)ETHER                                            
  HETNAM     EPE 4-(2-HYDROXYETHYL)-1-PIPERAZINE ETHANESULFONIC ACID              
  HETSYN     EPE HEPES
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-08T14:09:31.140Z
Answers.Text: Thanks, seems pretty straightforward. How do I use sed? Is it a way to apply it on R ?
Answers.UserDisplayName: Adrian Smith
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-08T15:03:11.583Z
Answers.Text: It is straight forward. Write this command on Linux command line/terminal with your input file present in current working directory.
Answers.UserDisplayName: Ammar Sabir Cheema
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-08T15:09:33.483Z
Answers.Text: Secondly for using sed in R you should check [this](https://jpwendler.wordpress.com/2013/07/31/using-a-linux-sed-command-to-retrieve-specific-rows-from-a-file-from-r/amp/)
Answers.UserDisplayName: Ammar Sabir Cheema
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-08T13:56:34.897Z
Answers.LastActivityDate: 2018-06-08T13:56:34.897Z
Answers.UserDisplayName: Ammar Sabir Cheema
Body: <p>I'm using R and I'm trying to import specific records from a PDB file (e.g. <code>HETNAM</code>, <code>HETSYN</code>). Unfortunately, it seems the <code>read.pdb</code> function of either <code>biomaRt</code> or <code>Rpdb</code> aren't capable of it.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-06-08T12:07:11.330Z
Comments.Text: Hi, could you show what have you tried? As far as I know it is not so difficult to parse the files, but that depends on the format of the file you downloaded.
Comments.UserDisplayName: llrs
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-06-08T14:10:08.070Z
Comments.Text: Hi, nothing special, I just used the read.pdb function to read in the PDB files.
Comments.UserDisplayName: Adrian Smith
Tags: <r><pdb>
Title: Using R to import specific records from a PDB file
ThreadText: # Using R to import specific records from a PDB file
  
  (Asked by: username_0 on 2018-06-08)
  
  I'm using R and I'm trying to import specific records from a PDB file (e.g. `HETNAM`, `HETSYN`). Unfortunately, it seems the `read.pdb` function of either `biomaRt` or `Rpdb` aren't capable of it.
  
  Any ideas?
  
  Thanks
  
  **Tags:** r, pdb
  
  > **Comments:**
  > **username_1**: Hi, could you show what have you tried? As far as I know it is not so difficult to parse the files, but that depends on the format of the file you downloaded.  
  > **username_0**: Hi, nothing special, I just used the read.pdb function to read in the PDB files.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-06-08. Score: 4 | Accepted answer
  
  If your file is in PDB format as the one shown [here](https://files.rcsb.org/view/6C4A.pdb) in .pdb format then you can simply extract your desired fields using [sed](https://www.gnu.org/software/sed/manual/sed.html) which is a programming language used to parse and transform text. As for this [structure](https://files.rcsb.org/view/6C4A.pdb) i.e 6C4A in .pdb format HETNAM and HETSYN can be extracted using sed as follows:
  
  ```
  sed  -n -e '/HETNAM/ p' -e '/HETSYN/ p'  6C4A.pdb
  
  HETNAM     EJA S-[(1Z)-2-CARBOXY-N-HYDROXYETHANIMIDOYL]-L-CYSTEINE              
  HETNAM     PYR PYRUVIC ACID                                                     
  HETNAM      MG MAGNESIUM ION                                                    
  HETNAM     3NP 3-NITROPROPANOIC ACID                                            
  HETNAM     PEG DI(HYDROXYETHYL)ETHER                                            
  HETNAM     EPE 4-(2-HYDROXYETHYL)-1-PIPERAZINE ETHANESULFONIC ACID              
  HETSYN     EPE HEPES
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks, seems pretty straightforward. How do I use sed? Is it a way to apply it on R ?  
  > **username_2**: It is straight forward. Write this command on Linux command line/terminal with your input file present in current working directory.  
  > **username_2**: Secondly for using sed in R you should check [this](https://jpwendler.wordpress.com/2013/07/31/using-a-linux-sed-command-to-retrieve-specific-rows-from-a-file-from-r/amp/)  
  
  ---
  
  