aboutsummaryrefslogtreecommitdiff
path: root/tools/gridss-softClipsToSplitReads.nix
blob: 35cd7b48604f776e79f87bd967c38493f2f43b43 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{ bionix
, nixpkgs
, bwaIndexAttrs ? {}
, faidxAttrs ? {}
, alignerStreaming ? false
, flags ? null
, config ? 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"} \
      ${optionalString config ("CONFIGURATION_FILE=" + gridssConfig config)} \
			WORKER_THREADS=$NIX_BUILD_CORES
    '';
  passthru.filetype =
    if alignerStreaming then
      filetype.bam { ref = ref; sort = sorting.none {};  }
    else
      input.filetype;
}