Skip to content

Commit

Permalink
Add known fusions file input option
Browse files Browse the repository at this point in the history
  • Loading branch information
zkuralt committed Sep 30, 2024
1 parent 231d76a commit 943428d
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Added
- Allow filtering ``Sample`` by ``Variant``
- Allow filtering variant annotations by variant id
- Add filters to ``Variant`` and ``VariantCall`` objects
- Add ``known_fusions`` file input to ``arriba`` process and
``gene-fusion-calling-arriba`` workflow

Changed
-------
Expand Down
12 changes: 11 additions & 1 deletion resolwe_bio/processes/fusion_calling/arriba.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Arriba(Process):
slug = "arriba"
name = "Arriba"
process_type = "data:genefusions:arriba"
version = "1.0.2"
version = "1.1.0"
category = "Gene fusions"
scheduling_class = SchedulingClass.BATCH
entity = {"type": "sample"}
Expand Down Expand Up @@ -83,6 +83,13 @@ class Input:
required=False,
)

known_fusions_file = DataField(
data_type="file",
label="Known fusions file",
description="Arriba known fusions file.",
required=False,
)

class Output:
"""Output fields for Arriba process."""

Expand Down Expand Up @@ -148,6 +155,9 @@ def run(self, inputs, outputs):
else:
args.extend(["-f", "blacklist"])

if inputs.known_fusions_file:
args.extend(["-k", inputs.known_fusions_file.output.file.path])

return_code, stdout, stderr = Cmd["arriba"][args] & TEE(retcode=None)

if return_code:
Expand Down
12 changes: 11 additions & 1 deletion resolwe_bio/processes/workflows/gene-fusion-calling-arriba.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class WorkflowGeneFusionCallingArriba(Process):

slug = "gene-fusion-calling-arriba"
name = "Gene Fusion Calling with Arriba"
version = "1.0.0"
version = "1.1.0"
process_type = "data:workflow:genefusions:arriba"
category = "Pipeline"
entity = {"type": "sample"}
Expand Down Expand Up @@ -89,6 +89,13 @@ class Input:
required=False,
)

known_fusions_file = DataField(
data_type="file",
label="Known fusions file",
description="Arriba known fusions file.",
required=False,
)

class ChimericReadsOptions:
"""Chimeric reads options."""

Expand Down Expand Up @@ -246,6 +253,9 @@ def run(self, inputs, outputs):
if inputs.blacklist_file:
arriba_input["blacklist_file"] = inputs.blacklist_file.id

if inputs.known_fusions_file:
arriba_input["known_fusions_file"] = inputs.known_fusions_file.id

fusion_name = (
f"Fusions ({inputs.bam.name})"
if inputs.bam
Expand Down
Binary file not shown.
8 changes: 8 additions & 0 deletions resolwe_bio/tests/processes/test_arriba.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,18 @@ def test_arriba_fusion_detection(self):
},
)

known_fusions_file = self.run_process(
process_slug="upload-file",
input_={
"src": input_folder / "known_fusions.tsv.gz",
},
)

arriba_inputs = {
"bam": bam.id,
"gtf": gtf_file.id,
"genome": genome_file.id,
"known_fusions_file": known_fusions_file.id,
}

arriba = self.run_process("arriba", arriba_inputs)
Expand Down
16 changes: 16 additions & 0 deletions resolwe_bio/tests/workflows/test_fusion_calling_arriba.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,18 @@ def test_gene_fusion_workflow_with_bam(self):
},
)

known_fusions_file = self.run_process(
process_slug="upload-file",
input_={
"src": input_folder / "known_fusions.tsv.gz",
},
)

workflow_inputs = {
"bam": bam.id,
"gtf": gtf_file.id,
"genome": genome_file.id,
"known_fusions_file": known_fusions_file.id,
}

self.run_process("gene-fusion-calling-arriba", workflow_inputs)
Expand Down Expand Up @@ -101,11 +109,19 @@ def test_gene_fusion_workflow_with_fastq(self):
input_={"ref_seq": genome_file.id, "annotation": gtf_file.id},
)

known_fusions_file = self.run_process(
process_slug="upload-file",
input_={
"src": input_folder / "known_fusions.tsv.gz",
},
)

workflow_inputs = {
"reads": reads.id,
"gtf": gtf_file.id,
"genome": genome_file.id,
"star_index": star_index.id,
"known_fusions_file": known_fusions_file.id,
}

self.run_process("gene-fusion-calling-arriba", workflow_inputs)
Expand Down

0 comments on commit 943428d

Please sign in to comment.