Method: Bio::DB::Sam#initialize

Defined in:
lib/bio/db/sam.rb

#initialize(args) ⇒ Sam

Creates a new Bio::DB::Sam object

  • fasta [String] - the path to the Fasta reference sequence

  • bam [String] - path to bam files

  • samtools [String] - path to alternative installation of samtools

  • bcftools [String] - path to alternative installation of bcftools

  • returns [Bio::DB::Sam] a new Bio::DB::Sam object

Raises:

  • (ArgumentError)


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/bio/db/sam.rb', line 20

def initialize(args)
  @fasta = args[:fasta]
  @bam = args[:bam]
  @bams = nil
  @sam = nil
  @files = nil 
  @cached_regions = nil
  @stats = nil
  @samtools = args[:samtools] || File.join(File.expand_path(File.dirname(__FILE__)),'sam','external','samtools')
  @bcftools = args[:bcftools] || File.join(File.expand_path(File.dirname(__FILE__)),'sam','external','bcftools')

  @files = [@files] if @files.instance_of?(String)
 

  @last_command = nil
  raise ArgumentError, "Need Fasta and at least one BAM or SAM" if not @fasta or not @bam
  raise IOError, "File not found #{@files}" if not files_ok?
  @bams = [@bams] if @bams.instance_of? String

end