[BioRuby-cvs] bioruby/lib/bio/db/pdb atom.rb, 1.2, 1.3 pdb.rb, 1.3, 1.4

Naohisa Goto ngoto at pub.open-bio.org
Fri Dec 16 14:23:05 EST 2005


Update of /home/repository/bioruby/bioruby/lib/bio/db/pdb
In directory pub.open-bio.org:/tmp/cvs-serv14367/d

Modified Files:
	atom.rb pdb.rb 
Log Message:
grave changes

It does not work correctly now.


Index: atom.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/atom.rb,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** atom.rb	8 Sep 2005 01:22:11 -0000	1.2
--- atom.rb	16 Dec 2005 19:23:02 -0000	1.3
***************
*** 56,124 ****
      end #class Coordinate
  
!     #Atom class
      class Atom
- 
        include Utils
        include Comparable
  
-       attr_accessor :serial, :element, :alt_loc, :x, :y, :z,
-         :occ, :bfac, :residue
- 
-       def initialize(serial, element, alt_loc, x, y, z,
-                      occ, bfac, residue = nil)
- 
-         @serial  = serial
-         @element = element
-         @alt_loc = alt_loc
-         @x       = x
-         @y       = y
-         @z       = z
-         @occ     = occ
-         @bfac    = bfac
-         
-         @residue = residue
-         
-       end
- 
        #Returns a Coordinate class instance of the xyz positions
        def xyz
!         Coordinate[@x, at y, at z]
        end
  
        #Returns an array of the xyz positions
        def to_a
!         [@x, at y, at z]
        end
        
        #Sorts based on serial numbers
        def <=>(other)
!         return @serial <=> other.serial
        end
        
        #Stringifies to PDB format
        def to_s
!         if @element.length < 4
!           elementOutput = " " << "%-3s" % @element
!         else
!           elementOutput = @element
!         end
!         if @residue.hetatm
!           "HETATM%5s %s%1s%3s %1s%4s%1s   %8.3f%8.3f%8.3f%6.2f%6.2f" % [ @serial, elementOutput, @alt_loc, @residue.resName, @residue.chain.id, @residue.resSeq, @residue.iCode, @x, @y, @z, @occ, @bfac ]
          else
!           "ATOM  %5s %s%1s%3s %1s%4s%1s   %8.3f%8.3f%8.3f%6.2f%6.2f" % [ @serial, elementOutput, @alt_loc, @residue.resName, @residue.chain.id, @residue.resSeq, @residue.iCode, @x, @y, @z, @occ, @bfac ]
          end
        end
-       
-     end
- 
-   end
- 
- end
- 
- =begin
  
! = Bio::PDB::Atom
  
!  A class for atom data - each ATOM line is parsed into an Atom object
  
! =end
--- 56,110 ----
      end #class Coordinate
  
!     # Bio::PDB::Atom is a class for atom data.
!     # Each ATOM line is parsed into an Atom object.
!     Atom = Struct.new(:serial, :element, :alt_loc, :x, :y, :z,
!                       :occ, :bfac, :residue)
      class Atom
        include Utils
        include Comparable
  
        #Returns a Coordinate class instance of the xyz positions
        def xyz
!         Coordinate[ x, y, z ]
        end
  
        #Returns an array of the xyz positions
        def to_a
!         [ x, y, z ]
        end
        
        #Sorts based on serial numbers
        def <=>(other)
!         return serial <=> other.serial
        end
        
        #Stringifies to PDB format
        def to_s
!         if element.length < 4
!           elementOutput = sprintf(" %-3s", element)
          else
!           elementOutput = element
          end
+         sprintf("%-6s%5s %s%1s%3s %1s%4s%1s   %8.3f%8.3f%8.3f%6.2f%6.2f",
+                 record_type,
+                 serial, elementOutput, alt_loc, residue.resName,
+                 residue.chain.id, residue.resSeq, residue.iCode,
+                 x, y, z, occ, bfac)
        end
  
!       def record_type
!         'ATOM'
!       end
!     end #class Atom
  
!     # Bio::PDB::HetAtm is a class for HETATM data.
!     # Each HETATM line is parsed into an HetAtm object.
!     # Since HetAtm inherits Atom class, please refer Atom class for usage.
!     class HetAtm < Atom
!       def record_type
!         'HETATM'
!       end
!     end #class HetAtm
  
!   end #class PDB
! end #class Bio

Index: pdb.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/pdb.rb,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** pdb.rb	26 Sep 2005 13:00:08 -0000	1.3
--- pdb.rb	16 Dec 2005 19:23:03 -0000	1.4
***************
*** 33,37 ****
    #This is the main PDB class which takes care of parsing, annotations
    #and is the entry way to the co-ordinate data held in models
!   class PDB < DB
  
      include Utils
--- 33,37 ----
    #This is the main PDB class which takes care of parsing, annotations
    #and is the entry way to the co-ordinate data held in models
!   class PDB #< DB
  
[...2079 lines suppressed...]
                
***************
*** 1179,1186 ****
                end
                
!               atom = Atom.new(serial,name,altLoc,
!                               x,y,z,
!                               occupancy,tempFactor,
!                               newResidue)
                newResidue.addAtom(atom)
                
--- 1231,1238 ----
                end
                
!               atom = atomclass.new(serial,name,altLoc,
!                                    x,y,z,
!                                    occupancy,tempFactor,
!                                    newResidue)
                newResidue.addAtom(atom)
                



More information about the bioruby-cvs mailing list