Class: Bio::Kallisto

Inherits:
Object
  • Object
show all
Defined in:
lib/bio-kallisto/kallisto.rb

Class Method Summary collapse

Class Method Details

.index(reference:, output_index: nil, k: 31, unique: false) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/bio-kallisto/kallisto.rb', line 6

def self.index (reference:,  output_index:nil, k:31 , unique: false )

  $stderr.put "reference undefined " unless reference

  output_index = "#{reference}.kallisto.k#{k}" unless output_index

  extra=""
  extra="--make-unique" if unique

  command = "kallisto index --kmer-size=#{k} --index=#{output_index} #{extra} #{reference}"
  status, stdout, stderr = systemu command
  if status.exitstatus != 0
   $stderr.puts "Failed to run wrapping command correctly, as non-zero exit status "+
   "#{status.exitstatus} detected. Command run was `#{command}'"
   return false
 else
    return true
  end
end

.map(index:, fastq:, output_dir:, single: false, bias: false, fragment_length: 0, pseudobam: false, bootstrap_samples: 0, threads: 1, seed: 42) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/bio-kallisto/kallisto.rb', line 26

def self.map(index:, fastq:, output_dir:, single:false, bias:false, fragment_length:0, pseudobam:false, bootstrap_samples:0, threads:1, seed:42)

  extra = ""
  extra += " --single" if single
  extra += " --bias" if bias
  extra += " --fragment-length=#{fragment_length}" if fragment_length > 0
  extra += " --pseudobam" if pseudobam
  extra += " --bootstrap-samples=#{bootstrap-samples}" if bootstrap_samples > 0
  extra += " --threads=#{threads}" if threads > 1
  extra += " --seed=#{seed}" if seed != 42
  command = "kallisto quant --index=#{index} --output-dir=#{output_dir} #{extra} #{fastq.join(' ')}"

  status, stdout, stderr = systemu command
  if status.exitstatus != 0
   $stderr.puts "Failed to run wrapping command correctly, as non-zero exit status "+
      "#{status.exitstatus} detected. Command run was `#{command}'"
   return false
 else
    return true
  end

end