From 32c842e7c5fe1038cec73da3e07ba12df6295549 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Fri, 3 Dec 2021 09:42:04 +1100 Subject: genmap: init --- default.nix | 1 + test-tnpair.nix | 1 + tools/genmap-calcmap.nix | 22 ++++++++++++++++++++++ tools/genmap-index.nix | 16 ++++++++++++++++ tools/genmap.nix | 9 +++++++++ 5 files changed, 49 insertions(+) create mode 100644 tools/genmap-calcmap.nix create mode 100644 tools/genmap-index.nix create mode 100644 tools/genmap.nix diff --git a/default.nix b/default.nix index 59357b2..db5d14f 100644 --- a/default.nix +++ b/default.nix @@ -50,6 +50,7 @@ let lastal = callBionix ./tools/last.nix { }; whisper = callBionix ./tools/whisper.nix { }; star = callBionix ./tools/star.nix { }; + genmap = callBionix ./tools/genmap.nix { }; slurm-run = callPackage ./lib/slurm.nix { }; slurm-exec = f: x: y: diff --git a/test-tnpair.nix b/test-tnpair.nix index 9ba0e51..0960b6f 100644 --- a/test-tnpair.nix +++ b/test-tnpair.nix @@ -95,6 +95,7 @@ let snver = snver.call { ploidy = 1; } tnpairResult.alignments; mosdepth = mosdepth.plot { } { inputs = mapAttrsToList (_: mosdepth.depth { }) tnpairResult.alignments; names = [ "seq1" "seq2" ]; }; xenomapper = xenomapper.allocate { } { primary = nameSort tnpairResult.alignments.tumour; secondary = nameSort tnpairResult.alignments.tumour; }; + genmap = genmap.calcmap { } ref; inherit alignments; }; diff --git a/tools/genmap-calcmap.nix b/tools/genmap-calcmap.nix new file mode 100644 index 0000000..df9ccc3 --- /dev/null +++ b/tools/genmap-calcmap.nix @@ -0,0 +1,22 @@ +{ bionix +, k ? 30 +, e ? 2 +}: + +with bionix; + +ref: stage { + name = "genmap-mappability"; + buildInputs = with pkgs; [ genmap ]; + buildCommand = '' + mkdir $out + genmap map \ + -K ${toString k} \ + -E ${toString e} \ + --wig \ + -I ${bionix.genmap.index {} ref} \ + -O $out \ + -T $NIX_BUILD_CORES + ''; + passthru.multicore = true; +} diff --git a/tools/genmap-index.nix b/tools/genmap-index.nix new file mode 100644 index 0000000..249f061 --- /dev/null +++ b/tools/genmap-index.nix @@ -0,0 +1,16 @@ +{ bionix }: + +with bionix; +with lib.types; + +let + fa = f: matchFiletype "genmap-index" { fa = _: f; } f; +in + +ref: stage { + name = "genmap-index"; + buildInputs = with pkgs; [ genmap ]; + buildCommand = '' + genmap index -F ${fa ref} -I $out + ''; +} diff --git a/tools/genmap.nix b/tools/genmap.nix new file mode 100644 index 0000000..c29d74c --- /dev/null +++ b/tools/genmap.nix @@ -0,0 +1,9 @@ +{ bionix }: + +with bionix; + +{ + index = callBionixE ./genmap-index.nix; + calcmap = callBionixE ./genmap-calcmap.nix; +} + -- cgit v1.2.3