+ # Method to execute database global search.
+ def usearch_global
+ # usearch -usearch_global query.fasta -db proteins.udb -id 0.8 -alnout results.aln
+ # usearch -usearch_global query.fasta -db ESTs.fasta -id 0.9 -blast6out results.m8 -strand plus -maxaccepts 8 -maxrejects 256
+
+ @command << "usearch"
+ @command << "-usearch_global #{@infile}"
+ @command << "-db #{@options[:database]}"
+ @command << "-blast6out #{@outfile}"
+ @command << "-strand both"
+ @command << "-id #{@options[:identity]}"
+ @command << "-evalue #{@options[:e_val]}" if @options[:e_val]
+ @command << "-maxaccepts #{@options[:maxaccepts]}"
+ @command << "-threads #{@options[:cpus]}"
+
+ execute
+ end
+
+ # 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
+
+ @command << "usearch --uc2fastax #{@outfile} --input #{@infile} --output #{@infile}.sub"
+
+ execute
+
+ @command << "usearch --staralign #{@infile}.sub --output #{@outfile}"
+
+ execute
+
+ File.delete "#{@infile}.sub"