Top Level Namespace

Defined Under Namespace

Modules: Bio

Instance Method Summary collapse

Instance Method Details

#process(string) ⇒ Object



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'bin/biohello.rb', line 118

def process(string)
  if $opts[:decode]
    puts $hello.decode(string)
  else # default incl. $opts[:encode]
    puts $hello.encode(string)
  end
  if $opts[:helix]
    puts
    puts $hello.helix(string)
  end
  if $opts[:code]
    puts
    puts %Q[% ruby -rubygems -r bio -e 'p Bio::Sequence::NA.new("#{$hello.na}").translate']
    puts %Q[ ==> "#{$hello.aa}"]
    puts
  end
end

#show_usageObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'bin/biohello.rb', line 52

def show_usage
  prog  = File.basename($0)
  usage = %Q[
Usage:
    % #{prog} \[options...\] string
    % #{prog} \[options...\] file

Options:
    -e or --encode
       Encode the given string or file contents as a DNA sequence. (default)
    -d or --decode
       Decode a DNA encoded string.
    -x or --helix
       Show a DNA double strand helix in ASCII art.
    -c or --code
       Show the BioRuby code snippet.
    -h or --help
       Print this help message.

Examples:
    % #{prog} file
    % #{prog} -e file
    % #{prog} -d file

    % #{prog} "BioRuby is fun"
    % #{prog} -e "BIORUBY*IS*FUN"
    % #{prog} -d "nacatatagagatganactattaaataagttaattttgaaat"

    % #{prog} -x "I love you"
    % #{prog} -x -e "I*LOVE*YOU"
    % #{prog} -x -d "atataattataggtagaataatattagtga"

    % #{prog} -c "A happy new year"
    % #{prog} -c -e "A*HAPPY*NEW*YEAR"
    % #{prog} -c -d "gcataacatgcacctccttattaaaatgaatggtaatatgaagcaaga"

]
  puts usage
  exit
end