aboutsummaryrefslogtreecommitdiff
path: root/tools/fastp-check.nix
blob: c7cbb3c7febd2c3dfeca343f7b4f9381650fdb96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
    '';
}