class CagnutPipelineDraw::Pipeline::Alignment

Attributes

bwa[RW]
picard[RW]
samtools[RW]
toolbox[RW]

Public Class Methods

new() click to toggle source
# File lib/cagnut_pipeline_draw/pipeline/alignment.rb, line 6
def initialize
  @config = Cagnut::Configuration.config
  @bwa = ::CagnutBwa::Util.new @config
  @samtools = ::CagnutSamtools::Util.new
  @picard = ::CagnutPicard::Util.new @config
  @toolbox = ::CagnutToolbox::Util.new @config
end

Public Instance Methods

run(order=1) click to toggle source
# File lib/cagnut_pipeline_draw/pipeline/alignment.rb, line 14
def run order=1
  case @config['data_type']
  when 'BAM'
    puts 'Merging the following bam files'
    bam_dir = @config['bam_dir']
    puts Dir.entries(bam_dir).select { |f| !File.directory? f }
    @samtools.merge_bam samtools_merge_bam_dirs, order
  when 'ONEFASTQ', 'ONEFASTQSE'
    job_name, order = @bwa.aln_one_fastq bwa_aln_dirs, order
    job_name, filename, order = @bwa.samp_one_fastq bwa_samp_dirs, order, job_name
    job_name, filename, order = @picard.add_or_replace_readgroups picard_add_read_group_dirs, order, job_name, filename
    @samtools.mg_bam_soft_link samtools_mg_bam_soft_link_dirs, order, job_name, filename
  else
    job_name, filename, order = @toolbox.qseq2fastq toolbox_qseq2fastq_dirs, order
    job_name, order = @bwa.aln bwa_aln_dirs, order, job_name, filename
    job_name, filename, order = @bwa.samp bwa_samp_dirs, order, job_name, filename
    job_name, filename, order = @picard.add_or_replace_readgroups picard_add_read_group_dirs, order, job_name, filename
    @samtools.merge_bam samtools_merge_bam_dirs, order, job_name, filename
  end
end

Private Instance Methods

bwa_aln_dirs() click to toggle source
# File lib/cagnut_pipeline_draw/pipeline/alignment.rb, line 50
def bwa_aln_dirs
  {
    output: @config['sample']['sai']
  }
end
bwa_samp_dirs() click to toggle source
# File lib/cagnut_pipeline_draw/pipeline/alignment.rb, line 43
def bwa_samp_dirs
  {
    input: @config['sample']['sai'],
    output: @config['sample']['sam']
  }
end
picard_add_read_group_dirs() click to toggle source
# File lib/cagnut_pipeline_draw/pipeline/alignment.rb, line 63
def picard_add_read_group_dirs
  {
    input: @config['sample']['sam'],
    output: @config['sample']['bam'],
    tmp_dir: @config['sample']['tmp']
  }
end
samtools_merge_bam_dirs() click to toggle source
# File lib/cagnut_pipeline_draw/pipeline/alignment.rb, line 71
def samtools_merge_bam_dirs
  {
    input: @config['sample']['sam'],
    output: @config['sample']['bam']
  }
end
toolbox_qseq2fastq_dirs() click to toggle source
# File lib/cagnut_pipeline_draw/pipeline/alignment.rb, line 37
def toolbox_qseq2fastq_dirs
  {
    output: @config['sample']['fastq']
  }
end