lib/generators/templates/blast.rb in quorum-0.3.0 vs lib/generators/templates/blast.rb in quorum-0.3.1

- old
+ new

@@ -11,13 +11,13 @@ class Blast class QuorumJob < ActiveRecord::Base self.table_name = "quorum_jobs" - has_one :quorum_blastn_job, + has_one :quorum_blastn_job, :foreign_key => "job_id" - has_many :quorum_blastn_job_reports, + has_many :quorum_blastn_job_reports, :foreign_key => "blastn_job_id" has_one :quorum_blastx_job, :foreign_key => "job_id" has_many :quorum_blastx_job_reports, @@ -215,11 +215,11 @@ @na_fasta = File.join(@tmp, @hash + ".na.fa") @aa_fasta = File.join(@tmp, @hash + ".aa.fa") File.open(@na_fasta, "w") { |f| f << @na_sequence } File.open(@aa_fasta, "w") { |f| f << @aa_sequence } - @out = File.join(@tmp, @hash + ".out.xml") + @out = File.join(@tmp, @hash + ".out.xml") File.new(@out, "w") case @algorithm when "blastn" @cmd << generate_blastn_cmd @@ -239,11 +239,11 @@ evalue = evalue.to_s e = evalue.slice!(/e.*/) unless e.nil? e = " x 10<sup>" << e.sub(/e/, '') << "</sup>" end - evalue.to_f.round(1).to_s << e.to_s + evalue.to_f.round(1).to_s << e.to_s end # # Format Blast report hit_display_id and hit_def. # @@ -267,11 +267,11 @@ return hit_display_id, hit_def end # # Parse and save Blast results using bio-blastxmlparser. - # Only save Blast results if results.bit_score > @min_score. + # Only save Blast results if results.bit_score > @min_score. # def parse_and_save_results # Helper to avoid having to perform a query. saved = false @@ -309,11 +309,11 @@ @data[:hseq] = hsp.hseq @data[:midline] = hsp.midline # Hsps are only reported if a query hit against the Blast db. # Only save the @data if bit_score exists. - if @data[:bit_score] && + 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 saved = true # Build a new report for each Hsp. @@ -408,10 +408,10 @@ # # Execute Blast on a given dataset. # def execute_blast - generate_blast_cmd + generate_blast_cmd @logger.log("NCBI Blast", @cmd) system(@cmd) parse_and_save_results add_hps_groups_to_reports remove_tmp_files