]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/find_orfs
refactoring of assemble_pairs
[biopieces.git] / bp_bin / find_orfs
index 868665da2a1305683845171934056ac6f4523f4e..3deb53fbb4996c1a3399c1092df55c3088e3d30b 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 
-# Copyright (C) 2007-2011 Martin A. Hansen.
+# Copyright (C) 2007-2012 Martin A. Hansen.
 
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 require 'maasha/biopieces'
 require 'maasha/seq'
 
+codons_start = "ATG,GTG,AUG,GUG"
+codons_stop  = "TAA,TGA,TAG,UAA,UGA,UAG"
+
 casts = []
-casts << {:long=>'start_codons',  :short=>'s', :type=>'list', :mandatory=>true,  :default=>"AUG,GUG",     :allowed=>nil, :disallowed=>nil}
-casts << {:long=>'stop_codons',   :short=>'S', :type=>'list', :mandatory=>true,  :default=>"UAA,UGA,UAG", :allowed=>nil, :disallowed=>nil}
-casts << {:long=>'min_size',      :short=>'m', :type=>'uint', :mandatory=>true,  :default=>50,            :allowed=>nil, :disallowed=>'0'}
-casts << {:long=>'max_size',      :short=>'M', :type=>'uint', :mandatory=>true,  :default=>10_000,        :allowed=>nil, :disallowed=>'0'}
-casts << {:long=>'non_redundant', :short=>'r', :type=>'flag', :mandatory=>false, :default=>nil,           :allowed=>nil, :disallowed=>'0'}
+casts << {:long=>'start_codons',  :short=>'s', :type=>'list', :mandatory=>true,  :default=>codons_start, :allowed=>nil, :disallowed=>nil}
+casts << {:long=>'stop_codons',   :short=>'S', :type=>'list', :mandatory=>true,  :default=>codons_stop,  :allowed=>nil, :disallowed=>nil}
+casts << {:long=>'min_size',      :short=>'m', :type=>'uint', :mandatory=>true,  :default=>50,           :allowed=>nil, :disallowed=>'0'}
+casts << {:long=>'max_size',      :short=>'M', :type=>'uint', :mandatory=>true,  :default=>10_000,       :allowed=>nil, :disallowed=>'0'}
+casts << {:long=>'non_redundant', :short=>'n', :type=>'flag', :mandatory=>false, :default=>nil,          :allowed=>nil, :disallowed=>'0'}
 
 options = Biopieces.options_parse(ARGV, casts)
 
 Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
   input.each_record do |record|
+    output.puts record
+
     if record[:SEQ]
       entry = Seq.new_bp(record)
 
@@ -55,11 +60,7 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
 
         output.puts new_record
       end
-
-      exit
     end
-
-    output.puts record
   end
 end