[BioRuby] how to convert sequence to fasta format with header information?

Diana Jaunzeikare rozziite at gmail.com
Thu Jul 30 22:04:59 UTC 2009


Hi all,

I want to retrieve sequence from a pdb file and save it in fasta format
where* header holds the pdb entry id*. This is how I did it:

file = File.new('1OOP.pdb').gets(nil)
structure = Bio::PDB.new(file)
seq = structure.seqres['A']
puts seq.to_fasta("1OOP", 70)

it works and produces result i want:

#>1OOP
#GPPGEVMGRAIARVADTIGSGPVNSESIPALTAAETGHTSQVVPSDTMQTRHVKNYHSRSESTVENFLCR
#SACVFYTTYENHDSDGDNFAYWVINTRQVAQLRRKLEMFTYARFDLELTFVITSTQEQPTVRGQDAPVLT
#HQIMYVPPGGPVPTKVNSYSWQTSTNPSVFWTEGSAPPRMSVPFIGIGNAYSMFYDGWARFDKQGTYGIS
#TLNNMGTLYMRHVNDGGPGPIVSTVRIYFKPKHVKTWVPRPPRLCQYQKAGNVNFEPTGVTEGRTDITTM
#KTT

However, according to documation Bio::Sequence::Common#to_fasta is a
deprecated method and it suggests to use Bio::Sequence#output, but when I
modify code to

puts seq.output(:fasta)

it gives error that method is not defined. Also I don't see a way how to
define the header.

What should i use in place of the deprecated to_fasta method?

Thanks,

Diana



More information about the BioRuby mailing list