3 # Copyright (C) 2007-2012 Martin A. Hansen.
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 # http://www.gnu.org/copyleft/gpl.html
21 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
23 # This program is part of the Biopieces framework (www.biopieces.org).
25 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
27 # Determine the frequencies for k-mers in sequences in the stream.
29 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
32 require 'maasha/biopieces'
35 codons_start = "ATG,GTG,AUG,GUG"
36 codons_stop = "TAA,TGA,TAG,UAA,UGA,UAG"
39 casts << {:long=>'start_codons', :short=>'s', :type=>'list', :mandatory=>true, :default=>codons_start, :allowed=>nil, :disallowed=>nil}
40 casts << {:long=>'stop_codons', :short=>'S', :type=>'list', :mandatory=>true, :default=>codons_stop, :allowed=>nil, :disallowed=>nil}
41 casts << {:long=>'min_size', :short=>'m', :type=>'uint', :mandatory=>true, :default=>50, :allowed=>nil, :disallowed=>'0'}
42 casts << {:long=>'max_size', :short=>'M', :type=>'uint', :mandatory=>true, :default=>10_000, :allowed=>nil, :disallowed=>'0'}
43 casts << {:long=>'non_redundant', :short=>'n', :type=>'flag', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>'0'}
45 options = Biopieces.options_parse(ARGV, casts)
47 Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
48 input.each_record do |record|
52 entry = Seq.new_bp(record)
54 entry.each_orf(options[:min_size], options[:max_size], options[:start_codons], options[:stop_codons], options[:non_redundant]) do |orf, orf_beg, orf_end|
56 new_record[:REC_TYPE] = "ORF"
57 new_record.merge!(orf.to_bp)
58 new_record[:S_BEG] = orf_beg
59 new_record[:S_END] = orf_end
61 output.puts new_record
68 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<