|
a |
|
b/exseek/templates/sequential_mapping.snakemake |
|
|
1 |
{% for rna_type in rna_types %} |
|
|
2 |
rule map_{{ rna_type }}: |
|
|
3 |
input: |
|
|
4 |
{% if loop.index0 == 0 %} |
|
|
5 |
reads='{output_dir}/unmapped/{sample_id}/clean.fa.gz', |
|
|
6 |
{% else %} |
|
|
7 |
reads='{output_dir}/unmapped/{sample_id}/{{ rna_types[loop.index0 - 1] }}.fa.gz', |
|
|
8 |
{% endif %} |
|
|
9 |
{% if rna_type in ['univec', 'rRNA', 'miRNA', 'circRNA'] %} |
|
|
10 |
index=genome_dir + '/index/{{ aligner }}/{{ rna_type }}.1.bt2' |
|
|
11 |
{% elif rna_type == 'spikein' %} |
|
|
12 |
index=config['spikein_dir'] + '/index/{{ aligner }}/{{ rna_type }}.1.bt2' |
|
|
13 |
{% else %} |
|
|
14 |
index=genome_dir + '/rsem_index/{{ aligner }}/{{ rna_type }}.1.bt2' |
|
|
15 |
{% endif %} |
|
|
16 |
output: |
|
|
17 |
unmapped='{output_dir}/unmapped/{sample_id}/{{ rna_type }}.fa.gz', |
|
|
18 |
bam='{output_dir}/tbam/{sample_id}/{{ rna_type }}.bam' |
|
|
19 |
params: |
|
|
20 |
{% if rna_type in ['univec', 'rRNA', 'miRNA', 'circRNA'] %} |
|
|
21 |
index=genome_dir + '/index/{{ aligner }}/{{ rna_type }}' |
|
|
22 |
{% elif rna_type == 'spikein' %} |
|
|
23 |
index=config['spikein_dir'] + '/index/{{ aligner }}/{{ rna_type }}' |
|
|
24 |
{% else %} |
|
|
25 |
index=genome_dir + '/rsem_index/{{ aligner }}/{{ rna_type }}' |
|
|
26 |
{% endif %} |
|
|
27 |
threads: |
|
|
28 |
config['threads_mapping'] |
|
|
29 |
shell: |
|
|
30 |
'''pigz -d -c {input.reads} \ |
|
|
31 |
| bowtie2 -f -p {threads} --norc --sensitive --no-unal \ |
|
|
32 |
--un-gz {output.unmapped} -x {params.index} - -S - \ |
|
|
33 |
| samtools view -b -o {output.bam} |
|
|
34 |
''' |
|
|
35 |
|
|
|
36 |
{% endfor %} |
|
|
37 |
rule map_other: |
|
|
38 |
input: |
|
|
39 |
{% if (rna_types|length) == 0 %} |
|
|
40 |
reads='{output_dir}/unmapped/{sample_id}/clean.fa.gz', |
|
|
41 |
{% else %} |
|
|
42 |
reads='{output_dir}/unmapped/{sample_id}/{{ rna_types[-1] }}.fa.gz', |
|
|
43 |
{% endif %} |
|
|
44 |
index=genome_dir + '/genome_index/{{ aligner }}/genome.1.bt2' |
|
|
45 |
output: |
|
|
46 |
unmapped='{output_dir}/unmapped/{sample_id}/other.fa.gz', |
|
|
47 |
bam='{output_dir}/gbam/{sample_id}/other.bam' |
|
|
48 |
params: |
|
|
49 |
index=genome_dir + '/genome_index/{{ aligner }}/genome' |
|
|
50 |
shell: |
|
|
51 |
'''pigz -d -c {input.reads} \ |
|
|
52 |
| bowtie2 -f -p {threads} --sensitive --no-unal \ |
|
|
53 |
--un-gz {output.unmapped} -x {params.index} - -S - \ |
|
|
54 |
| samtools view -b -o {output.bam} |
|
|
55 |
''' |
|
|
56 |
|
|
|
57 |
|