Commit 60b2f40e authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

fix bamtofastq_pairs

parent 93e24e41
...@@ -7,9 +7,11 @@ rule bedtools_bamtofastq_pairs: ...@@ -7,9 +7,11 @@ rule bedtools_bamtofastq_pairs:
input: input:
__bedtools_bamtofastq_pairs_input __bedtools_bamtofastq_pairs_input
output: output:
forward = __bedtools_bamtofastq_pairs_output_forward, forward = f"{__bedtools_bamtofastq_pairs_output_forward_name}.fq.gz",
reverse = __bedtools_bamtofastq_pairs_output_reverse reverse = f"{__bedtools_bamtofastq_pairs_output_reverse_name}.fq.gz"
params: params:
forward_name = __bedtools_bamtofastq_pairs_output_forward_name,
reverse_name = __bedtools_bamtofastq_pairs_output_reverse_name,
exec_command = __bedtools_bamtofastq_pairs_bedtools_exec_command, exec_command = __bedtools_bamtofastq_pairs_bedtools_exec_command,
modules = __bedtools_bamtofastq_pairs_modules modules = __bedtools_bamtofastq_pairs_modules
run: run:
...@@ -17,8 +19,8 @@ rule bedtools_bamtofastq_pairs: ...@@ -17,8 +19,8 @@ rule bedtools_bamtofastq_pairs:
if params.modules: if params.modules:
command.append("module load {params.modules}") command.append("module load {params.modules}")
command.append( command.append(
"{params.exec_command} bamtofastq -i {input} -fq {output.forward}.fastq -fq2 {output.reverse}.fastq" "{params.exec_command} bamtofastq -i {input} -fq {params.forward_name}.fq -fq2 {params.reverse_name}.fq"
) )
command.append("gunzip {output}_1.fastq") command.append("gzip {params.forward_name}.fq")
command.append("gunzip {output}_2.fastq") command.append("gzip {params.reverse_name}.fq")
shell(" && ".join(command)) shell(" && ".join(command))
\ No newline at end of file
...@@ -12,8 +12,15 @@ __input_dir = config.get('input_dir', 'data') ...@@ -12,8 +12,15 @@ __input_dir = config.get('input_dir', 'data')
# ==== Bedtools bamtofastq ==== # ==== Bedtools bamtofastq ====
__bedtools_bamtofastq_pairs_output_dir = f"{__main_output_dir}/bedtools_bamtofastq_pairs" __bedtools_bamtofastq_pairs_output_dir = f"{__main_output_dir}/bedtools_bamtofastq_pairs"
__bedtools_bamtofastq_pairs_input = "{dir}/{{sample}}.bam".format(dir=__input_dir, sample="{sample}") __bedtools_bamtofastq_pairs_input = "{dir}/{{sample}}.bam".format(dir=__input_dir, sample="{sample}")
__bedtools_bamtofastq_pairs_output = "{dir}/{{sample}}".format(dir=__bedtools_bamtofastq_pairs_output_dir, sample="{sample}") __bedtools_bamtofastq_pairs_output_forward_name = "{dir}/{{sample}}_1".format(
dir=__bedtools_bamtofastq_pairs_output_dir, sample="{sample}"
)
__bedtools_bamtofastq_pairs_output_reverse_name = "{dir}/{{sample}}_2".format(
dir=__bedtools_bamtofastq_pairs_output_dir, sample="{sample}"
)
include: __bedtools_bamtofastq_pairs_rules include: __bedtools_bamtofastq_pairs_rules
rule all: rule all:
input: expand("{dir}/{{sample}}_unmapped.bam".format(dir=__bedtools_bamtofastq_pairs_output_dir), sample=SAMPLES) input:
forward = expand(f"{__bedtools_bamtofastq_pairs_output_forward_name}.fq.gz", sample=SAMPLES),
reverse = expand(f"{__bedtools_bamtofastq_pairs_output_reverse_name}.fq.gz", sample=SAMPLES)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment