[BioRuby-cvs] bioruby/lib/bio/shell/plugin codon.rb, 1.8, 1.9 entry.rb, 1.3, 1.4

Katayama Toshiaki k at pub.open-bio.org
Wed Dec 7 00:12:09 EST 2005


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

Modified Files:
	codon.rb entry.rb 
Log Message:
* lib/bioruby.rb is added for easy bioruby script startup after the discussion
  with Tanka-san (.bioruby/script.rb will use this)
* access.rb plugin is moved under the plugin directory as a entry.rb
* Core is changed to Ghost :)


Index: codon.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/codon.rb,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** codon.rb	28 Nov 2005 12:07:42 -0000	1.8
--- codon.rb	7 Dec 2005 05:12:07 -0000	1.9
***************
*** 31,47 ****
    class ColoredCodonTable
  
-     Color = Bio::Shell::Core::ESC_SEQ
- 
-     @@colors = {
-       :text		=> Color[:none],
-       :aa		=> Color[:green],
-       :start		=> Color[:red],
-       :stop		=> Color[:red],
-       :basic		=> Color[:cyan],
-       :polar		=> Color[:blue],
-       :acidic		=> Color[:magenta],
-       :nonpolar		=> Color[:yellow],
-     }
- 
      @@properties = {
        :basic => %w( H K R ),
--- 31,34 ----
***************
*** 58,61 ****
--- 45,49 ----
        @cuhash = cuhash
        if Bio::Shell.config[:color]
+         setup_colors
          generate_colored_text
        else
***************
*** 65,68 ****
--- 53,71 ----
      attr_reader :table
  
+     def setup_colors
+       esc_seq = Bio::Shell.esc_seq
+ 
+       @colors = {
+         :text		=> esc_seq[:none],
+         :aa		=> esc_seq[:green],
+         :start		=> esc_seq[:red],
+         :stop		=> esc_seq[:red],
+         :basic		=> esc_seq[:cyan],
+         :polar		=> esc_seq[:blue],
+         :acidic		=> esc_seq[:magenta],
+         :nonpolar	=> esc_seq[:yellow],
+       }
+     end
+ 
      def generate_mono_text
        @table.each do |codon, aa|
***************
*** 94,116 ****
  
          if aa == '*'
!           color_code = "#{@@colors[:stop]}STOP"
            if @cuhash
!             color_aa = "#{@@colors[:stop]}#{aa}"
            else
              color_aa = ''
            end
          else
!           color_code = "#{@@colors[property]}#{@aacode[aa]}"
            if @table.start_codon?(codon)
              if @cuhash
!               color_aa = "#{@@colors[:aa]}#{aa}"
              else
!               color_aa = "#{@@colors[:start]}#{aa}"
              end
            else
              if @cuhash
!               color_aa = "#{@@colors[property]}#{aa}"
              else
!               color_aa = "#{@@colors[:aa]}#{aa}"
              end
            end
--- 97,119 ----
  
          if aa == '*'
!           color_code = "#{@colors[:stop]}STOP"
            if @cuhash
!             color_aa = "#{@colors[:stop]}#{aa}"
            else
              color_aa = ''
            end
          else
!           color_code = "#{@colors[property]}#{@aacode[aa]}"
            if @table.start_codon?(codon)
              if @cuhash
!               color_aa = "#{@colors[:aa]}#{aa}"
              else
!               color_aa = "#{@colors[:start]}#{aa}"
              end
            else
              if @cuhash
!               color_aa = "#{@colors[property]}#{aa}"
              else
!               color_aa = "#{@colors[:aa]}#{aa}"
              end
            end
***************
*** 119,134 ****
          if @cuhash
            percent = @cuhash[codon].to_s.rjust(6)
!           eval("@#{codon} = '#{color_aa}#{@@colors[:text]}#{percent}'")
          else
!           eval("@#{codon} = ' #{color_code} #{color_aa}#{@@colors[:text]} '")
          end
        end
  
        @hydrophilic = [
!         "#{@@colors[:basic]}basic#{@@colors[:text]},",
!         "#{@@colors[:polar]}polar#{@@colors[:text]},",
!         "#{@@colors[:acidic]}acidic#{@@colors[:text]}"
        ].join(" ")
!       @hydrophobic = "#{@@colors[:nonpolar]}nonpolar"
      end
  
--- 122,137 ----
          if @cuhash
            percent = @cuhash[codon].to_s.rjust(6)
!           eval("@#{codon} = '#{color_aa}#{@colors[:text]}#{percent}'")
          else
!           eval("@#{codon} = ' #{color_code} #{color_aa}#{@colors[:text]} '")
          end
        end
  
        @hydrophilic = [
!         "#{@colors[:basic]}basic#{@colors[:text]},",
!         "#{@colors[:polar]}polar#{@colors[:text]},",
!         "#{@colors[:acidic]}acidic#{@colors[:text]}"
        ].join(" ")
!       @hydrophobic = "#{@colors[:nonpolar]}nonpolar"
      end
  
***************
*** 175,179 ****
          text = header + table
        end
!       text.gsub(/^\s+#/, @@colors[:text])
      end
  
--- 178,182 ----
          text = header + table
        end
!       text.gsub(/^\s+#/, @colors[:text])
      end
  

Index: entry.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/entry.rb,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** entry.rb	28 Nov 2005 12:07:42 -0000	1.3
--- entry.rb	7 Dec 2005 05:12:07 -0000	1.4
***************
*** 1,4 ****
  #
! # = bio/shell/access.rb - database access module
  #
  # Copyright::	Copyright (C) 2005
--- 1,4 ----
  #
! # = bio/shell/plugin/entry.rb - extract entry and sequence
  #
  # Copyright::	Copyright (C) 2005



More information about the bioruby-cvs mailing list