@outfile = outfile
@options = options
@command = []
+
+ raise UsearchError, %{Empty input file -> "#{@infile}"} if File.size(@infile) == 0
end
# Method that calls Usearch sorting for sorting a FASTA file
def usearch
@command << "usearch --query #{@infile} --db #{@options[:database]} --userout #{@outfile}"
@command << "--userfields target+tloz+thiz+query+bits+strand"
- @command << "--id #{@options[:identity]}" if @options.has_key? :identity
- @command << "--evalue #{@options[:e_val]}" if @options.has_key? :e_val
+ @command << "--id #{@options[:identity]}" if @options[:identity]
+ @command << "--evalue #{@options[:e_val]}" if @options[:e_val]
@command << "--rev"
execute
end
- # Method to execute ustar alignment.
- def ustar
- @command << %Q{grep "^[SH]" #{@outfile} > #{@outfile}.sub}
+ # Method to execute uchime chimera detection.
+ def uchime
+ @command << "usearch --uchime #{@infile} --db #{@options[:database]} --uchimeout #{@outfile}"
execute
+ end
+
+ # Method to execute ustar alignment.
+ def ustar
+ command = %Q{grep "^[SH]" #{@outfile} > #{@outfile}.sub}
+ system(command)
+ raise "Command failed: #{command}" unless $?.success?
File.rename "#{@outfile}.sub", @outfile
entries << entry
end
end
+
+ yield Align.new(entries) unless entries.empty?
end
end
# The command is composed of bits from the @command variable.
def execute
@command.unshift "nice -n 19"
- @command << "> /dev/null 2>&1" unless @options[:verbose]
+ @command << "--quiet" unless @options[:verbose]
command = @command.join(" ")
+ $stderr.puts "Running command: #{command}" if @options[:verbose]
system(command)
raise "Command failed: #{command}" unless $?.success?