[BioRuby] bug in residue.rb

GOTO Naohisa ngoto at gen-info.osaka-u.ac.jp
Thu Apr 13 15:27:41 UTC 2006

Thank you for reporting bugs.
Because we extremely changed PDB parser from 0.6.4 to 1.0,
there might be more and more bugs.

On Thu, 13 Apr 2006 08:42:09 -0400
Mikael Borg <mikael.borg at utoronto.ca> wrote:

> Hi, the [] method for Bio::PDB::Residue stopped working when I upgraded from
> bioruby-0.6.4 to bioruby-1.0.
> I believe the problem lies in line 86 of bio-1.0.0/lib/bio/db/pdb/residue.rb:
>       #Keyed access to atoms based on element e.g. ["CA"]
>       def [](key)
>         atom = @atoms.find{ |atom| key == atom.element }
>       end
> Should this be something like
>       #Keyed access to atoms based on element e.g. ["CA"]
>       def [](key)
>         atom = @atoms.find{ |atom| key == atom.name.strip}
>       end
> as atom.element==nil when I read in a pdb file?
> When a pdb file is parsed, the white space surrounding the atom.name
> record is not removed, so e.g. atom.name=" CA ", which is why I had to strip
> atom.name.

I previously thought that the white spaces may have some literal
meanings, but I'm now feeling inconvenience for the spaces.
I'll change atom.name (and other methods like this) to return a
stripped string (e.g. "CA"), if this dosn't make fatal errors.

Naohisa GOTO
ngoto at gen-info.osaka-u.ac.jp
Department of Genome Informatics, Genome Information Research Center,
Research Institute for Microbial Diseases, Osaka University, Japan

More information about the BioRuby mailing list