aboutsummaryrefslogtreecommitdiff
path: root/tools/mutect-call.nix
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2018-10-26 08:05:28 +1100
committerJustin Bedo <cu@cua0.org>2018-10-26 08:05:28 +1100
commit2c706aaad54aeec0f224ab7c313ac22aebe0bb9e (patch)
treee6f8e84d12bcc656f2ca50f0c118102bee32d54b /tools/mutect-call.nix
parent4ee3f9f9c24b7dcdaa1be19aadd84454219c43f6 (diff)
init: mutect
Diffstat (limited to 'tools/mutect-call.nix')
-rw-r--r--tools/mutect-call.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/mutect-call.nix b/tools/mutect-call.nix
new file mode 100644
index 0000000..9fd009b
--- /dev/null
+++ b/tools/mutect-call.nix
@@ -0,0 +1,42 @@
+{bionix
+, nixpkgs
+, cosmic
+, dbsnp}:
+
+with nixpkgs;
+with lib;
+
+let
+ inherit (bionix.types) matchFiletype;
+ getVCFref = matchFiletype "mutect-call" {vcf = {ref}: ref;};
+ getBAMref = matchFiletype "mutect-call" {bam = {ref, ...}: ref;};
+ refs = map getVCFref [ cosmic dbsnp ];
+ ref = head refs;
+in
+
+assert (length (unique refs) == 1);
+
+{normal, tumour}:
+
+assert (ref == getBAMref normal && ref == getBAMref tumour);
+
+stdenv.mkDerivation {
+ name = "mutect";
+ buildInputs = [ bionix.mutect.app ];
+ buildCommand = ''
+ ln -s ${normal} normal.bam
+ ln -s ${tumour} tumour.bam
+ ln -s ${dbsnp} dbsnp.vcf
+ ln -s ${cosmic} cosmic.vcf
+ ln -s ${ref} ref.fa
+ ln -s ${bionix.samtools.faidx {} ref} ref.fa.fai
+ ln -s ${bionix.samtools.dict {} ref} ref.dict
+ mutect --analysis_type MuTect \
+ --reference_sequence ref.fa \
+ --cosmic cosmic.vcf \
+ --dbsnp dbsnp.vcf \
+ --input_file:normal normal.bam \
+ --input_file:tumour tumour.bam \
+ --out $out
+ '';
+}