|
a |
|
b/exseek/snakefiles/fastq_to_fasta.snakemake |
|
|
1 |
include: 'common.snakemake' |
|
|
2 |
|
|
|
3 |
def get_all_inputs(wildcards): |
|
|
4 |
inputs = [] |
|
|
5 |
if config['paired_end']: |
|
|
6 |
inputs += expand('{output_dir}/unmapped/{sample_id}/clean_{pair_index}.fa.gz', |
|
|
7 |
output_dir=output_dir, sample_id=sample_ids, pair_index=[1, 2]) |
|
|
8 |
else: |
|
|
9 |
inputs += expand('{output_dir}/unmapped/{sample_id}/clean.fa.gz', |
|
|
10 |
output_dir=output_dir, sample_id=sample_ids) |
|
|
11 |
return inputs |
|
|
12 |
|
|
|
13 |
rule all: |
|
|
14 |
input: |
|
|
15 |
get_all_inputs |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
rule fastq_to_fasta_pe: |
|
|
19 |
input: |
|
|
20 |
auto_gzip_input('{output_dir}/cutadapt/{sample_id}_{pair_index}.fastq') |
|
|
21 |
output: |
|
|
22 |
'{output_dir}/unmapped/{sample_id}/clean_{pair_index}.fa.gz' |
|
|
23 |
threads: |
|
|
24 |
config['threads_compress'] |
|
|
25 |
wildcard_constraints: |
|
|
26 |
pair_index='[12]' |
|
|
27 |
shell: |
|
|
28 |
'''{bin_dir}/auto_uncompress {input} \ |
|
|
29 |
| fastq_to_fasta -r -n \ |
|
|
30 |
| pigz -p {threads} -c > {output} |
|
|
31 |
''' |
|
|
32 |
|
|
|
33 |
rule fastq_to_fasta_se: |
|
|
34 |
input: |
|
|
35 |
auto_gzip_input('{output_dir}/cutadapt/{sample_id}.fastq') |
|
|
36 |
output: |
|
|
37 |
'{output_dir}/unmapped/{sample_id}/clean.fa.gz' |
|
|
38 |
threads: |
|
|
39 |
config['threads_compress'] |
|
|
40 |
shell: |
|
|
41 |
'''{bin_dir}/auto_uncompress {input} \ |
|
|
42 |
| fastq_to_fasta -r -n \ |
|
|
43 |
| pigz -p {threads} -c > {output} |
|
|
44 |
''' |