From 95c8a36a7e673fac090175729069a668daa919da Mon Sep 17 00:00:00 2001 From: l-d-s Date: Wed, 1 May 2019 14:04:54 +1000 Subject: Add fastp. --- tools/fastp-app.nix | 23 +++++++++++++++++++++++ tools/fastp-run.nix | 40 ++++++++++++++++++++++++++++++++++++++++ tools/fastp.nix | 9 +++++++++ 3 files changed, 72 insertions(+) create mode 100644 tools/fastp-app.nix create mode 100644 tools/fastp-run.nix create mode 100644 tools/fastp.nix (limited to 'tools') diff --git a/tools/fastp-app.nix b/tools/fastp-app.nix new file mode 100644 index 0000000..bb716e2 --- /dev/null +++ b/tools/fastp-app.nix @@ -0,0 +1,23 @@ +{ stdenv +, fetchFromGitHub +, zlib +}: + +stdenv.mkDerivation rec { + name = "fastp-${version}"; + version = "0.20.0"; + + src = fetchFromGitHub { + owner = "OpenGene"; + repo = "fastp"; + rev = "v${version}"; + sha256 = "0y0qfp3j3gqnmlqskna8x43acss21vxwck287c4fagxlcaba0s30"; + }; + + buildInputs = [ zlib ]; + + installPhase = '' + mkdir -p $out/bin + cp fastp $out/bin + ''; +} diff --git a/tools/fastp-run.nix b/tools/fastp-run.nix new file mode 100644 index 0000000..c7cbb3c --- /dev/null +++ b/tools/fastp-run.nix @@ -0,0 +1,40 @@ +{ bionix +, flags ? null +} : + +{ input1 +, input2 ? null +} : + +with bionix; +with pkgs.lib; + +# Match input file type—how to do .fq and .fq.gz? Does bz2 work? + +stage { + name = "fastp"; + buildInputs = [ fastp.app ]; + outputs = [ "out" "fastq1" "fastq2" "html" "json" ]; + buildCommand = '' + mkdir -p $out + fastp \ + ${optionalString (flags != null) flags} \ + -i ${input1} \ + -o fastq1.fq.gz \ + ${optionalString (input2 != null) '' + -I ${input2} \ + -O fastq2.fq.gz \ + + cp fastq2.fq.gz $fastq2 + ln -s $fastq2 $out/fastq2.fq.gz + ''} + + cp fastq1.fq.gz $fastq1 + cp fastp.html $html + cp fastp.json $json + + ln -s $fastq1 $out/fastq1.fq.gz + ln -s $html $out/fastp.html + ln -s $json $out/fastp.json + ''; +} \ No newline at end of file diff --git a/tools/fastp.nix b/tools/fastp.nix new file mode 100644 index 0000000..52c9041 --- /dev/null +++ b/tools/fastp.nix @@ -0,0 +1,9 @@ +{ bionix }: + +with bionix; + +rec { + app = pkgs.callPackage ./fastp-app.nix {}; + run = callBionixE ./fastp-run.nix; +} + -- cgit v1.2.3