aboutsummaryrefslogtreecommitdiff
path: root/tools/gridss-softClipsToSplitReads.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-softClipsToSplitReads.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-softClipsToSplitReads.nix')
-rw-r--r--tools/gridss-softClipsToSplitReads.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/tools/gridss-softClipsToSplitReads.nix b/tools/gridss-softClipsToSplitReads.nix
new file mode 100644
index 0000000..8a7dca3
--- /dev/null
+++ b/tools/gridss-softClipsToSplitReads.nix
@@ -0,0 +1,43 @@
+{ bionix
+, nixpkgs
+, bwaIndexAttrs ? {}
+, faidxAttrs ? {}
+, alignerStreaming ? false
+, flags ? null
+}:
+
+with nixpkgs;
+with lib;
+with bionix.types;
+
+input:
+
+let
+ ref = matchFiletype "gridss-softClipsToSplitReads" { bam = x: x.ref; } input;
+in
+
+assert (matchFileSorting "gridss-softClipsToSplitReads" { name = _: true; } input);
+
+stdenv.mkDerivation rec {
+ name = "gridss-softClipsToSplitReads";
+ buildInputs = [ jre ];
+ buildCommand = ''
+ ln -s ${ref} ref.fa
+ ln -s ${bionix.samtools.faidx faidxAttrs ref} ref.fa.fai
+ for f in ${bionix.bwa.index bwaIndexAttrs ref}/*; do
+ ln -s $f
+ done
+ java -Xmx2G -Dsamjdk.create_index=false \
+ -cp ${bionix.gridss.jar} gridss.SoftClipsToSplitReads \
+ REFERENCE_SEQUENCE=ref.fa \
+ I=${input} \
+ O=$out \
+ ${optionalString alignerStreaming "ALIGNER_STREAMING=true"} \
+ WORKER_THREADS=$NIX_BUILD_CORES
+ '';
+ passthru.filetype =
+ if alignerStreaming then
+ filetype.bam { ref = ref; sort = sorting.none {}; }
+ else
+ input.filetype;
+}