aboutsummaryrefslogtreecommitdiff
path: root/test.nix
blob: 6c158c670e197460e4f596df263cbfcf91ba193e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{pkgs ? import <nixpkgs> {}}:

with pkgs;
with lib;

let
  ref = ../bioshake/examples/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; };

  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;};} ];

  alignments = map (i: sort (alignWithRG i.name i.files)) samples;
  variants = callVariants alignments;

  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)}
    '';
  };

in testNaming