aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test-tnpair.nix2
-rw-r--r--tools/cnvkit-batch.nix14
2 files changed, 14 insertions, 2 deletions
diff --git a/test-tnpair.nix b/test-tnpair.nix
index 7fe5750..701748d 100644
--- a/test-tnpair.nix
+++ b/test-tnpair.nix
@@ -51,7 +51,7 @@ let
cnvkitResults = rec {
cnvs = cnvkit.callCNV {} (with tnpairResult.alignments; { normals = [ normal ]; tumours = [ tumour ];});
- plot = cnvkit.scatterPlot {} cnvs;
+ plot = cnvkit.scatterPlot {} cnvs.out1;
};
alignments = {
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;
}