Module: CagnutBwa::CheckTools

Defined in:
lib/cagnut_bwa/check_tools.rb

Instance Method Summary collapse

Instance Method Details

#check_bwa(path, ref_path) ⇒ Object



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

def check_bwa path, ref_path
  check_tool_ver 'BWA' do
    `#{path} 2>&1 | grep Version | cut -f2 -d ' '` if path
  end
end

#check_bwa_index(tool_path, ref_path) ⇒ Object



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

def check_bwa_index tool_path, ref_path
  tool = 'Bwa Index'
  file = "#{ref_path}.ann"
  command = "#{tool_path} index #{ref_path}"
  check_ref_related file, tool, command
end


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

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_tool(tools_path, refs = nil) ⇒ Object



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

def check_tool tools_path, refs=nil
  super if defined?(super)
  ver = check_bwa tools_path['bwa'], refs['ref_fasta']
  check_bwa_index tools_path['bwa'], refs['ref_fasta'] if !ver.blank?
end