aboutsummaryrefslogtreecommitdiff
path: root/tools/kallisto-quant.nix
diff options
context:
space:
mode:
authorl-d-s <distefano.l@wehi.edu.au>2018-11-13 09:10:23 +1100
committerl-d-s <distefano.l@wehi.edu.au>2018-11-13 09:10:23 +1100
commit2c92dd5c6425c67a18ab07eba7f15c07dbd4614a (patch)
tree46be9656b500e38bd4aa47066ce8296a127dd5bf /tools/kallisto-quant.nix
parent886af7beaaa98ac32db88a7453d917409cf11ae8 (diff)
parent4574deb8e1649eaf63df424585d11645c7cfa7dd (diff)
Merge branch 'master' of https://github.com/PapenfussLab/bionix
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}
+ '';
+}