From 9a70a25d6b7771df7ca53fcc34d61f582296e384 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Thu, 10 Jan 2019 12:20:51 +1100 Subject: facets: init --- tools/facets-call.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tools/facets-call.nix (limited to 'tools/facets-call.nix') diff --git a/tools/facets-call.nix b/tools/facets-call.nix new file mode 100644 index 0000000..021cacc --- /dev/null +++ b/tools/facets-call.nix @@ -0,0 +1,24 @@ +{bionix}: + +{vcf, bams}: + +with bionix; +with types; +with lib; + +assert (matchFiletype "facets-call-vcf" { vcf = _: true; } vcf); +assert (all (matchFiletype "facets-call-bam" { bam = _: true; }) bams); +assert (all (matchFileSorting "facets-call-bam" { coord = _: true; }) bams); + +stage { + name = "facets"; + buildInputs = [ facets.app ]; + buildCommand = '' + # Facets requires lexical sorting on the VCF files + grep '^#' ${vcf} > input.vcf + grep -v '^#' ${vcf} | LC_ALL=C sort -t $'\t' -k1,1 -k2,2n >> input.vcf || true + + # Now actually run facets + snp-pileup input.vcf $out ${concatStringsSep " " bams} + ''; +} -- cgit v1.2.3