[BioRuby-cvs] bioruby/lib/bio/db/pdb pdb.rb,1.22,1.23

Naohisa Goto ngoto at dev.open-bio.org
Tue Jul 10 10:44:49 UTC 2007


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

Modified Files:
	pdb.rb 
Log Message:
Pdb_LString.new is changed not to raise error for nil.

Fixed a bug when below records does not exist in a PDB entry:
REMARK (remark), JRNL (jrnl), HELIX (helix),
TURN (turn), SHEET (sheet), SSBOND (ssbond), SEQRES (seqres),
DBREF (dbref), KEYWDS (keywords), AUTHOR (authors),
HEADER (entry_id, accession, classification),
TITLE (definition), and REVDAT (version) records (methods).

Incompatible change: Bio::PDB#record is changed to return
an empty array for nonexistent record.

Thanks to Dr. Mikael Borg. (Re: [BioRuby] Preparing for 1.1 release)



Index: pdb.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/pdb.rb,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** pdb.rb	19 Apr 2007 13:59:29 -0000	1.22
--- pdb.rb	10 Jul 2007 10:44:46 -0000	1.23
***************
*** 120,124 ****
          end
          def self.new(str)
!           String.new(str)
          end
        end
--- 120,124 ----
          end
          def self.new(str)
!           String.new(str.to_s)
          end
        end
***************
*** 1675,1679 ****
      #
      def record(name = nil)
!       name ? @hash[name] : @hash
      end
  
--- 1675,1679 ----
      #
      def record(name = nil)
!       name ? (@hash[name] || []) : @hash
      end
  
***************
*** 1838,1847 ****
      # Classification in "HEADER".
      def classification
!       self.record('HEADER').first.classification
      end
  
      # Get authors in "AUTHOR".
      def authors
!       self.record('AUTHOR').first.authorList
      end
  
--- 1838,1848 ----
      # Classification in "HEADER".
      def classification
!       f = self.record('HEADER').first
!       f ? f.classification : nil
      end
  
      # Get authors in "AUTHOR".
      def authors
!       self.record('AUTHOR').collect { |f| f.authorList }.flatten
      end
  
***************
*** 1852,1856 ****
      # PDB identifier written in "HEADER". (e.g. 1A00)
      def entry_id
!       @id = self.record('HEADER').first.idCode unless @id
        @id
      end
--- 1853,1860 ----
      # PDB identifier written in "HEADER". (e.g. 1A00)
      def entry_id
!       unless @id
!         f = self.record('HEADER').first
!         @id = f ? f.idCode : nil
!       end
        @id
      end
***************
*** 1863,1872 ****
      # Title of this entry in "TITLE".
      def definition
!       self.record('TITLE').first.title
      end
  
      # Current modification number in "REVDAT".
      def version
!       self.record('REVDAT').first.modNum
      end
  
--- 1867,1878 ----
      # Title of this entry in "TITLE".
      def definition
!       f = self.record('TITLE').first
!       f ? f.title : nil
      end
  
      # Current modification number in "REVDAT".
      def version
!       f = self.record('REVDAT').first
!       f ? f.modNum : nil
      end
  




More information about the bioruby-cvs mailing list