Class: Bio::DB::Sam

Inherits:
Object
  • Object
show all
Defined in:
lib/cheripic/variants.rb

Overview

An extension of Bio::DB::Sam object to modify depth method

Instance Method Summary collapse

Instance Method Details

#depth(opts = {}) ⇒ Object

A method to retrieve depth information from bam object

Parameters:

  • opts (Hash) (defaults to: {})

    a hash of following input options b [File] list of positions or regions in BED format l [INT] minQLen q [INT] base quality threshold Q [INT] mapping quality threshold r [chr:from-to] region



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cheripic/variants.rb', line 22

def depth(opts={})
  command = form_opt_string(self.samtools, 'depth', opts)
  # capture returns string output, so careful not to give whole genome or big contigs for depth analysis
  stdout, stderr, status = Open3.capture3(command)
  unless status.success?
    logger.error "resulted in exit code #{status.exitstatus} using #{command}"
    logger.error "stderr output is: #{stderr}"
    raise CheripicError
  end
  # return stdout
  stdout
end