chunk_illuminapairedend.smk 1.29 KB
Newer Older
peguerin's avatar
peguerin committed
1
2
3
4
5
__author__ = "Pierre-Edouard Guerin"
__license__ = "MIT"


## On scattered fastq chunk Paired end alignment then keep reads with quality > 40
peguerin's avatar
peguerin committed
6
checkpoint illuminapairedend:
peguerin's avatar
peguerin committed
7
    input:
peguerin's avatar
peguerin committed
8
9
        R1='../results/02_assembly/scaterred/{run}_R1_{chunk}.fastq',
        R2='../results/02_assembly/scaterred/{run}_R2_{chunk}.fastq'
peguerin's avatar
peguerin committed
10
    output:
peguerin's avatar
peguerin committed
11
        fq='../results/02_assembly/01_illuminapairedend/{run}_{chunk}.fastq'
peguerin's avatar
peguerin committed
12
13
14
15
16
17
18
    conda:
        '../envs/obitools_envs.yaml'
    singularity:
        config["singularity"]["obitools"]
    log:
        '../logs/02_assembly/01_illuminapairedend/{run}_{chunk}.log'
    params:
peguerin's avatar
peguerin committed
19
        s_min=config["illuminapairedend"]["s_min"],
peguerin's avatar
peguerin committed
20
        gathered=lambda wildcards: '../results/02_assembly/01_illuminapairedend/' + wildcards.run + '.fastq',
peguerin's avatar
peguerin committed
21
    shell:
peguerin's avatar
peguerin committed
22
        '''illuminapairedend -r {input.R2} {input.R1} --score-min={params.s_min} > {output.fq} 2> {log};'''
peguerin's avatar
peguerin committed
23

peguerin's avatar
peguerin committed
24
## function to get list of chunk files for each run
peguerin's avatar
peguerin committed
25
26
def get_chunks(wildcards):    
    meschunks = expand(rules.illuminapairedend.output.fq, **wildcards, chunk=listChunks)
peguerin's avatar
peguerin committed
27
28
    return meschunks

peguerin's avatar
peguerin committed
29
## gather `chunk` files into a single `run` fastq file
peguerin's avatar
peguerin committed
30
31
32
33
34
35
36
37
38
rule merge_chunks:
    input:
        get_chunks
    output:
        fq='../results/02_assembly/01_illuminapairedend/{run}.fastq'
    shell:
        '''cat {input} > {output}'''