[BioRuby-cvs] bioruby/lib/bio/shell access.rb,1.1,1.2

Katayama Toshiaki k at pub.open-bio.org
Mon Nov 28 02:09:36 EST 2005


Update of /home/repository/bioruby/bioruby/lib/bio/shell
In directory pub.open-bio.org:/tmp/cvs-serv9600/bio/shell

Modified Files:
	access.rb 
Log Message:
* fixed to make private methods
* ent method is changed to accept local file also (like seq method).


Index: access.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/access.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** access.rb	28 Nov 2005 02:05:41 -0000	1.1
--- access.rb	28 Nov 2005 07:09:34 -0000	1.2
***************
*** 29,32 ****
--- 29,34 ----
  module Bio::Shell
  
+   private
+ 
    # Obtain a Bio::Sequence::NA (DNA) or a Bio::Sequence::AA (Amino Acid)
    # sequence from
***************
*** 35,74 ****
    #   * ID     -- "embl:BUM"  (entry is retrieved by the OBDA)
    def seq(arg)
      if arg.kind_of?(Bio::Sequence)
!       s = arg
      elsif arg.respond_to?(:gets) or File.exists?(arg)
!       entry = flatauto(arg)
      elsif arg[/:/]
        str = ent(arg)
!       entry = parse(str)
      else
        tmp = arg
      end
  
!     if entry.respond_to?(:seq)
!       tmp = entry.seq
!     elsif entry.respond_to?(:naseq)
!       s = entry.naseq
!     elsif entry.respond_to?(:aaseq)
!       s = entry.aaseq
      end
  
      if tmp and tmp.is_a?(String) and not tmp.empty?
!       s = Bio::Sequence.auto(tmp)
      end
  
!     return s || ""
    end
  
    def ent(arg)
      db, entry_id = arg.to_s.strip.split(/:/)
      
!     if Bio::Shell.find_flat_dir(db)
        entry = flatsearch(db, entry_id)
!     eleif obdadbs.include?(db)
!       entry = obda_get_entry(db, entry_id)
      else
        entry = bget(arg)
      end
      return entry
    end
--- 37,84 ----
    #   * ID     -- "embl:BUM"  (entry is retrieved by the OBDA)
    def seq(arg)
+     seq = ""
+ 
      if arg.kind_of?(Bio::Sequence)
!       seq = arg
      elsif arg.respond_to?(:gets) or File.exists?(arg)
!       ent = flatauto(arg)
      elsif arg[/:/]
        str = ent(arg)
!       ent = flatparse(str)
      else
        tmp = arg
      end
  
!     if ent.respond_to?(:seq)
!       tmp = ent.seq
!     elsif ent.respond_to?(:naseq)
!       seq = ent.naseq
!     elsif ent.respond_to?(:aaseq)
!       seq = ent.aaseq
      end
  
      if tmp and tmp.is_a?(String) and not tmp.empty?
!       seq = Bio::Sequence.auto(tmp)
      end
  
!     return seq
    end
  
    def ent(arg)
+     entry = ""
+ 
      db, entry_id = arg.to_s.strip.split(/:/)
      
!     if arg.respond_to?(:gets) or File.exists?(arg)
!       entry = flatfile(arg)
!     elsif Bio::Shell.find_flat_dir(db)
        entry = flatsearch(db, entry_id)
!     elsif obdadbs.include?(db)
!       entry = obdaentry(db, entry_id)
      else
        entry = bget(arg)
      end
+ 
+     display entry
      return entry
    end



More information about the bioruby-cvs mailing list