[BioRuby-cvs] bioruby/lib/bio/db/pdb pdb.rb,1.15,1.16

Naohisa Goto ngoto at dev.open-bio.org
Tue Jun 27 14:23:47 UTC 2006


Update of /home/repository/bioruby/bioruby/lib/bio/db/pdb
In directory dev.open-bio.org:/tmp/cvs-serv9227/lib/bio/db/pdb

Modified Files:
	pdb.rb 
Log Message:
Bio::PDB::ATOM#name, #resName, #iCode, #chaarge are changed to be strippedi
when initializing.
Bio::PDB::ATOM#segID is changed to be right-stripped when initializing.
Bio::PDB::ATOM#element is changed to be left-stripped when initializing.
(Because Bio::PDB::HETATM inherits Bio::PDB::ATOM, Bio::PDB::HETATM is
also subject to the changes.)


Index: pdb.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/pdb.rb,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** pdb.rb	20 Feb 2006 13:00:43 -0000	1.15
--- pdb.rb	27 Jun 2006 14:23:45 -0000	1.16
***************
*** 993,1002 ****
            return self if @parsed
            self.serial     = @str[6..10].to_i
!           self.name       = @str[12..15]
            self.altLoc     = @str[16..16]
!           self.resName    = @str[17..19].rstrip
            self.chainID    = @str[21..21]
            self.resSeq     = @str[22..25].to_i
!           self.iCode      = @str[26..26]
            self.x          = @str[30..37].to_f
            self.y          = @str[38..45].to_f
--- 993,1002 ----
            return self if @parsed
            self.serial     = @str[6..10].to_i
!           self.name       = @str[12..15].strip
            self.altLoc     = @str[16..16]
!           self.resName    = @str[17..19].strip
            self.chainID    = @str[21..21]
            self.resSeq     = @str[22..25].to_i
!           self.iCode      = @str[26..26].strip
            self.x          = @str[30..37].to_f
            self.y          = @str[38..45].to_f
***************
*** 1004,1010 ****
            self.occupancy  = @str[54..59].to_f
            self.tempFactor = @str[60..65].to_f
!           self.segID      = @str[72..75]
!           self.element    = @str[76..77]
!           self.charge     = @str[78..79]
            @parsed = true
            self
--- 1004,1010 ----
            self.occupancy  = @str[54..59].to_f
            self.tempFactor = @str[60..65].to_f
!           self.segID      = @str[72..75].to_s.rstrip
!           self.element    = @str[76..77].to_s.lstrip
!           self.charge     = @str[78..79].to_s.strip
            @parsed = true
            self
***************
*** 1012,1019 ****
  
          def to_s
            sprintf("%-6s%5d %-4s%-1s%3s %-1s%4d%-1s   %8.3f%8.3f%8.3f%6.2f%6.2f      %-4s%2s%-2s\n",
                    self.record_name,
                    self.serial, 
!                   self.name,
                    self.altLoc,
                    self.resName,
--- 1012,1024 ----
  
          def to_s
+           atomname = self.name.to_s
+           elem = self.element.to_s.strip
+           if elem.length == 1 and atomname.lstrip[0, 1] == elem then
+             atomname = ' ' + atomname
+           end
            sprintf("%-6s%5d %-4s%-1s%3s %-1s%4d%-1s   %8.3f%8.3f%8.3f%6.2f%6.2f      %-4s%2s%-2s\n",
                    self.record_name,
                    self.serial, 
!                   atomname,
                    self.altLoc,
                    self.resName,




More information about the bioruby-cvs mailing list