diff options
author | Justin Bedo <cu@cua0.org> | 2018-12-19 16:46:19 +1100 |
---|---|---|
committer | Justin Bedo <cu@cua0.org> | 2018-12-19 16:46:19 +1100 |
commit | 5e508d19fb2927574229df09b64c3fbfc2b752eb (patch) | |
tree | 6af14e192521cb3cd127d51dc1f502d3700d241d | |
parent | a458b2813b2b0749e801098fe8aa03d8444141a6 (diff) |
examples: added example tumour-normal calling pipeline script
-rw-r--r-- | examples/call.nix (renamed from example/call.nix) | 0 | ||||
-rw-r--r-- | examples/default.nix (renamed from example/default.nix) | 0 | ||||
-rw-r--r-- | examples/ref.fa (renamed from example/ref.fa) | 0 | ||||
-rw-r--r-- | examples/sample1-1.fq (renamed from example/sample1-1.fq) | 0 | ||||
-rw-r--r-- | examples/sample1-2.fq (renamed from example/sample1-2.fq) | 0 | ||||
-rw-r--r-- | examples/sample2-1.fq (renamed from example/sample2-1.fq) | 0 | ||||
-rw-r--r-- | examples/sample2-2.fq (renamed from example/sample2-2.fq) | 0 | ||||
-rwxr-xr-x | examples/tnpair | 58 | ||||
-rw-r--r-- | examples/tnpair.nix | 26 |
9 files changed, 84 insertions, 0 deletions
diff --git a/example/call.nix b/examples/call.nix index c9be673..c9be673 100644 --- a/example/call.nix +++ b/examples/call.nix diff --git a/example/default.nix b/examples/default.nix index bceaa96..bceaa96 100644 --- a/example/default.nix +++ b/examples/default.nix diff --git a/example/ref.fa b/examples/ref.fa index fdc51e6..fdc51e6 100644 --- a/example/ref.fa +++ b/examples/ref.fa diff --git a/example/sample1-1.fq b/examples/sample1-1.fq index 743a5a8..743a5a8 100644 --- a/example/sample1-1.fq +++ b/examples/sample1-1.fq diff --git a/example/sample1-2.fq b/examples/sample1-2.fq index aea7f3e..aea7f3e 100644 --- a/example/sample1-2.fq +++ b/examples/sample1-2.fq diff --git a/example/sample2-1.fq b/examples/sample2-1.fq index a69ee45..a69ee45 100644 --- a/example/sample2-1.fq +++ b/examples/sample2-1.fq diff --git a/example/sample2-2.fq b/examples/sample2-2.fq index a2bd3e3..a2bd3e3 100644 --- a/example/sample2-2.fq +++ b/examples/sample2-2.fq diff --git a/examples/tnpair b/examples/tnpair new file mode 100755 index 0000000..5b84d5c --- /dev/null +++ b/examples/tnpair @@ -0,0 +1,58 @@ +#!/bin/sh + +set -e + +if [[ $# -ne 5 ]] ; then + echo "Usage: $0 ref normal1 normal2 tumour1 tumour2" + exit 1 +fi + +function cleanup { + if [[ -e tnpair-$$ ]]; then + rm tnpair-$$ + fi +} +trap cleanup INT TERM EXIT + +ref=`readlink -f $1` +norm1=`readlink -f $2` +norm2=`readlink -f $3` +tumour1=`readlink -f $4` +tumour2=`readlink -f $5` + +refhash=`nix-hash --base32 --type sha256 --flat $ref` +norm1hash=`nix-hash --base32 --type sha256 --flat $norm1` +norm2hash=`nix-hash --base32 --type sha256 --flat $norm2` +tumour1hash=`nix-hash --base32 --type sha256 --flat $tumour1` +tumour2hash=`nix-hash --base32 --type sha256 --flat $tumour2` + +cat > tnpair-$$ <<EOF +import ./tnpair.nix { + normal = { + input1={ + url="file://$norm1"; + sha256="$norm1hash"; + }; + input2={ + url="file://$norm2"; + sha256="$norm2hash"; + }; + }; + tumour = { + input1={ + url = "file://$tumour1"; + sha256 = "$tumour1hash"; + }; + input2={ + url = "file://$tumour2"; + sha256 = "$tumour2hash"; + }; + }; + ref = { + url = "file://$ref"; + sha256 = "$refhash"; + }; +} +EOF + +nix build --keep-going "(import ./tnpair-$$)" diff --git a/examples/tnpair.nix b/examples/tnpair.nix new file mode 100644 index 0000000..2939db4 --- /dev/null +++ b/examples/tnpair.nix @@ -0,0 +1,26 @@ +# This is an example tumour-normal calling pipeline using strelka +{ bionix ? import <bionix> {} +, normal +, tumour +, ref +}: + +with bionix; +with lib; + +let + input = mapAttrs (_: fetchFastQGZ); + + preprocess = pipe [ + input + (bwa.align { ref = fetchFastA ref; }) + (samtools.fixmate {}) + (samtools.sort {}) + (samtools.markdup {}) + ]; + +in linkDrv [ + (ln (strelka.call {} {normal = preprocess normal; tumour = preprocess tumour;}) "strelka") + (ln (preprocess normal) "normal.bam") + (ln (preprocess tumour) "tumour.bam") +] |