aboutsummaryrefslogtreecommitdiff
path: root/tools/gridss-extractSVReads.nix
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2018-10-29 15:33:53 +1100
committerJustin Bedo <cu@cua0.org>2018-10-29 15:36:33 +1100
commite7cd661d1c5fb4135e3d436e151294e26aef9127 (patch)
tree71ef7647d15d57bc2db2cf8ec532da794fddb2fa /tools/gridss-extractSVReads.nix
parent8fb986fd88705fc01be7145b04fa229092c1e69e (diff)
Split gridss into constituents
Wrap each individual command for GRIDSS so that bionix executed the pipeline rather than GRIDSS. This patch introduces a "call" function that executed the whole pipeline in bionix on an arbitrary BAM file. Resolves #10.
Diffstat (limited to 'tools/gridss-extractSVReads.nix')
-rw-r--r--tools/gridss-extractSVReads.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/gridss-extractSVReads.nix b/tools/gridss-extractSVReads.nix
new file mode 100644
index 0000000..a10abf5
--- /dev/null
+++ b/tools/gridss-extractSVReads.nix
@@ -0,0 +1,40 @@
+{ bionix
+, nixpkgs
+, dictIndexAttrs ? {}
+, faidxAttrs ? {}
+, flags ? null
+, unmappedReads ? false
+, minClipLength ? 5
+}:
+
+with nixpkgs;
+with lib;
+with bionix.types;
+
+input:
+
+let
+ ref = matchFiletype "gridss-extractSVReads" { bam = x: x.ref; } input;
+in
+
+
+stdenv.mkDerivation rec {
+ name = "gridss-extractSVReads";
+ buildInputs = [ jre R ];
+ buildCommand = ''
+ ln -s ${ref} ref.fa
+ ln -s ${bionix.samtools.faidx faidxAttrs ref} ref.fa.fai
+ ln -s ${bionix.samtools.dict dictIndexAttrs ref} ref.fa.dict
+ ln -s ${input} input.bam
+ mkdir $out
+ java -Dsamjdk.create_index=true \
+ -cp ${bionix.gridss.jar} gridss.ExtractSVReads \
+ REFERENCE_SEQUENCE=ref.fa \
+ I=input.bam \
+ O=$out/input.sv.bam \
+ METRICS_OUTPUT=$out/input.sv_metrics \
+ INSERT_SIZE_METRICS=$out/input.insert_size_metrics \
+ UNMAPPED_READS=${if unmappedReads then "true" else "false"} \
+ MIN_CLIP_LENGTH=${toString minClipLength}
+ '';
+}