metaspades.smk 2.14 KB
Newer Older
Patrick May's avatar
yaml  
Patrick May committed
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
METASPADES_ASSEMBLY_SHELL = """
if [ -d "{output[0]}" ]; then
    rm -rf {output[0]}
fi
rnaspades.py --meta \
 --pe1-1 {input[0]} \
 --pe1-2 {input[1]} \
 --pe1-s {input[2]} \
  -t {threads} \
  -m {BIGMEMTOTAL} \
  -k {KMER_STEPS} \
  {STRANDED_ARG} \
  -o {output[0]} > {log} 2>&1
ln -fs  {output[1]} {output[2]}
"""

kmersteps=range(config['assembly']['mink'],config['assembly']['maxk']+1,config['assembly']['step'])
KMER_STEPS =",".join(map(str,kmersteps))
STRANDED_ARG = ""
if MT_STRANDED == 1:
    STRANDED_ARG =  "-ss-rf"
elif MT_STRANDED == 2:
    STRANDED_ARG =  "-ss-fr" 

rule metaspades_assembly_from_preprocessing:
    input:
        'Preprocessing/mt.r1.preprocessed.fq',
        'Preprocessing/mt.r2.preprocessed.fq',
        'Preprocessing/mt.se.preprocessed.fq'
    output:
        directory('Assembly/intermediary/mt.metaspades_preprocessed.1'),
        'Assembly/intermediary/mt.metaspades_preprocessed.1/transcripts.fasta',
        'Assembly/intermediary/mt.metaspades_preprocessed.1.fa'
34
    resources:
Patrick May's avatar
yaml  
Patrick May committed
35
36
        runtime = "120:00:00",
        mem = BIGMEMCORE
ahb-ufz's avatar
ahb-ufz committed
37
    threads: getThreads(BIGCORENO)
Patrick May's avatar
Patrick May committed
38
    conda: ENVDIR + "/IMP_assembly.yaml"
Patrick May's avatar
yaml  
Patrick May committed
39
40
41
42
43
44
45
46
47
48
49
50
51
52
    log: "logs/assembly_metaspades_assembly_from_preprocessing.mt.log"
    message: "metaspades_assembly_from_preprocessing: Performing mt assembly step 1 from preprocessed reads using MetaSpades"
    shell:
        METASPADES_ASSEMBLY_SHELL

rule metaspades_assembly_from_unmapped:
    input:
        'Assembly/intermediary/mt.r1.unmapped.fq',
        'Assembly/intermediary/mt.r2.unmapped.fq',
        'Assembly/intermediary/mt.se.unmapped.fq'
    output:
        directory('Assembly/intermediary/mt.metaspades_unmapped.2'),
        'Assembly/intermediary/mt.metaspades_unmapped.2/transcripts.fasta',
        'Assembly/intermediary/mt.metaspades_unmapped.2.fa'
53
    resources:
Patrick May's avatar
yaml  
Patrick May committed
54
55
        runtime = "120:00:00",
        mem = BIGMEMCORE
ahb-ufz's avatar
ahb-ufz committed
56
    threads: getThreads(BIGCORENO)
Patrick May's avatar
Patrick May committed
57
    conda: ENVDIR + "/IMP_assembly.yaml"
Patrick May's avatar
yaml  
Patrick May committed
58
59
60
61
    log: "logs/assembly_metaspades_assembly_from_unmapped.mt.log"
    message: "metaspades_assembly_from_unmapped: Performing mt assembly step 2 from unmapped reads using METASPADES"
    shell:
        METASPADES_ASSEMBLY_SHELL