casts = []
casts << {:long=>'directory', :short=>'d', :type=>'dir', :mandatory=>true, :default=>nil, :allowed=>nil, :disallowed=>nil}
casts << {:long=>'scaffold', :short=>'s', :type=>'flag', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
+casts << {:long=>'metagenome', :short=>'m', :type=>'flag', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
casts << {:long=>'kmer_min', :short=>'k', :type=>'uint', :mandatory=>false, :default=>25, :allowed=>nil, :disallowed=>nil}
casts << {:long=>'kmer_max', :short=>'K', :type=>'uint', :mandatory=>false, :default=>50, :allowed=>nil, :disallowed=>nil}
casts << {:long=>'count_min', :short=>'c', :type=>'uint', :mandatory=>false, :default=>2, :allowed=>nil, :disallowed=>nil}
Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
Fasta.open(file_fasta, mode="w") do |fasta_io|
input.each_record do |record|
- if options[:scaffold] # we need to fix the sequence name for mate-pair IDBA
- if record[:SEQ_NAME] =~ /1$/
- record[:SEQ_NAME] = "read#{count}/1"
- else
- record[:SEQ_NAME] = "read#{count}/2"
+ if record[:SEQ_NAME] and record[:SEQ]
+ seq = Seq.new_bp(record)
- count += 1
+ if options[:scaffold] # we need to fix the sequence name for mate-pair IDBA
+ if seq.seq_name =~ /1$/
+ seq.seq_name = "read#{count}/1"
+ else
+ seq.seq_name = "read#{count}/2"
+
+ count += 1
+ end
end
- end
- fasta_io.puts record
+ fasta_io.puts seq.to_fasta
+ end
end
end
commands = []
commands << "nice -n 19"
- commands << "idba"
+
+ if options[:metagenome]
+ commands << "metaidba"
+ else
+ commands << "idba"
+ end
+
commands << "--read #{file_fasta}"
commands << "--output #{prefix}"
commands << "--scaffold" if options[:scaffold]