aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--default.nix14
-rw-r--r--test-tnpair.nix36
2 files changed, 29 insertions, 21 deletions
diff --git a/default.nix b/default.nix
index 84bb3c8..1e647dd 100644
--- a/default.nix
+++ b/default.nix
@@ -37,6 +37,20 @@ let
def = f: defs: attrs: f (defs // attrs);
pipe = let g = fs: with builtins; let h = head fs; t = tail fs; in if t != [] then x: (g t (h x)) else h; in g;
+ link = {src, dst}: ''
+ d=$(dirname ${dst})
+ if [ ! -e $out/$d ] ; then
+ mkdir -p $out/$d
+ fi
+ ln -s ${src} $out/${dst}
+ '';
+ mkLinks = nixpkgs.lib.concatMapStringsSep "\n" link;
+ linkDrv = x: nixpkgs.stdenvNoCC.mkDerivation {
+ name = "link";
+ buildCommand = mkLinks x;
+ };
+ ln = x: y: { src = x; dst = y; };
+
# Fetching files of specific type
fetchFastQ = attrs: with types; tagFiletype (filetype.fq {}) (fetchurl attrs);
fetchFastA = attrs: with types; tagFiletype (filetype.fa {}) (fetchurl attrs);
diff --git a/test-tnpair.nix b/test-tnpair.nix
index b01d61e..b897366 100644
--- a/test-tnpair.nix
+++ b/test-tnpair.nix
@@ -49,26 +49,20 @@ let
tnpairResult = processPair tnpair;
- testNaming = stdenv.mkDerivation {
- name = "test-naming";
- buildCommand = ''
- mkdir $out
- ln -s ${tnpairResult.variants} $out/strelka
- mkdir $out/alignments
- ln -s ${bowtie.align {inherit ref;} tnpair.normal.files} $out/alignments/bowtie-normal.bam
- ln -s ${gridss.callVariants {} (with tnpairResult.alignments; [normal tumour])} $out/gridss
- ln -s ${gridss.call (with tnpairResult.alignments; [normal tumour])} $out/gridss2
- ln -s ${samtools.merge {} [tnpairResult.alignments.tumour tnpairResult.alignments.normal]} $out/alignments/merged.bam
- ln -s ${samtools.view { outfmt = types.toCram; } (tnpairResult.alignments.tumour)} $out/alignments/${tnpair.tumour.name}.cram
- ln -s ${samtools.view { outfmt = types.toCram; } (tnpairResult.alignments.normal)} $out/alignments/${tnpair.normal.name}.cram
- ln -s ${flagstat tnpairResult.alignments.tumour} $out/alignments/${tnpair.tumour.name}.flagstat
- ln -s ${flagstat tnpairResult.alignments.normal} $out/alignments/${tnpair.normal.name}.flagstat
- mkdir $out/fastqc
- ln -s ${check tnpair.tumour.files.input1} $out/fastqc/${tnpair.tumour.name}.1
- ln -s ${check tnpair.tumour.files.input2} $out/fastqc/${tnpair.tumour.name}.2
- ln -s ${check tnpair.normal.files.input1} $out/fastqc/${tnpair.normal.name}.1
- ln -s ${check tnpair.normal.files.input2} $out/fastqc/${tnpair.normal.name}.2
- '';
- };
+ testNaming = linkDrv [
+ (ln tnpairResult.variants "strelka")
+ (ln (bowtie.align {inherit ref;} tnpair.normal.files) "alignments/bowtie-normal.bam")
+ (ln (gridss.callVariants {} (with tnpairResult.alignments; [normal tumour])) "gridss")
+ (ln (gridss.call (with tnpairResult.alignments; [normal tumour])) "gridss2")
+ (ln (samtools.merge {} [tnpairResult.alignments.tumour tnpairResult.alignments.normal]) "alignments/merged.bam")
+ (ln (samtools.view { outfmt = types.toCram; } (tnpairResult.alignments.tumour)) "alignments/${tnpair.tumour.name}.cram")
+ (ln (samtools.view { outfmt = types.toCram; } (tnpairResult.alignments.normal)) "alignments/${tnpair.normal.name}.cram")
+ (ln (flagstat tnpairResult.alignments.tumour) "alignments/${tnpair.tumour.name}.flagstat")
+ (ln (flagstat tnpairResult.alignments.normal) "alignments/${tnpair.normal.name}.flagstat")
+ (ln (check tnpair.tumour.files.input1) "fastqc/${tnpair.tumour.name}.1")
+ (ln (check tnpair.tumour.files.input2) "fastqc/${tnpair.tumour.name}.2")
+ (ln (check tnpair.normal.files.input1) "fastqc/${tnpair.normal.name}.1")
+ (ln (check tnpair.normal.files.input2) "fastqc/${tnpair.normal.name}.2")
+ ];
in testNaming