Class: CagnutPipelineDraw::Pipeline::Alignment

Inherits:
Object
  • Object
show all
Defined in:
lib/cagnut_pipeline_draw/pipeline/alignment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAlignment

Returns a new instance of Alignment.



6
7
8
9
10
11
12
# 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

Instance Attribute Details

#bwaObject

Returns the value of attribute bwa.



4
5
6
# File 'lib/cagnut_pipeline_draw/pipeline/alignment.rb', line 4

def bwa
  @bwa
end

#picardObject

Returns the value of attribute picard.



4
5
6
# File 'lib/cagnut_pipeline_draw/pipeline/alignment.rb', line 4

def picard
  @picard
end

#samtoolsObject

Returns the value of attribute samtools.



4
5
6
# File 'lib/cagnut_pipeline_draw/pipeline/alignment.rb', line 4

def samtools
  @samtools
end

#toolboxObject

Returns the value of attribute toolbox.



4
5
6
# File 'lib/cagnut_pipeline_draw/pipeline/alignment.rb', line 4

def toolbox
  @toolbox
end

Instance Method Details

#run(order = 1) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 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