# NOT RUN {
# Simple conversion
aa123(c("D","L","A","G","S","H"))
aa321(c("ASP", "LEU", "ALA", "GLY", "SER", "HIS"))
# }
# NOT RUN {
# Extract sequence from a PDB file's ATOM and SEQRES cards
pdb <- read.pdb("1BG2")
s <- aa321(pdb$seqres) # SEQRES
a <- aa321(pdb$atom[pdb$calpha,"resid"]) # ATOM
# Write both sequences to a fasta file
write.fasta(alignment=seqbind(s,a), id=c("seqres","atom"), file="eg2.fa")
# Alternative approach for ATOM sequence extraction
pdbseq(pdb)
pdbseq(pdb, aa1=FALSE )
# }
Run the code above in your browser using DataLab