aboutsummaryrefslogtreecommitdiff
path: root/tools/kallisto-quant.nix
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2018-11-02 15:35:22 +1100
committerJustin Bedo <cu@cua0.org>2018-11-02 15:40:27 +1100
commitf416c145204765a1566782f0ff384d3f65d6ed35 (patch)
tree0ce95603001956ac9941f95bd4870aa7a06cce28 /tools/kallisto-quant.nix
parentec77e9c3a9c2dc7425ee07474f525dd0a3d01fab (diff)
kallisto: init
Diffstat (limited to 'tools/kallisto-quant.nix')
-rw-r--r--tools/kallisto-quant.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/tools/kallisto-quant.nix b/tools/kallisto-quant.nix
new file mode 100644
index 0000000..c410721
--- /dev/null
+++ b/tools/kallisto-quant.nix
@@ -0,0 +1,48 @@
+{bionix
+, nixpkgs
+, indexFlags ? {}
+, bias ? false
+, bootstrapSamples ? 0
+, seed ? 42
+, plaintext ? false
+, fusion ? false
+, single ? false
+, frStranded ? false
+, rfStranded ? false
+, fragmentLength ? null
+, fragmentSD ? null
+, ref}:
+
+with nixpkgs;
+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);
+
+stdenv.mkDerivation {
+ name = "kallisto-quant";
+ buildInputs = [ 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}
+ '';
+}