diff options
author | Justin Bedo <cu@cua0.org> | 2019-03-01 09:04:05 +1100 |
---|---|---|
committer | Justin Bedo <cu@cua0.org> | 2019-03-01 09:04:05 +1100 |
commit | 3530396ec646a5c9c5f69e1e8dccc93f3744d114 (patch) | |
tree | b475d28d93e8c6bd54f28f060d7e7f963498b523 /tools/ascat-gccorrect.nix | |
parent | 6fc75fdea7b6265fc05b1ad43d76bb55e0d8591e (diff) |
ascat: init
Diffstat (limited to 'tools/ascat-gccorrect.nix')
-rw-r--r-- | tools/ascat-gccorrect.nix | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/ascat-gccorrect.nix b/tools/ascat-gccorrect.nix new file mode 100644 index 0000000..c1838d9 --- /dev/null +++ b/tools/ascat-gccorrect.nix @@ -0,0 +1,36 @@ +{ bionix +, ref +, chrPrefix ? "" +, flags ? null +}: + +snp: + +with bionix; +with lib; +with types; + +stage rec { + name = "ascat-gccorrect"; + buildInputs = with pkgs; [ ascat.app gawk ]; + script = pkgs.writeText "convert.awk" '' + BEGIN{ + FS = OFS = "\t" + } + /^#/{next} + !loc[$1,$2]{ + print $3, "${chrPrefix}" $1, $2 + loc[$1,$2]++ + } + ''; + buildCommand = '' + awk -f ${script} ${snp} > snpPos.tsv + mkdir splitPos splitGc splitGcLogs + split --number=l/$NIX_BUILD_CORES -d snpPos.tsv splitPos/snpPos. + ls -1 splitPos/ | xargs -n1 -P$NIX_BUILD_CORES -I '{}' sh -c 'ascatSnpPanelGcCorrections.pl ${ref} splitPos/{} > splitGc/{}' + mv splitGc/snpPos.00 $out + for f in splitGc/* ; do + sed 1d $f >> $out + done + ''; +} |