aboutsummaryrefslogtreecommitdiff
path: root/tools/gridss-computeSamTags.nix
blob: a2e1f8bf446c9509c3a5bc5124b5eb4c82955cf7 (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
{ bionix
, bwaIndexAttrs ? {}
, faidxAttrs ? {}
, flags ? null
, config ? null
, heapSize ? "1G"
}:

with bionix;
with lib;
with types;

input:

let
  ref = matchFiletype "gridss-computeSamTags" { bam = x: x.ref; } input;
  sorted = matchFileSorting "gridss-computeSamTags" { name = _: true; } input;
in

assert(sorted);

stage rec {
  name = "gridss-computeSamTags";
  buildInputs = with pkgs; [ 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 -Xmx${heapSize} \
      -Dsamjdk.create_index=false \
			-cp ${bionix.gridss.jar} gridss.ComputeSamTags \
      VERBOSITY=WARNING \
			REFERENCE_SEQUENCE=ref.fa \
			WORKING_DIR=$TMP_DIR \
			TMP_DIR=$TMP_DIR \
      ${optionalString (config != null) ("OPTIONS_FILE=" + bionix.gridss.gridssConfig config)} \
			I=${input} \
			O=$out \
      AS=true
  '';
  passthru.filetype = input.filetype;
}