Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adding somatic neoepitope preparation workflow #495

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
72717b8
Adding somatic neoepitope preparation workflow
Apr 4, 2024
4eab17a
Satisfying code format
Apr 4, 2024
4e08a50
Satisfying black
Apr 4, 2024
0c35c66
Satisfying snakefmt
Apr 4, 2024
b4b36ba
make isort comfort
Apr 4, 2024
f1af42c
update neoepitope prediction
May 22, 2024
2fcf1bf
Make black satisfy
May 22, 2024
cfa36ac
Update snappy_pipeline/workflows/somatic_neoepitope_prediction/Snakefile
giacuong171 Jun 4, 2024
8d9155d
Update snappy_pipeline/workflows/somatic_neoepitope_prediction/__init…
giacuong171 Jun 4, 2024
9776587
Merge branch 'main' into 472-adding-neoepitope-prediction-pipeline
Jun 11, 2024
40cb936
Update preparation for somatic neoepitope prediction
Jun 18, 2024
e645608
Merge branch '472-adding-neoepitope-prediction-pipeline' of github.co…
Jun 18, 2024
23101e8
Update test
Jun 18, 2024
0920803
Adding plugins option to VEP
Jul 1, 2024
9d8a660
Merge branch 'main' into 472-adding-neoepitope-prediction-pipeline
Jul 1, 2024
0d95ea3
Adding plugin options for vep
Jul 3, 2024
1d72562
Reformat neoepitope prediction for new snappy version
Jul 3, 2024
6d9257c
Satisfies lint
Jul 3, 2024
999c6ea
Adding test for somatic neoepitope prediction preparation substep
Jul 5, 2024
a140e28
Preparation for pvactool
Jul 11, 2024
03bd9e4
Fix HLA_typing pipeline
Jul 11, 2024
d43a11b
Adding test for neoepitope prediction
Jul 15, 2024
73e08c6
Adding pvacseq pipeline
Jul 17, 2024
ceb3ae6
Merge branch 'main' into 472-adding-neoepitope-prediction-pipeline
Jul 17, 2024
9670292
make lint happy
Jul 17, 2024
76e0c97
Make linting satisfying
Jul 17, 2024
03c9714
Reformat hla_typing snakefile
Jul 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Project Info
step/ngs_data_qc
step/ngs_mapping
step/somatic_gene_fusion_calling
step/somatic_neoepitope_prediction
step/somatic_purity_ploidy_estimate
step/somatic_targeted_seq_cnv_calling
step/somatic_variant_annotation
Expand Down
2 changes: 2 additions & 0 deletions snappy_pipeline/apps/snappy_snake.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
somatic_gene_fusion_calling,
somatic_hla_loh_calling,
somatic_msi_calling,
somatic_neoepitope_prediction,
somatic_purity_ploidy_estimate,
somatic_targeted_seq_cnv_calling,
somatic_variant_annotation,
Expand Down Expand Up @@ -86,6 +87,7 @@
"somatic_gene_fusion_calling": somatic_gene_fusion_calling,
"somatic_hla_loh_calling": somatic_hla_loh_calling,
"somatic_msi_calling": somatic_msi_calling,
"somatic_neoepitope_prediction": somatic_neoepitope_prediction,
"somatic_purity_ploidy_estimate": somatic_purity_ploidy_estimate,
"somatic_targeted_seq_cnv_calling": somatic_targeted_seq_cnv_calling,
"somatic_variant_annotation": somatic_variant_annotation,
Expand Down
3 changes: 3 additions & 0 deletions snappy_pipeline/models/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ class Vep(SnappyModel):
]
num_threads: int = 8
buffer_size: int = 1000
plugins: list[str] = []
"""To use this option in VEP, you should download the plugin repository from the link https://github.com/Ensembl/VEP_plugins"""
plugins_dir: str = ""
output_options: list[str] = ["everything"]
4 changes: 4 additions & 0 deletions snappy_pipeline/workflow_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
from snappy_pipeline.workflows.somatic_variant_filtration.model import SomaticVariantFiltration
from snappy_pipeline.workflows.somatic_variant_signatures.model import SomaticVariantSignatures
from snappy_pipeline.workflows.somatic_wgs_cnv_calling.model import SomaticWgsCnvCalling
from snappy_pipeline.workflows.somatic_neoepitope_prediction.model import (
SomaticNeoepitopePrediction,
)
from snappy_pipeline.workflows.somatic_wgs_sv_calling.model import SomaticWgsSvCalling
from snappy_pipeline.workflows.sv_calling_targeted.model import SvCallingTargeted
from snappy_pipeline.workflows.sv_calling_wgs.model import SvCallingWgs
Expand Down Expand Up @@ -113,6 +116,7 @@ class StepConfig(TypedDict, total=False):
somatic_gene_fusion_calling: SomaticGeneFusionCalling
somatic_hla_loh_calling: SomaticHlaLohCalling
somatic_msi_calling: SomaticMsiCalling
somatic_neoepitope_prediction: SomaticNeoepitopePrediction
somatic_purity_ploidy_estimate: SomaticPurityPloidyEstimate
somatic_targeted_seq_cnv_calling: SomaticTargetedSeqCnvCalling
somatic_variant_annotation: SomaticVariantAnnotation
Expand Down
86 changes: 44 additions & 42 deletions snappy_pipeline/workflows/hla_typing/Snakefile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why the rules for tools must be put under an if statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have discussed with Till about this bug. The rule hla_typing_arcashla_run gets evaluated, even that arcashla is not defined. So this is a quick fix for this bug.

