aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorl-d-s <l@sdf.org>2019-05-01 14:04:54 +1000
committerl-d-s <l@sdf.org>2019-05-01 14:05:00 +1000
commit95c8a36a7e673fac090175729069a668daa919da (patch)
tree7807cd59d5645864769d6e89b17ff43ed63c0d55
parentd517a934f570427e46be8d83aa2ae4b045b069e8 (diff)
Add fastp.
-rw-r--r--default.nix1
-rw-r--r--test-tnpair.nix12
-rw-r--r--tools/fastp-app.nix23
-rw-r--r--tools/fastp-run.nix40
-rw-r--r--tools/fastp.nix9
5 files changed, 80 insertions, 5 deletions
diff --git a/default.nix b/default.nix
index 608fa9b..d67f2eb 100644
--- a/default.nix
+++ b/default.nix
@@ -33,6 +33,7 @@ let
snpeff = callBionix ./tools/snpeff.nix {};
strelka = callBionix ./tools/strelka.nix {};
ascat = callBionix ./tools/ascat.nix {};
+ fastp = callBionix ./tools/fastp.nix {};
sbatch = attrs: bionix.extend (self: super: with self; rec {
sbatchDefs = { ppn = 1; mem = 1; walltime = "24:00:00"; partition = null; slurmFlags = null; } // attrs;
diff --git a/test-tnpair.nix b/test-tnpair.nix
index 1d281fa..1b5f347 100644
--- a/test-tnpair.nix
+++ b/test-tnpair.nix
@@ -14,7 +14,8 @@ let
alignWithRG = rg: bwa.align { inherit ref; flags = "-R'@RG\\tID:${rg}\\tSM:${rg}'";};
sort = samtools.sort {};
flagstat = samtools.flagstat {};
- check = fastqc.check {};
+ check-fastqc = fastqc.check {};
+ check-fastp = fastp.run {};
callVariants = strelka.callSomatic {};
markdup = samtools.markdup {};
fixmate = samtools.fixmate {};
@@ -59,10 +60,11 @@ let
#(ln (samtools.view { outfmt = types.toCram; } (tnpairResult.alignments.normal)) "alignments/${tnpair.normal.name}.cram")
(ln (flagstat tnpairResult.alignments.tumour) "alignments/${tnpair.tumour.name}.flagstat")
#(ln (flagstat tnpairResult.alignments.normal) "alignments/${tnpair.normal.name}.flagstat")
- (ln (check tnpair.tumour.files.input1) "fastqc/${tnpair.tumour.name}.1")
- #(ln (check tnpair.tumour.files.input2) "fastqc/${tnpair.tumour.name}.2")
- #(ln (check tnpair.normal.files.input1) "fastqc/${tnpair.normal.name}.1")
- #(ln (check tnpair.normal.files.input2) "fastqc/${tnpair.normal.name}.2")
+ (ln (check-fastqc tnpair.tumour.files.input1) "fastqc/${tnpair.tumour.name}.1")
+ #(ln (check-fastqc tnpair.normal.files.input1) "fastqc/${tnpair.normal.name}.1")
+ #(ln (check-fastqc tnpair.normal.files.input2) "fastqc/${tnpair.normal.name}.2")
+ #(ln (check-fastqc tnpair.tumour.files.input2) "fastqc/${tnpair.tumour.name}.2")
+ (ln (check-fastp tnpair.tumour.files) "fastp/${tnpair.tumour.name}")
];
in testNaming
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;
+}
+