blob: 18c51dad8555897a9e1bc1a845c277cff653fd33 (
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
|
{ bionix
, flags ? null
}:
{ primary, secondary }:
with bionix;
with lib;
with types;
let
isSortedBam = matchFiletype "xenomapper-allocate" { bam = matchSorting "xenomapper-allocate" { coord = _: false; name = _: true; none = _: false; }; };
outs = [ "primary_specific" "primary_multi" "secondary_specific" "secondary_multi" "unassigned" "unresolved" ];
in
assert isSortedBam primary;
assert isSortedBam secondary;
stage {
name = "xenomapper-allocate";
buildInputs = with pkgs; [ samtools xenomapper ];
outputs = [ "out" ] ++ outs;
buildCommand = ''
xenomapper ${optionalString (flags != null) flags} \
--primary_bam ${primary} --secondary_bam ${secondary} \
${concatMapStringsSep " " (out: "--${out} >(samtools view -bS - > ${"$" + out})") outs}
mkdir -p $out
for x in ${concatStringsSep " " outs} ; do
ln -s ''${!x} $out/$x.bam
done
'';
}
|