[BioRuby-cvs] bioruby/lib/bio/shell/plugin codon.rb, 1.7, 1.8 flatfile.rb, 1.9, 1.10 keggapi.rb, 1.5, 1.6 obda.rb, 1.6, 1.7 seq.rb, 1.14, 1.15

Katayama Toshiaki k at pub.open-bio.org
Mon Nov 28 07:07:44 EST 2005


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

Modified Files:
	codon.rb flatfile.rb keggapi.rb obda.rb seq.rb 
Log Message:
* display is removed or changed to puts
* removed require


Index: obda.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/obda.rb,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** obda.rb	28 Nov 2005 07:15:30 -0000	1.6
--- obda.rb	28 Nov 2005 12:07:42 -0000	1.7
***************
*** 27,32 ****
  #
  
- require 'bio/io/registry'
- 
  module Bio::Shell
  
--- 27,30 ----
***************
*** 56,60 ****
    def obdadbs
      result = obda.databases.map {|db| db.database}
-     display result
      return result
    end
--- 54,57 ----
***************
*** 63,67 ****
      serv = Bio::Fetch.new("http://www.ebi.ac.uk/cgi-bin/dbfetch")
      result = serv.fetch(db, id, style, format)
-     display result
      return result
    end
--- 60,63 ----

Index: flatfile.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/flatfile.rb,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** flatfile.rb	28 Nov 2005 07:14:37 -0000	1.9
--- flatfile.rb	28 Nov 2005 12:07:42 -0000	1.10
***************
*** 27,32 ****
  #
  
- require 'bio/io/flatfile'
- 
  module Bio::Shell
  
--- 27,30 ----
***************
*** 106,118 ****
        return
      end
      Bio::FlatFileIndex.open(dir) do |db|
        if results = db.include?(keyword)
          results.each do |entry_id|
!           display db.search_primary(entry_id)
          end
        else
!         display "No hits found"
        end
      end
    end
  
--- 104,118 ----
        return
      end
+     entry = ''
      Bio::FlatFileIndex.open(dir) do |db|
        if results = db.include?(keyword)
          results.each do |entry_id|
!           entry << db.search_primary(entry_id)
          end
        else
!         warn "Error: No hits found in #{dbname} (#{keyword})"
        end
      end
+     return entry
    end
  

Index: codon.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/codon.rb,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** codon.rb	28 Nov 2005 07:12:03 -0000	1.7
--- codon.rb	28 Nov 2005 12:07:42 -0000	1.8
***************
*** 27,34 ****
  #
  
- require 'bio/data/codontable'
- require 'bio/data/aa'
- require 'bio/data/na'
- 
  module Bio::Shell
  
--- 27,30 ----
***************
*** 188,193 ****
    def codontable(num = 1, codon_usage = nil)
      cct = ColoredCodonTable.new(num, codon_usage)
!     display cct.output unless codon_usage
!     return cct
    end
  
--- 184,193 ----
    def codontable(num = 1, codon_usage = nil)
      cct = ColoredCodonTable.new(num, codon_usage)
!     if codon_usage
!       return cct
!     else
!       puts cct.output
!       return cct.table
!     end
    end
  

Index: keggapi.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/keggapi.rb,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** keggapi.rb	28 Nov 2005 07:18:14 -0000	1.5
--- keggapi.rb	28 Nov 2005 12:07:42 -0000	1.6
***************
*** 27,36 ****
  #
  
- require 'bio/io/keggapi'
- 
  module Bio::Shell
  
    module Private
!     def keeggapi_definition2tab(list)
        ary = []
        list.each do |entry|
--- 27,34 ----
  #
  
  module Bio::Shell
  
    module Private
!     def keggapi_definition2tab(list)
        ary = []
        list.each do |entry|
***************
*** 54,58 ****
    def binfo(db = "all")
      result = keggapi.binfo(db)
!     display result
      return result
    end
--- 52,56 ----
    def binfo(db = "all")
      result = keggapi.binfo(db)
!     puts result
      return result
    end
***************
*** 60,64 ****
    def bfind(str)
      result = keggapi.bfind(str)
-     display result
      return result
    end
--- 58,61 ----
***************
*** 75,79 ****
    def btit(str)
      result = keggapi.btit(str)
-     display result
      return result
    end
