aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorl-d-s <distefano.l@wehi.edu.au>2019-06-06 09:34:15 +1000
committerl-d-s <distefano.l@wehi.edu.au>2019-06-06 09:34:15 +1000
commit2806b4fcdf8af8173c005525037d550d35f00a9f (patch)
tree765ada4db1d4327611fa33db4c5c1e319f664bae /tools
parent22e61f4fbdc0fc698a25fbe9aa64ebb4da1e32a8 (diff)
parenta7b06b941b30feaf8b3b0e0ad1bc986d58d9f9ac (diff)
Merge branch 'master' of https://github.com/PapenfussLab/bionix
Diffstat (limited to 'tools')
-rw-r--r--tools/fastp-check.nix54
1 files changed, 27 insertions, 27 deletions
diff --git a/tools/fastp-check.nix b/tools/fastp-check.nix
index c7cbb3c..bd522d8 100644
--- a/tools/fastp-check.nix
+++ b/tools/fastp-check.nix
@@ -7,34 +7,34 @@
} :
with bionix;
-with pkgs.lib;
+with lib;
+with types;
-# Match input file type—how to do .fq and .fq.gz? Does bz2 work?
+let
+ fq = f: matchFiletype "fastp-input" { fq = _: f; gz = matchFiletype' "fastp-input" { fq = _: f; }; } f;
-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 \
+ out =
+ stage {
+ name = "fastp";
+ buildInputs = [ fastp.app ];
+ outputs = [ "out" "fastq1" "json" ] ++ (if input2 != null then [ "fastq2" ] else []);
+ buildCommand = ''
+ mkdir -p $out
+ fastp \
+ ${optionalString (flags != null) flags} \
+ -i ${fq input1} \
+ -o fastq1.fq.gz \
+ ${optionalString (input2 != null) ''
+ -I ${fq input2} \
+ -O fastq2.fq.gz \
- cp fastq2.fq.gz $fastq2
- ln -s $fastq2 $out/fastq2.fq.gz
- ''}
+ cp fastq2.fq.gz $fastq2
+ ''}
- 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
+ cp fastq1.fq.gz $fastq1
+ cp fastp.html $out
+ cp fastp.json $json
+ '';
+ };
+ fqgz = { filetype = filetype.gz (filetype.fastq {}); };
+in out // { fastq1 = out.fastq1 // fqgz; } // (if input2 != null then {fastq2 = out.fastq2 // fqgz; } else {})