aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2018-10-24 16:10:56 +1100
committerJustin Bedo <cu@cua0.org>2018-10-24 16:10:56 +1100
commite25bd63e03ee4da6817fe437e5e4184eae685653 (patch)
treecd7e5b1ba6f0fda55d98fb97606e9b884925ed63
parent94cff4f9e392911421cd8b94973b8c1e5698c430 (diff)
Simplify test expression
-rw-r--r--test.nix45
1 files changed, 26 insertions, 19 deletions
diff --git a/test.nix b/test.nix
index 8126e63..9851310 100644
--- a/test.nix
+++ b/test.nix
@@ -1,28 +1,35 @@
-{pkgs ? import <nixpkgs> {}}:
+{pkgs ? import <nixpkgs> {}
+,bionix ? import <bionix> {}}:
with pkgs;
with lib;
+with bionix;
let
- ref = ./example/ref.fa;
- alignWithRG = rg: callPackage ./tools/bwa.nix { inherit ref; flags = "-R'@RG\\tID:${rg}\\tSM:${rg}'";};
- sort = callPackage ./tools/samtools-sort.nix { };
- callVariants = callPackage ./tools/platypus.nix { inherit ref; };
+ inherit (types) filetype tagFiletype;
- samples = [ {name = "mysample1"; files = {input1 = ./example/sample1-1.fq; input2 = ./example/sample1-2.fq;};}
- {name = "mysample2"; files = {input1 = ./example/sample2-1.fq; input2 = ./example/sample2-1.fq;};} ];
+ fetchLocal = path: stdenv.mkDerivation {
+ name = baseNameOf path;
+ buildCommand = "ln -s ${path} $out";
+ };
+ tagfq = path: tagFiletype (filetype.fq {}) (fetchLocal path);
+ tagfa = path: tagFiletype (filetype.fa {}) (fetchLocal path);
- alignments = map (i: sort (alignWithRG i.name i.files)) samples;
- variants = callVariants alignments;
+ ref = tagfa ./example/ref.fa;
+ alignWithRG = rg: bwa.align { inherit ref; flags = "-R'@RG\\tID:${rg}\\tSM:${rg}'";};
- testNaming = stdenv.mkDerivation {
- name = "test-naming";
- buildCommand = ''
- mkdir $out
- ln -s ${variants} $out/myfancyname
- mkdir $out/alignments
- ${concatStringsSep "\n" (zipListsWith (s: a: "ln -s ${a} $out/alignments/${s.name}.bam") samples alignments)}
- '';
- };
+ samples = [ {name = "mysample1"; files = {input1 = tagfq ./example/sample1-1.fq; input2 = tagfq ./example/sample1-2.fq;};}
+ {name = "mysample2"; files = {input1 = tagfq ./example/sample2-1.fq; input2 = tagfq ./example/sample2-1.fq;};} ];
+
+ alignments = map (i: samtools.sort {} (alignWithRG i.name i.files)) samples;
+ variants = platypus.call {} alignments;
-in testNaming
+in stdenv.mkDerivation {
+ name = "myproject";
+ buildCommand = ''
+ mkdir $out
+ ln -s ${variants} $out/platypus.vcf
+ mkdir $out/alignments
+ ${concatStringsSep "\n" (zipListsWith (s: a: "ln -s ${a} $out/alignments/${s.name}.bam") samples alignments)}
+ '';
+}