demultiplexing.smk 1.44 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
__author__ = "Pierre-Edouard Guerin"
__license__ = "MIT"

## Demultiplexing
rule demultiplexing:
    output:
        '../results/03_demultiplexing/01_demultiplexed/{demultiplex}.fastq'
    singularity:
        config["singularity"]["ednatools"]
    conda:
        '../envs/env_cutadapt.yaml'
    threads:
        1
    params:
        dmulti= lambda wildcards: dfMulti[dfMulti.demultiplex == wildcards.demultiplex].to_dict('records')[0],
        maxLen=config["demultiplexing"]["maxLen"],
        minLen=config["demultiplexing"]["minLen"]
    log:
        '../logs/03_demultiplexing/01_demultiplexed/{demultiplex}.log'
    shell:
        '''
peguerin's avatar
peguerin committed
22
        mkdir -p ../results/03_demultiplexing/01_demultiplexed/{params.dmulti[projet]}/{params.dmulti[marker]}
peguerin's avatar
peguerin committed
23
24
25
26
27
28
        cat ../results/02_assembly/{params.dmulti[run]}.fastq ../results/02_assembly/{params.dmulti[run]}_rev.fastq 2> {log} | \
        cutadapt --discard-untrimmed -m {params.minLen} -g {params.dmulti[barcode5]} -O {params.dmulti[lenBarcode5]} - 2>> {log} | \
        cutadapt --discard-untrimmed -m {params.minLen} -g ^{params.dmulti[primer5]} -O {params.dmulti[min_f]} - 2>> {log} | \
        cutadapt --discard-untrimmed -m {params.minLen} -a {params.dmulti[barcode3]} -O {params.dmulti[lenBarcode3]} - 2>> {log} | \
        cutadapt --discard-untrimmed -m {params.minLen} -a {params.dmulti[primer3]}$ -O {params.dmulti[min_r]} - 2>> {log} | \
        cutadapt -M {params.maxLen} - 2>> {log} > {output}
29
30
31
32
33
34
        '''