aboutsummaryrefslogtreecommitdiff
path: root/tools/kallisto-quant.nix
blob: 9f0ab5712b7c15002876c810df5ecfdeaee93915 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{bionix
, indexFlags ? {}
, bias ? false
, bootstrapSamples ? 0
, seed ? 42
, plaintext ? false
, fusion ? false
, single ? false
, frStranded ? false
, rfStranded ? false
, fragmentLength ? null
, fragmentSD ? null
, ref}:

with bionix;
with lib;

assert (!single || (fragmentLength != null && fragmentSD != null));

inputs:

let
  inherit (bionix.types) matchFiletype';
  isFastQ = matchFiletype' "kallisto-quant" {fq = _: true; gz = isFastQ; };
in

assert (all (x: isFastQ (x.filetype)) inputs);

stage {
  name = "kallisto-quant";
  buildInputs = with pkgs; [ kallisto ];
  buildCommand = ''
    mkdir $out
    kallisto quant \
      -i ${bionix.kallisto.index indexFlags ref} \
      -o $out \
      ${optionalString bias "--bias"} \
      ${optionalString (bootstrapSamples > 0) "-b ${toString bootstrapSamples} --seed=${toString seed}"} \
      ${optionalString plaintext "--plaintext"} \
      ${optionalString fusion "--fusion"} \
      ${optionalString single "--single -l ${toString fragmentLength} -s ${toString fragmentSD}"} \
      ${optionalString frStranded "--fr-stranded"} \
      ${optionalString rfStranded "--rf-stranded"} \
      -t $NIX_BUILD_CORES \
      ${concatStringsSep " " inputs}
  '';
  passthru.multicore = true;
}