Class: CagnutGatk::VariantEval
- Inherits:
-
Object
- Object
- CagnutGatk::VariantEval
- Extended by:
- Forwardable
- Defined in:
- lib/cagnut_gatk/functions/variant_eval.rb
Instance Method Summary collapse
- #cluster_options(previous_job_id = nil) ⇒ Object
- #generate_script ⇒ Object
-
#initialize(opts = {}) ⇒ VariantEval
constructor
A new instance of VariantEval.
- #modified_java_array ⇒ Object
- #params_combination ⇒ Object
- #run(previous_job_id = nil) ⇒ Object
- #variant_eval_options ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ VariantEval
Returns a new instance of VariantEval.
9 10 11 12 13 14 15 |
# File 'lib/cagnut_gatk/functions/variant_eval.rb', line 9 def initialize opts = {} @order = sprintf '%02i', opts[:order] @vcf_dir = opts[:dirs][:output] @input = opts[:input].nil? ? "#{opts[:dirs][:input]}/#{sample_name}_filtered.vcf" : opts[:input] @output = "#{@vcf_dir}/#{sample_name}.eval" @job_name = "#{prefix_name}_snpEval_#{sample_name}" end |
Instance Method Details
#cluster_options(previous_job_id = nil) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/cagnut_gatk/functions/variant_eval.rb', line 25 def previous_job_id = nil { previous_job_id: previous_job_id, adjust_memory: ['h_stack=256M', 'h_vmem=8G'], tools: ['gatk', 'variant_eval'] } end |
#generate_script ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/cagnut_gatk/functions/variant_eval.rb', line 56 def generate_script script_name = "#{@order}_gatk_variant_eval" file = File.join jobs_dir, "#{script_name}.sh" ltag = target.nil? ? '' : "-L #{target}" File.open(file, 'w') do |f| f.puts <<-BASH.strip_heredoc #!/bin/bash cd "#{jobs_dir}/../" echo "#{script_name} is starting at $(date +%Y%m%d%H%M%S)" >> "#{jobs_dir}/finished_jobs" EVALNAME=$(basename #{@vcf_dir}/#{sample_name}) #{params_combination['java'].join("\s")} \\ #{params_combination['params'].join(" \\\n ")} \\ #{::Cagnut::JobManage.run_local} EXITSTATUS=$? if [ ! -s "#{@output}" ] then echo "Missing #{@output}" exit 100 fi echo "#{script_name} is finished at $(date +%Y%m%d%H%M%S)" >> "#{jobs_dir}/finished_jobs" exit $EXITSTATUS BASH end File.chmod(0700, file) script_name end |
#modified_java_array ⇒ Object
44 45 46 47 |
# File 'lib/cagnut_gatk/functions/variant_eval.rb', line 44 def modified_java_array array = variant_eval_params['java'].dup array.unshift(java_path).uniq end |
#params_combination ⇒ Object
49 50 51 52 53 54 |
# File 'lib/cagnut_gatk/functions/variant_eval.rb', line 49 def params_combination @params_combination_hash ||= { 'java' => modified_java_array, 'params' => } end |
#run(previous_job_id = nil) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/cagnut_gatk/functions/variant_eval.rb', line 17 def run previous_job_id = nil return unless snpdb puts "Submitting #{sample_name} Jobs: variant (SNPs, INDELs) -evaluation " script_name = generate_script ::Cagnut::JobManage.submit script_name, @job_name, (previous_job_id) @job_name end |
#variant_eval_options ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/cagnut_gatk/functions/variant_eval.rb', line 33 def array = variant_eval_params['params'].dup array << "-T VariantEval" array << "-R #{ref_fasta}" array << "--dbsnp #{snpdb}" array << "-o #{@output}" array << "--eval:$EVALNAME #{@input}" array << "-L #{target}" if target array.uniq end |