lib/bio/db/pdb/pdb.rb in bio-1.2.1 vs lib/bio/db/pdb/pdb.rb in bio-1.3.0

- old
+ new

@@ -4,11 +4,11 @@ # Copyright:: Copyright (C) 2003-2006 # GOTO Naohisa <ngoto@gen-info.osaka-u.ac.jp> # Alex Gutteridge <alexg@ebi.ac.uk> # License:: The Ruby License # -# $Id: pdb.rb,v 1.27 2007/12/28 14:43:44 ngoto Exp $ +# $Id: pdb.rb,v 1.28 2008/04/01 10:36:44 ngoto Exp $ # # = About Bio::PDB # # Please refer document of Bio::PDB class. # @@ -1495,10 +1495,13 @@ newChain = Chain.new(f.chainID, cModel) cModel.addChain(newChain) cChain = newChain chain = newChain end + # chain might be changed, clearing cResidue and cLigand + cResidue = nil + cLigand = nil end end case key when 'ATOM' @@ -1548,10 +1551,12 @@ ligand.addAtom(f) when 'MODEL' c_atom = nil cChain = nil + cResidue = nil + cLigand = nil if cModel.model_serial or cModel.chains.size > 0 then self.addModel(cModel) end cModel = Model.new(f.serial) @@ -1807,16 +1812,20 @@ # amino acid sequence a.collect! do |aa| #aa is three letter code: i.e. ALA #need to look up with Ala aa = aa.capitalize - (Bio::AminoAcid.three2one(aa) or 'X') + (begin + Bio::AminoAcid.three2one(aa) + rescue ArgumentError + nil + end || 'X') end seq = Bio::Sequence::AA.new(a.to_s) else # nucleic acid sequence a.collect! do |na| - na = na.strip + na = na.delete('^a-zA-Z') na.size == 1 ? na : 'n' end seq = Bio::Sequence::NA.new(a.to_s) end newHash[k] = seq