[BioRuby-cvs] bioruby/lib/bio/db/genbank common.rb, 1.8, 1.9 genbank.rb, 0.37, 0.38

Katayama Toshiaki k at pub.open-bio.org
Wed Dec 7 06:23:53 EST 2005


Update of /home/repository/bioruby/bioruby/lib/bio/db/genbank
In directory pub.open-bio.org:/tmp/cvs-serv28253/lib/bio/db/genbank

Modified Files:
	common.rb genbank.rb 
Log Message:
* fixed to check empty or incomplete string (e.g. empty entry)


Index: genbank.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/genbank/genbank.rb,v
retrieving revision 0.37
retrieving revision 0.38
diff -C2 -d -r0.37 -r0.38
*** genbank.rb	14 Nov 2005 05:43:43 -0000	0.37
--- genbank.rb	7 Dec 2005 11:23:51 -0000	0.38
***************
*** 32,36 ****
    class Locus
      def initialize(locus_line)
!       if locus_line.length > 75 			# after Rel 126.0
          @entry_id = locus_line[12..27].strip
          @length   = locus_line[29..39].to_i
--- 32,38 ----
    class Locus
      def initialize(locus_line)
!       if locus_line.empty?
!         # do nothing (just for empty or incomplete entry string)
!       elsif locus_line.length > 75 			# after Rel 126.0
          @entry_id = locus_line[12..27].strip
          @length   = locus_line[29..39].to_i

Index: common.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/genbank/common.rb,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** common.rb	14 Nov 2005 05:43:43 -0000	1.8
--- common.rb	7 Dec 2005 11:23:51 -0000	1.9
***************
*** 54,62 ****
  
    def acc_version
!     versions.first
    end
  
    def accession
!     acc_version.split(/\./).first
    end
  
--- 54,62 ----
  
    def acc_version
!     versions.first.to_s
    end
  
    def accession
!     acc_version.split(/\./).first.to_s
    end
  
***************
*** 92,95 ****
--- 92,96 ----
      unless @data['SOURCE']
        name, org = get('SOURCE').split('ORGANISM')
+       org ||= ""
        if org[/\S+;/]
          organism = $`
***************
*** 137,141 ****
              authors = truncate(tag_cut(field))
              authors = authors.split(/, /)
!             authors[-1] = authors[-1].split(/\s+and\s+/)
              authors = authors.flatten.map { |a| a.sub(/,/, ', ') }
              hash['authors']	= authors
--- 138,142 ----
              authors = truncate(tag_cut(field))
              authors = authors.split(/, /)
!             authors[-1] = authors[-1].split(/\s+and\s+/) if authors[-1]
              authors = authors.flatten.map { |a| a.sub(/,/, ', ') }
              hash['authors']	= authors
***************
*** 237,240 ****
--- 238,242 ----
      unless @data['ORIGIN']
        ori, seqstr = get('ORIGIN').split("\n", 2)
+       seqstr ||= ""
        @data['ORIGIN'] = truncate(tag_cut(ori))
        @data['SEQUENCE'] = seqstr.tr("0-9 \t\n\r\/", '')



More information about the bioruby-cvs mailing list