|
a |
|
b/exseek/snakefiles/bam_to_fastx.snakemake |
|
|
1 |
shell.prefix('set -x;') |
|
|
2 |
include: 'common.snakemake' |
|
|
3 |
|
|
|
4 |
with open(data_dir + '/bam_files.txt', 'r') as f: |
|
|
5 |
bam_files = dict(line.strip().split('\t') for line in f) |
|
|
6 |
|
|
|
7 |
rule all: |
|
|
8 |
input: |
|
|
9 |
fasta=expand('{output_dir}/unmapped/{sample_id}/clean.fa.gz', |
|
|
10 |
output_dir=output_dir, sample_id=sample_ids) |
|
|
11 |
|
|
|
12 |
rule bam_to_fasta: |
|
|
13 |
input: |
|
|
14 |
bam=lambda wildcards: bam_files[wildcards.sample_id] |
|
|
15 |
output: |
|
|
16 |
fasta='{output_dir}/unmapped/{sample_id}/clean.fa.gz' |
|
|
17 |
params: |
|
|
18 |
flags=2816 |
|
|
19 |
shell: |
|
|
20 |
'''samtools fastq -F {params.flags} {input.bam} \ |
|
|
21 |
| fastq_to_fasta -r -z -o {output} |
|
|
22 |
''' |