2
$\begingroup$

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

$\endgroup$
2
  • $\begingroup$ 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. $\endgroup$
    – llrs
    Jun 8 '18 at 12:07
  • $\begingroup$ Hi, nothing special, I just used the read.pdb function to read in the PDB files. $\endgroup$ Jun 8 '18 at 14:10
4
$\begingroup$

If your file is in PDB format as the one shown here in .pdb format then you can simply extract your desired fields using sed which is a programming language used to parse and transform text. As for this structure 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
$\endgroup$
3
  • $\begingroup$ Thanks, seems pretty straightforward. How do I use sed? Is it a way to apply it on R ? $\endgroup$ Jun 8 '18 at 14:09
  • $\begingroup$ It is straight forward. Write this command on Linux command line/terminal with your input file present in current working directory. $\endgroup$ Jun 8 '18 at 15:03
  • $\begingroup$ Secondly for using sed in R you should check this $\endgroup$ Jun 8 '18 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.