Original file line number Diff line number Diff line change
Expand Up @@ -67,51 +67,53 @@ rule hla_typing_link_out_run:

# OptiType --------------------------------------------------------------------


rule hla_typing_optitype_run:
input:
**wf.get_input_files("optitype", "run"),
output:
**wf.get_output_files("optitype", "run"),
threads: wf.get_resource("optitype", "run", "threads")
resources:
time=wf.get_resource("optitype", "run", "time"),
memory=wf.get_resource("optitype", "run", "memory"),
partition=wf.get_resource("optitype", "run", "partition"),
tmpdir=wf.get_resource("optitype", "run", "tmpdir"),
log:
**wf.get_log_file("optitype", "run"),
params:
args=wf.substep_dispatch("optitype", "get_args", "run"),
wrapper:
wf.wrapper_path("optitype")
if "optitype" in wf.w_config.step_config["hla_typing"].tools:

rule hla_typing_optitype_run:
input:
**wf.get_input_files("optitype", "run"),
output:
**wf.get_output_files("optitype", "run"),
threads: wf.get_resource("optitype", "run", "threads")
resources:
time=wf.get_resource("optitype", "run", "time"),
memory=wf.get_resource("optitype", "run", "memory"),
partition=wf.get_resource("optitype", "run", "partition"),
tmpdir=wf.get_resource("optitype", "run", "tmpdir"),
log:
**wf.get_log_file("optitype", "run"),
params:
args=wf.substep_dispatch("optitype", "get_args", "run"),
wrapper:
wf.wrapper_path("optitype")


# arcasHLA --------------------------------------------------------------------


# NB: reference is updated in the installed package
rule hla_typing_arcashla_prepare_reference:
output:
touch("work/arcashla.prepare_reference/out/.done"),
log:
"work/arcashla.prepare_reference/log/arcashla.prepare_reference.log",
wrapper:
wf.wrapper_path("arcashla/prepare_reference")


rule hla_typing_arcashla_run:
input:
unpack(wf.get_input_files("arcashla", "run")),
output:
**wf.get_output_files("arcashla", "run"),
threads: wf.get_resource("arcashla", "run", "threads")
resources:
time=wf.get_resource("arcashla", "run", "time"),
memory=wf.get_resource("arcashla", "run", "memory"),
partition=wf.get_resource("arcashla", "run", "partition"),
tmpdir=wf.get_resource("arcashla", "run", "tmpdir"),
log:
wf.get_log_file("arcashla", "run"),
wrapper:
wf.wrapper_path("arcashla/run")
if "arcashla" in wf.w_config.step_config["hla_typing"].tools:

