class CagnutGatk::CountRead
Public Class Methods
new(opts = {})
click to toggle source
# File lib/cagnut_gatk/functions/count_read.rb, line 9 def initialize opts = {} @order = sprintf '%02i', opts[:order] @target = opts[:target] @suffix = @target.nil? ? 'genome.readct' : 'target.readct' @input = opts[:input].nil? ? "#{opts[:dirs][:input]}/#{sample_name}_markdup.bam" : opts[:input] @output = "#{opts[:dirs][:output]}/#{sample_name}_markdup_#{@suffix}" @job_name = "#{prefix_name}_countRead_#{sample_name}_#{@suffix}" end
Public Instance Methods
cluster_options(previous_job_id = nil)
click to toggle source
# File lib/cagnut_gatk/functions/count_read.rb, line 25 def cluster_options previous_job_id = nil { previous_job_id: previous_job_id, var_env: [ref_fasta], adjust_memory: ['h_vmem=5G'], tools: ['gatk', 'count_reads'] } end
count_reads_options()
click to toggle source
# File lib/cagnut_gatk/functions/count_read.rb, line 46 def count_reads_options array = count_reads_params['params'].dup array << "-T CountReads" array << "-R #{ref_fasta}" array << "-I #{@input} > #{@output}" array << "-L #{@target}" if @target array.uniq end
generate_script()
click to toggle source
# File lib/cagnut_gatk/functions/count_read.rb, line 34 def generate_script script_name = "#{@order}_gatk_count_reads_#{@suffix}" file = File.join jobs_dir, "#{script_name}.sh" path = File.expand_path '../templates/count_read.sh', __FILE__ template = Tilt.new path File.open(file, 'w') do |f| f.puts template.render Object.new, job_params(script_name) end File.chmod(0700, file) script_name end
job_params(script_name)
click to toggle source
# File lib/cagnut_gatk/functions/count_read.rb, line 67 def job_params script_name { jobs_dir: jobs_dir, script_name: script_name, output: @output, count_reads_params: params_combination, run_local: ::Cagnut::JobManage.run_local } end
modified_java_array()
click to toggle source
# File lib/cagnut_gatk/functions/count_read.rb, line 55 def modified_java_array array = count_reads_params['java'].dup array.unshift(java_path).uniq end
params_combination()
click to toggle source
# File lib/cagnut_gatk/functions/count_read.rb, line 60 def params_combination { 'java' => modified_java_array, 'params' => count_reads_options } end
run(previous_job_id = nil)
click to toggle source
# File lib/cagnut_gatk/functions/count_read.rb, line 18 def run previous_job_id = nil puts "Submitting countRead #{@suffix}" script_name = generate_script ::Cagnut::JobManage.submit script_name, @job_name, cluster_options(previous_job_id) @job_name end