From f416c145204765a1566782f0ff384d3f65d6ed35 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Fri, 2 Nov 2018 15:35:22 +1100 Subject: kallisto: init --- tools/kallisto-quant.nix | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tools/kallisto-quant.nix (limited to 'tools/kallisto-quant.nix') 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} + ''; +} -- cgit v1.2.3