GENEFUSE#
A tool to detect and visualize target gene fusions by scanning FASTQ files directly.
URL: https://github.com/OpenGene/GeneFuse
Example#
This wrapper can be used in the following way:
rule genefuse:
input:
fastq1="reads/{sample}_R1.fastq",
fastq2="reads/{sample}_R2.fastq",
config="genes.csv",
reference="genome.fasta",
output:
html="{sample}_genefuse_report.html",
json="{sample}_genefuse_report.json",
fusions="{sample}_fusions.txt",
log:
"logs/{sample}_genefuse.log",
params:
# optional parameters
extra="",
threads:1
wrapper:
"v3.0.4-12-g561ccaf/bio/genefuse"
Note that input, output and log file paths can be chosen freely.
When running with
snakemake --use-conda
the software dependencies will be automatically deployed into an isolated environment before execution.
Notes#
The extra param allows for additional program arguments.
Software dependencies#
genefuse=0.8.0
Input/Output#
Input:
fastq files
gene fuse settings files
refeference genome
Output:
txt file with fusions
html report
json report
Code#
__author__ = "Patrik Smeds"
__copyright__ = "Copyright 2022, Patrik Smeds"
__email__ = "patrik.smeds@scilifelab.uu.se"
__license__ = "MIT"
from snakemake.shell import shell
from tempfile import TemporaryDirectory
# Formats the log redrection string
log = snakemake.log_fmt_shell(stdout=False, stderr=True)
extra = snakemake.params.get("extra", "")
with TemporaryDirectory() as tempdir:
# Executed shell command
html_path = f"{tempdir}/genefuse.html"
json_path = f"{tempdir}/genefuse.json"
txt_path = f"{tempdir}/gene_fuse_fusions.txt"
shell(
"(genefuse "
"-r {snakemake.input.reference} "
"-t {snakemake.threads} "
"-f {snakemake.input.config} "
"-1 {snakemake.input.fastq1} "
"-2 {snakemake.input.fastq2} "
"-h {html_path} "
"-j {json_path} "
"{extra} > "
"{txt_path}) "
"{log}"
)
if snakemake.output.get("html", None):
shell("mv {html_path} {snakemake.output.html}")
if snakemake.output.get("json", None):
shell("mv {json_path} {snakemake.output.json}")
if snakemake.output.get("fusions", None):
shell("mv {txt_path} {snakemake.output.fusions}")