From 11b31bdad648c9af92ac6997303bc10849a7a2ef Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Thu, 2 May 2019 12:17:24 +1000 Subject: shard: Implement some basic sharding for FQ files --- default.nix | 5 ++++- test-tnpair.nix | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/default.nix b/default.nix index d67f2eb..61f2974 100644 --- a/default.nix +++ b/default.nix @@ -68,9 +68,12 @@ let fetchFastQGZ = attrs: with types; tagFiletype (filetype.gz (filetype.fq {})) (fetchurl attrs); fetchFastAGZ = attrs: with types; tagFiletype (filetype.gz (filetype.fa {})) (fetchurl attrs); + # Turn a multi-output derivation into a list of derivations + outputDrvs = drv: map (o: lib.getAttr o drv) drv.outputs; + # Export nixpkgs and standard library lib pkgs = nixpkgs; - lib = nixpkgs.lib // { types = types; }; + lib = nixpkgs.lib // { types = types; shard = callBionix ./lib/shard.nix {};}; stage = x@{ name, ... }: { multicore = false; } // nixpkgs.stdenvNoCC.mkDerivation (x // {name = "bionix-" + name;}); # splitting/joining diff --git a/test-tnpair.nix b/test-tnpair.nix index f2e84ac..802a2bb 100644 --- a/test-tnpair.nix +++ b/test-tnpair.nix @@ -39,6 +39,10 @@ let variants = callVariants alignments; glvariants = strelka.call {} (builtins.attrValues alignments); platypusVars = platypus.call {} (builtins.attrValues alignments); + shards = pipe [ + (shard.fastQPair 2) + (map (bwa.align {inherit ref;})) + ] normal.files; }; tnpairResult = processPair tnpair; @@ -56,6 +60,7 @@ let (ln (gridss.callVariants {} (with tnpairResult.alignments; [normal tumour])) "gridss") (ln (gridss.call (with tnpairResult.alignments; [normal tumour])) "gridss2") (ln (gridss.callAndAssemble (with tnpairResult.alignments; [normal tumour])) "gridss3") + (ln (samtools.merge {} tnpairResult.shards) "alignments/merged-shards.bam") (ln (samtools.merge {} [tnpairResult.alignments.tumour tnpairResult.alignments.normal]) "alignments/merged.bam") (ln (samtools.merge {} [(nameSort tnpairResult.alignments.tumour) (nameSort tnpairResult.alignments.normal)]) "alignments/merged-namesorted.bam") (ln (samtools.view { outfmt = types.toCram; } (tnpairResult.alignments.tumour)) "alignments/${tnpair.tumour.name}.cram") -- cgit v1.2.3