Class: CagnutGatk::UnifiedGenotyper
- Inherits:
-
Object
- Object
- CagnutGatk::UnifiedGenotyper
- Extended by:
- Forwardable
- Defined in:
- lib/cagnut_gatk/functions/unified_genotyper.rb
Instance Method Summary collapse
- #cluster_options(previous_job_id = nil) ⇒ Object
- #generate_script ⇒ Object
-
#initialize(opts = {}) ⇒ UnifiedGenotyper
constructor
A new instance of UnifiedGenotyper.
- #modified_java_array ⇒ Object
- #params_combination ⇒ Object
- #run(previous_job_id = nil) ⇒ Object
- #unified_genotyper_options ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ UnifiedGenotyper
Returns a new instance of UnifiedGenotyper.
9 10 11 12 13 14 |
# File 'lib/cagnut_gatk/functions/unified_genotyper.rb', line 9 def initialize opts = {} @order = sprintf '%02i', opts[:order] @input = opts[:input].nil? ? "#{opts[:dirs][:input]}/#{sample_name}_recal.bam" : opts[:input] @output = "#{opts[:dirs][:output]}/#{sample_name}.vcf" @job_name = "#{prefix_name}_snpcal_#{sample_name}" end |
Instance Method Details
#cluster_options(previous_job_id = nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/cagnut_gatk/functions/unified_genotyper.rb', line 23 def previous_job_id = nil core_num = 6 job_mem1 = "adjustWorkingMem 256M #{core_num}" job_mem2 = "adjustWorkingMem 10G #{core_num}" { previous_job_id: previous_job_id, var_env: [core_num], adjust_memory: ["h_stack=#{job_mem1}", "h_vmem=#{job_mem2}"], parallel_env: [core_num], tools: ['gatk', 'unified_genotyper'] } end |
#generate_script ⇒ Object
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 87 |
# File 'lib/cagnut_gatk/functions/unified_genotyper.rb', line 59 def generate_script script_name = "#{@order}_gatk_unified_genotyper" file = File.join jobs_dir, "#{script_name}.sh" 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" #{params_combination['java'].join("\s")} \\ #{params_combination['params'].join(" \\\n ")} \\ #{::Cagnut::JobManage.run_local} EXITSTATUS=$? if [ ! -s "#{@output}.idx" ] then echo "vcf incomplete!" exit 100; fi if [ $EXITSTATUS -ne 0 ];then exit $EXITSTATUS;fi echo "#{script_name} is finished at $(date +%Y%m%d%H%M%S)" >> "#{jobs_dir}/finished_jobs" BASH end File.chmod(0700, file) script_name end |
#modified_java_array ⇒ Object
47 48 49 50 |
# File 'lib/cagnut_gatk/functions/unified_genotyper.rb', line 47 def modified_java_array array = unified_genotyper_params['java'].dup array.unshift(java_path).uniq end |
#params_combination ⇒ Object
52 53 54 55 56 57 |
# File 'lib/cagnut_gatk/functions/unified_genotyper.rb', line 52 def params_combination @params_combination_hash ||= { 'java' => modified_java_array, 'params' => } end |
#run(previous_job_id = nil) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/cagnut_gatk/functions/unified_genotyper.rb', line 16 def run previous_job_id = nil puts "Submitting #{sample_name} Jobs: variant (SNPs, INDELs) -call " script_name = generate_script ::Cagnut::JobManage.submit script_name, @job_name, (previous_job_id) [@job_name, @output] end |
#unified_genotyper_options ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/cagnut_gatk/functions/unified_genotyper.rb', line 36 def array = unified_genotyper_params['params'].dup array << "-T UnifiedGenotyper" array << "-R #{ref_fasta}" array << "-I #{@input}" array << "-o #{@output}" array << "-D #{snpdb}" if snpdb array << "-L #{target}" if target array.uniq end |