From: martinahansen Date: Tue, 3 May 2011 15:35:52 +0000 (+0000) Subject: polished assemble_seq_idba X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=80a2705e48338bda867c339979d154843cfa2278;p=biopieces.git polished assemble_seq_idba git-svn-id: http://biopieces.googlecode.com/svn/trunk@1361 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/bp_bin/assemble_seq_idba b/bp_bin/assemble_seq_idba index 861e038..812fe5f 100755 --- a/bp_bin/assemble_seq_idba +++ b/bp_bin/assemble_seq_idba @@ -30,9 +30,6 @@ require 'biopieces' require 'fasta' -require 'pp' - -ok_methods = "ublast,usearch,uclust,usearch_uclust" casts = [] casts << {:long=>'name', :short=>'n', :type=>'string', :mandatory=>true, :default=>nil, :allowed=>nil, :disallowed=>nil} @@ -44,7 +41,6 @@ casts << {:long=>'count_min', :short=>'c', :type=>'uint', :mandatory=>false, casts << {:long=>'cover', :short=>'C', :type=>'uint', :mandatory=>false, :default=>0, :allowed=>nil, :disallowed=>nil} casts << {:long=>'pairs_min', :short=>'p', :type=>'uint', :mandatory=>false, :default=>5, :allowed=>nil, :disallowed=>nil} casts << {:long=>'prefix_len', :short=>'P', :type=>'uint', :mandatory=>false, :default=>3, :allowed=>nil, :disallowed=>nil} -casts << {:long=>'no_stream', :short=>'x', :type=>'flag', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil} bp = Biopieces.new @@ -60,25 +56,35 @@ Fasta.open(file_fasta, mode="w") do |fasta_io| end end -output = [options[:directory], options[:name] ].join(File::SEPARATOR) - -commands = [] -commands << "nice -n 19" -commands << "idba" -commands << "--read #{file_fasta}" -commands << "--output #{output}" -commands << "--scaffold" if options[:scaffold] -commands << "--mink #{options[:k_value_min]}" -commands << "--maxk #{options[:k_value_max]}" -commands << "--minCount #{options[:count_min]}" -commands << "--cover #{options[:cover]}" -commands << "--minPairs #{options[:pairs_min]}" -commands << "--prefixLength #{options[:prefix_len]}" -commands << "> /dev/null 2>&1" unless options[:verbose] - -command = commands.join(" ") -system(command) -raise "Command failed: #{command}" unless $?.success? +unless File.size(file_fasta) == 0 + output = [options[:directory], options[:name] ].join(File::SEPARATOR) + + commands = [] + commands << "nice -n 19" + commands << "idba" + commands << "--read #{file_fasta}" + commands << "--output #{output}" + commands << "--scaffold" if options[:scaffold] + commands << "--mink #{options[:k_value_min]}" + commands << "--maxk #{options[:k_value_max]}" + commands << "--minCount #{options[:count_min]}" + commands << "--cover #{options[:cover]}" + commands << "--minPairs #{options[:pairs_min]}" + commands << "--prefixLength #{options[:prefix_len]}" + commands << "> /dev/null 2>&1" unless options[:verbose] + + command = commands.join(" ") + system(command) + raise "Command failed: #{command}" unless $?.success? + + file_contig = [options[:directory], options[:name] ].join(File::SEPARATOR) + "-contig.fa" + + Fasta.open(file_contig, mode="r") do |fasta_io| + fasta_io.each do |entry| + bp.puts entry.to_bp + end + end +end # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<