rule hla_typing_arcashla_prepare_reference:
output:
touch("work/arcashla.prepare_reference/out/.done"),
log:
"work/arcashla.prepare_reference/log/arcashla.prepare_reference.log",
wrapper:
wf.wrapper_path("arcashla/prepare_reference")

rule hla_typing_arcashla_run:
input:
unpack(wf.get_input_files("arcashla", "run")),
output:
**wf.get_output_files("arcashla", "run"),
threads: wf.get_resource("arcashla", "run", "threads")
resources:
time=wf.get_resource("arcashla", "run", "time"),
memory=wf.get_resource("arcashla", "run", "memory"),
partition=wf.get_resource("arcashla", "run", "partition"),
tmpdir=wf.get_resource("arcashla", "run", "tmpdir"),
log:
wf.get_log_file("arcashla", "run"),
wrapper:
wf.wrapper_path("arcashla/run")
99 changes: 99 additions & 0 deletions snappy_pipeline/workflows/somatic_neoepitope_prediction/Snakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# -*- coding: utf-8 -*-
"""CUBI Pipeline somatic neoepitope prediction step Snakefile"""

import os

from snappy_pipeline import expand_ref
from snappy_pipeline.workflows.somatic_neoepitope_prediction import (
SomaticNeoepitopePredictionWorkflow,
)

__author__ = "Pham Gia Cuong"


# Configuration ===============================================================


configfile: "config.yaml"


# Expand "$ref" JSON pointers in configuration (also works for YAML)
config, lookup_paths, config_paths = expand_ref("config.yaml", config)

# WorkflowImpl Object Setup ===================================================
wf = SomaticNeoepitopePredictionWorkflow(workflow, config, lookup_paths, config_paths, os.getcwd())


localrules:
# Linking files from work/ to output/ should be done locally
somatic_neoepitope_preparation_link_out_run,


rule all:
input:
wf.get_result_files(),


# Generic linking out ---------------------------------------------------------


rule somatic_neoepitope_preparation_link_out_run:
input:
wf.get_input_files("link_out", "run"),
output:
wf.get_output_files("link_out", "run"),
run:
shell(wf.get_shell_cmd("link_out", "run", wildcards))


rule somatic_neoepitope_prediction_pvactools_install:
output:
**wf.get_output_files("pvacseq", "install"),
params:
container="docker://griffithlab/pvactools",
resources:
time=wf.get_resource("pvacseq", "install", "time"),
memory=wf.get_resource("pvacseq", "install", "memory"),
partition=wf.get_resource("pvacseq", "install", "partition"),
log:
**wf.get_log_file("pvacseq", "install"),
wrapper:
wf.wrapper_path("singularity")


rule somatic_neoepitope_preparation:
input:
unpack(wf.get_input_files("pvacseq", "prepare")),
output:
**wf.get_output_files("pvacseq", "prepare"),
log:
**wf.get_log_file("pvacseq", "prepare"),
threads: wf.get_resource("pvacseq", "prepare", "threads")
resources:
time=wf.get_resource("pvacseq", "prepare", "time"),
memory=wf.get_resource("pvacseq", "prepare", "memory"),
partition=wf.get_resource("pvacseq", "prepare", "partition"),
tmpdir=wf.get_resource("pvacseq", "prepare", "tmpdir"),
params:
**{"args": wf.get_params("pvacseq", "prepare")},
wrapper:
wf.wrapper_path("pvactools/combining")


rule somatic_neoepitope_prediction:
input:
unpack(wf.get_input_files("pvacseq", "predict")),
output:
**wf.get_output_files("pvacseq", "predict"),
log:
**wf.get_log_file("pvacseq", "predict"),
threads: wf.get_resource("pvacseq", "predict", "threads")
resources:
time=wf.get_resource("pvacseq", "predict", "time"),
memory=wf.get_resource("pvacseq", "predict", "memory"),
partition=wf.get_resource("pvacseq", "predict", "partition"),
tmpdir=wf.get_resource("pvacseq", "predict", "tmpdir"),
params:
**{"args": wf.get_params("pvacseq", "predict")},
wrapper:
wf.wrapper_path("pvactools/pvacseq")
Loading
Loading