diff options
author | Justin Bedo <cu@cua0.org> | 2019-07-02 16:02:54 +1000 |
---|---|---|
committer | Justin Bedo <cu@cua0.org> | 2019-09-06 10:14:26 +1000 |
commit | f361afeab23a4e7b74e0f58bb64b142f6bc3652b (patch) | |
tree | 7125ad803a9cc89ee6abe08a5dd9dd1d3a6c73ba /tools | |
parent | fbe7543726f4321e3cb11c2fa503c27df14ac8fd (diff) |
CNVkit: split into multiple outputs
cnvkit: restructure out to link to multioutputs
Diffstat (limited to 'tools')
-rw-r--r-- | tools/cnvkit-batch.nix | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/cnvkit-batch.nix b/tools/cnvkit-batch.nix index 5160867..113e0c9 100644 --- a/tools/cnvkit-batch.nix +++ b/tools/cnvkit-batch.nix @@ -23,6 +23,7 @@ assert (all sorted (normals ++ tumours)); stage { name = "cnvkit"; buildInputs = with pkgs; [ python3Packages.cnvkit ]; + outputs = [ "out" ] ++ builtins.genList (x: "out${toString (x + 1)}") (length tumours); buildCommand = '' ln -s ${ref} ref.fa ln -s ${samtools.faidx indexAttrs ref} ref.fa.fai @@ -34,8 +35,19 @@ stage { -p $NIX_BUILD_CORES \ -d $TMPDIR \ ${optionalString (flags != null) flags} + + # Copy individual tumour files mkdir $out - cp *.cn{r,s,n} $out + cnt=1 + for f in ${concatStringsSep " " tumours} ; do + output="out$cnt" + mkdir ''${!output} + for g in $(basename $f)*.{cnr,cnn,cns} ; do + cp $g ''${!output}/sample-''${g#*-} + done + cnt=$((cnt+1)) + ln -s ''${!output} $out/$output + done ''; passthru.multicore = true; } |