diff options
author | Justin Bedo <cu@cua0.org> | 2019-04-07 21:10:25 +1000 |
---|---|---|
committer | Justin Bedo <cu@cua0.org> | 2019-04-07 21:10:25 +1000 |
commit | e5a8870358713f4e44e135da913c50230d83d4f1 (patch) | |
tree | 9678b00f5b683f0d3df31c11ff2c96c0a597cb0f /tools/samtools-merge.nix | |
parent | e97bc0b22b9f49d95d6b449b2b20e7222b42622d (diff) |
modify outputs to ensure determinism
Diffstat (limited to 'tools/samtools-merge.nix')
-rw-r--r-- | tools/samtools-merge.nix | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/samtools-merge.nix b/tools/samtools-merge.nix index 120f825..9b7d133 100644 --- a/tools/samtools-merge.nix +++ b/tools/samtools-merge.nix @@ -19,7 +19,12 @@ stage { name = "samtools-merge"; buildInputs = with pkgs; [ samtools ]; buildCommand = '' - samtools merge ${optionalString (flags != null) flags} $out ${concatStringsSep " " inputs} + samtools merge ${optionalString (flags != null) flags} out.bam ${concatStringsSep " " inputs} + + # Merge is non-deterministic with PG lines; if files have clashing PG IDs then a random + # suffix is appended to make it unique. PG lines are stripped in the following to + # resolve the issue. + samtools reheader <(samtools view -H out.bam | grep -v '@PG') out.bam > $out ''; passthru.filetype = (builtins.elemAt inputs 0).filetype; } |