--- 72,75 ----
***************
*** 81,85 ****
    def bconv(str)
      result = keggapi.bconv(str)
-     display result
      return result
    end
--- 77,80 ----
***************
*** 90,95 ****
      list = keggapi.list_databases
      result = Bio::Shell.keggapi_definition2tab(list).join("\n")
!     display result
!     return result
    end
  
--- 85,90 ----
      list = keggapi.list_databases
      result = Bio::Shell.keggapi_definition2tab(list).join("\n")
!     puts result
!     return list.map {|x| x.entry_id}
    end
  
***************
*** 97,102 ****
      list = keggapi.list_organisms
      result = Bio::Shell.keggapi_definition2tab(list).sort.join("\n")
!     display result
!     return result
    end
  
--- 92,97 ----
      list = keggapi.list_organisms
      result = Bio::Shell.keggapi_definition2tab(list).sort.join("\n")
!     puts result
!     return list.map {|x| x.entry_id}
    end
  
***************
*** 104,113 ****
      list = keggapi.list_pathways(org)
      result = Bio::Shell.keggapi_definition2tab(list).join("\n")
!     display result
!     return result
    end
  
! =begin
!   def kegggenome(org)	# *TODO* use das instead?
      result = ""
      require 'net/ftp'
--- 99,107 ----
      list = keggapi.list_pathways(org)
      result = Bio::Shell.keggapi_definition2tab(list).join("\n")
!     puts result
!     return list.map {|x| x.entry_id}
    end
  
!   def kegggenomeseq(org)
      result = ""
      require 'net/ftp'
***************
*** 117,128 ****
        file = list.grep(/.*genome$/).shift
        if file
!         base = File.basename(file)
!         ftp.getbinaryfile(file, base)
!         result = File.read(base)
        end
      end
      return result
    end
- =end
  
  end
--- 111,121 ----
        file = list.grep(/.*genome$/).shift
        if file
!         open("ftp://ftp.genome.jp/#{file}") do |file|
!           result = file.read
!         end
        end
      end
      return result
    end
  
  end

Index: seq.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/seq.rb,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** seq.rb	28 Nov 2005 07:13:55 -0000	1.14
--- seq.rb	28 Nov 2005 12:07:42 -0000	1.15
***************
*** 27,33 ****
  #
  
- require 'bio/sequence'
- require 'bio/util/color_scheme'
- 
  module Bio::Shell
  
--- 27,30 ----
***************
*** 138,142 ****
      end
      rep  << "//\n"
!     display rep
    end
  
--- 135,140 ----
      end
      rep  << "//\n"
!     puts rep
!     return rep
    end
  
***************
*** 146,157 ****
      seq = seq(str)
      if str.length < 16
!       display "Sequence must be longer than 16 bases."
        return
      end
      if ! seq.respond_to?(:complement)
!       display "Sequence must be a DNA sequence."
        return
      end
-     helix = ''
      pairs = [ [5, 0], [4, 2], [3, 3], [2, 4], 
                [1, 4], [0, 3], [0, 2], [1, 0] ]
--- 144,154 ----
      seq = seq(str)
      if str.length < 16
!       warn "Error: Sequence must be longer than 16 bases."
        return
      end
      if ! seq.respond_to?(:complement)
!       warn "Error: Sequence must be a DNA sequence."
        return
      end
      pairs = [ [5, 0], [4, 2], [3, 3], [2, 4], 
                [1, 4], [0, 3], [0, 2], [1, 0] ]
***************
*** 159,170 ****
        pairs.each_with_index do |ij, x|
          base = subseq[x, 1]
!         helix << ' ' * ij[0] + base + '-' * ij[1] + base.complement + "\n"
        end
        pairs.reverse.each_with_index do |ij, x|
          base = subseq[x + 8, 1]
!         helix << ' ' * ij[0] + base.complement + '-' * ij[1] + base + "\n"
        end
      end
-     display helix
    end
  
--- 156,166 ----
        pairs.each_with_index do |ij, x|
          base = subseq[x, 1]
!         puts ' ' * ij[0] + base + '-' * ij[1] + base.complement + "\n"
        end
        pairs.reverse.each_with_index do |ij, x|
          base = subseq[x + 8, 1]
!         puts ' ' * ij[0] + base.complement + '-' * ij[1] + base + "\n"
        end
      end
    end
  



More information about the bioruby-cvs mailing list