Module: CagnutSamtools::CheckTools

Defined in:
lib/cagnut_samtools/check_tools.rb

Instance Method Summary collapse

Instance Method Details



23
24
25
26
27
28
29
30
31
32
# File 'lib/cagnut_samtools/check_tools.rb', line 23

def check_ref_related file, tool, command
  if File.exist?(file)
    puts "\t#{tool}: Done"
  else
    puts "\t#{tool}: Not Found!"
    puts "\tPlease execute command:"
    puts "\t\t#{command}"
    @check_completed = false
  end
end

#check_samtools(path) ⇒ Object



9
10
11
12
13
# File 'lib/cagnut_samtools/check_tools.rb', line 9

def check_samtools path
  check_tool_ver 'Samtools' do
    `#{path} --version 2>&1| grep samtools | cut -f2 -d ' '` if path
  end
end

#check_samtools_index(ref_path) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/cagnut_samtools/check_tools.rb', line 15

def check_samtools_index ref_path
  puts 'Checking Samtools Reference Index Files...'
  tool = 'Samtools Index'
  file = "#{ref_path}.fai"
  command = "#{@config['tools']['samtools']} faidx #{ref_path}"
  check_ref_related file, tool, command
end

#check_tool(tools_path, refs) ⇒ Object



3
4
5
6
7
# File 'lib/cagnut_samtools/check_tools.rb', line 3

def check_tool tools_path, refs
  super if defined?(super)
  ver = check_samtools tools_path['samtools']
  check_samtools_index refs['ref_fasta'] if !ver.blank?
end