lib/generators/templates/blast.rb in quorum-0.5.2 vs lib/generators/templates/blast.rb in quorum-0.6.0

- old
+ new

@@ -103,11 +103,11 @@ @job_association = "quorum_#{@algorithm}_job".to_sym @job_report_association = "quorum_#{@algorithm}_job_reports".to_sym @filter = @job.method(@job_association).call.filter @expectation = @job.method(@job_association).call.expectation - @max_score = @job.method(@job_association).call.max_score + @max_target_seqs = @job.method(@job_association).call.max_target_seqs @min_score = @job.method(@job_association).call.min_bit_score @gapped_alignments = @job.method(@job_association).call.gapped_alignments @gap_opening_penalty = @job.method(@job_association).call.gap_opening_penalty @gap_extension_penalty = @job.method(@job_association).call.gap_extension_penalty @@ -134,19 +134,21 @@ "-db \"#{@db}\" " << "-query #{@na_fasta} " << "-outfmt 5 " << "-num_threads #{@threads} " << "-evalue #{@expectation} " << - "-max_target_seqs #{@max_score} " << + "-max_target_seqs #{@max_target_seqs} " << "-out #{@out} " if @gapped_alignments - blastn << "-gapopen #{@gap_opening_penalty} " - blastn << "-gapextend #{@gap_extension_penalty} " + if @gap_opening_penalty && @gap_extension_penalty + blastn << "-gapopen #{@gap_opening_penalty} " + blastn << "-gapextend #{@gap_extension_penalty} " + end else blastn << "-ungapped " end - blastn << "-dust yes " if @filter + blastn << "-dust #{@filter ? 'yes' : 'no'} " blastn end # # Blastx command @@ -156,19 +158,21 @@ "-db \"#{@db}\" " << "-query #{@na_fasta} " << "-outfmt 5 " << "-num_threads #{@threads} " << "-evalue #{@expectation} " << - "-max_target_seqs #{@max_score} " << + "-max_target_seqs #{@max_target_seqs} " << "-out #{@out} " if @gapped_alignments - blastx << "-gapopen #{@gap_opening_penalty} " - blastx << "-gapextend #{@gap_extension_penalty} " + if @gap_opening_penalty && @gap_extension_penalty + blastx << "-gapopen #{@gap_opening_penalty} " + blastx << "-gapextend #{@gap_extension_penalty} " + end else blastx << "-ungapped " end - blastx << "-seg yes " if @filter + blastx << "-seg #{@filter ? 'yes' : 'no'} " blastx end # # Tblastn command @@ -178,21 +182,23 @@ "-db \"#{@db}\" " << "-query #{@aa_fasta} " << "-outfmt 5 " << "-num_threads #{@threads} " << "-evalue #{@expectation} " << - "-max_target_seqs #{@max_score} " << + "-max_target_seqs #{@max_target_seqs} " << "-out #{@out} " if @gapped_alignments - tblastn << "-gapopen #{@gap_opening_penalty} " - tblastn << "-gapextend #{@gap_extension_penalty} " + if @gap_opening_penalty && @gap_extension_penalty + tblastn << "-gapopen #{@gap_opening_penalty} " + tblastn << "-gapextend #{@gap_extension_penalty} " + end tblastn << "-comp_based_stats D " else tblastn << "-ungapped " tblastn << "-comp_based_stats F " end - tblastn << "-seg yes " if @filter + tblastn << "-seg #{@filter ? 'yes' : 'no'} " tblastn end # # Blastp command @@ -202,21 +208,23 @@ "-db \"#{@db}\" " << "-query #{@aa_fasta} " << "-outfmt 5 " << "-num_threads #{@threads} " << "-evalue #{@expectation} " << - "-max_target_seqs #{@max_score} " << + "-max_target_seqs #{@max_target_seqs} " << "-out #{@out} " if @gapped_alignments - blastp << "-gapopen #{@gap_opening_penalty} " - blastp << "-gapextend #{@gap_extension_penalty} " + if @gap_opening_penalty && @gap_extension_penalty + blastp << "-gapopen #{@gap_opening_penalty} " + blastp << "-gapextend #{@gap_extension_penalty} " + end blastp << "-comp_based_stats D " else blastp << "-ungapped " blastp << "-comp_based_stats F " end - blastp << "-seg yes " if @filter + blastp << "-seg #{@filter ? 'yes' : 'no'} " blastp end # # Generate Blast Command @@ -275,23 +283,21 @@ # defined minimum score. # # Set the attribute results to true for downstream processes. # def save_hsp_results - if @data[:bit_score] && (@data[:bit_score].to_i > @min_score.to_i) - @data[:results] = true - @data["#{@algorithm}_job_id".to_sym] = @job.method(@job_association).call.job_id + @data[:results] = true + @data["#{@algorithm}_job_id".to_sym] = @job.method(@job_association).call.job_id - job_report = @job.method(@job_report_association).call.build(@data) + job_report = @job.method(@job_report_association).call.build(@data) - unless job_report.save! - @logger.log( - "ActiveRecord", - "Unable to save #{@algorithm} results to database.", - 1, - @tmp_files - ) - end + unless job_report.save! + @logger.log( + "ActiveRecord", + "Unable to save #{@algorithm} results to database.", + 1, + @tmp_files + ) end end # # Save empty Blast Job Report