[BioRuby] How to renumber a PDB file using BioRuby ?

Yen-Ju Chen yjchen at reciprocallattice.com
Thu Apr 10 04:14:57 EDT 2008


This is how I do it for atom number. You probably can find a way for residues.

require 'bio'

file = File.new('a.pdb').gets(nil)
structure = Bio::PDB.new(file)

structure.each do |model|
 model.each do |chain|
 chain.each do |residue|
 residue.each do |atom|
 atom.resSeq += 400
 end
 end
 end
end

File.open('x.pdb', 'w') do |file|
 file << structure.to_s
end

Yen-Ju

On Thu, Apr 10, 2008 at 2:32 PM, K. Shameer <shameer at ncbs.res.in> wrote:
> Dear All,
>
> I have  a pdb file ( in perfect pdb format, no hetatm, no solvent, single
> chain file). I need to renumber the whole pdb file, for example if my
> input file is 1CRN.pdb and it starts with residue number 1, I need to
> renumber them so that first resiude number will be 12, next 13, 14... like
> that. I want to know if I can specifically access the residue number and
> increment it from first residue using my new number (here it will be
> residue_number  +  12)and regenerate the file.
>
> Anybody had tried this before,
>
> Thanks in advance for any help,
> K. Shameer
>
> _______________________________________________
> BioRuby mailing list
> BioRuby at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioruby
>


More information about the BioRuby mailing list