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

Refactoring main for local dev #771

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
58 changes: 7 additions & 51 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,58 +11,14 @@
from cpg_utils import to_path
from cpg_utils.config import set_config_paths
from cpg_workflows import defaults_config_path
from cpg_workflows.stages.aip import CreateAIPHTML, GenerateSeqrFile, ValidateMOI
from cpg_workflows.stages.cram_qc import CramMultiQC
from cpg_workflows.stages.exomiser import ExomiserSeqrTSV, RunExomiser
from cpg_workflows.stages.fastqc import FastQCMultiQC
from cpg_workflows.stages.fraser import Fraser
from cpg_workflows.stages.gatk_sv.gatk_sv_multisample_1 import (
FilterBatch,
GenotypeBatch,
MergeBatchSites,
)
from cpg_workflows.stages.gatk_sv.gatk_sv_multisample_2 import MtToEsSv
from cpg_workflows.stages.gatk_sv.gatk_sv_single_sample import CreateSampleBatches
from cpg_workflows.stages.gcnv import AnnotateCohortgCNV, AnnotateDatasetCNV, MtToEsCNV
from cpg_workflows.stages.gvcf_qc import GvcfMultiQC
from cpg_workflows.stages.happy_validation import (
ValidationHappyOnVcf,
ValidationMtToVcf,
ValidationParseHappy,
)
from cpg_workflows.stages.large_cohort import AncestryPlots, Frequencies, LoadVqsr
from cpg_workflows.stages.mito import MitoReport
from cpg_workflows.stages.outrider import Outrider
from cpg_workflows.stages.seqr_loader import AnnotateDataset, DatasetVCF, MtToEs
from cpg_workflows.stages.seqr_loader_long_read.bam_to_cram import BamToCram
from cpg_workflows.stages.stripy import Stripy
from cpg_workflows.workflow import StageDecorator, run_workflow
from cpg_workflows.workflow import run_workflow

WORKFLOWS: dict[str, list[StageDecorator]] = {
'aip': [ValidateMOI, CreateAIPHTML, GenerateSeqrFile],
'exomiser': [RunExomiser, ExomiserSeqrTSV],
'pre_alignment': [FastQCMultiQC],
'seqr_loader': [
DatasetVCF,
AnnotateDataset,
MtToEs,
GvcfMultiQC,
CramMultiQC,
Stripy,
MitoReport,
],
'seqr_loader_long_read': [
BamToCram,
],
'validation': [ValidationMtToVcf, ValidationHappyOnVcf, ValidationParseHappy],
'large_cohort': [LoadVqsr, Frequencies, AncestryPlots, GvcfMultiQC, CramMultiQC],
'gatk_sv_singlesample': [CreateSampleBatches],
'gatk_sv_multisample_1': [FilterBatch, GenotypeBatch],
'gatk_sv_sandwich': [MergeBatchSites], # stage to run between FilterBatch & GenotypeBatch
'gatk_sv_multisample_2': [MtToEsSv],
'rare_disease_rnaseq': [Outrider, Fraser],
'gcnv': [AnnotateCohortgCNV, AnnotateDatasetCNV, MtToEsCNV],
}
# Importing WORKFLOWS from the correct file based on the environment:
SM_ENVIRONMENT = os.getenv('PL_ENVIRONMENT', 'production').lower()
if SM_ENVIRONMENT == 'production':
from workflows_prd import WORKFLOWS
else:
from workflows_dev import WORKFLOWS


@click.command(no_args_is_help=True)
Expand Down
12 changes: 12 additions & 0 deletions workflows_dev.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env python3
"""
Dev version of workflows.
"""
from cpg_workflows.stages.cram_qc import CramMultiQC
from cpg_workflows.stages.gvcf_qc import GvcfMultiQC
from cpg_workflows.stages.large_cohort import AncestryPlots, Frequencies, LoadVqsr
from cpg_workflows.workflow import StageDecorator

WORKFLOWS: dict[str, list[StageDecorator]] = {
'large_cohort': [LoadVqsr, Frequencies, AncestryPlots, GvcfMultiQC, CramMultiQC],
}
56 changes: 56 additions & 0 deletions workflows_prd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env python3
"""
Production version of workflows.
"""
from cpg_workflows.stages.aip import CreateAIPHTML, GenerateSeqrFile, ValidateMOI
from cpg_workflows.stages.cram_qc import CramMultiQC
from cpg_workflows.stages.exomiser import ExomiserSeqrTSV, RunExomiser
from cpg_workflows.stages.fastqc import FastQCMultiQC
from cpg_workflows.stages.fraser import Fraser
from cpg_workflows.stages.gatk_sv.gatk_sv_multisample_1 import (
FilterBatch,
GenotypeBatch,
MergeBatchSites,
)
from cpg_workflows.stages.gatk_sv.gatk_sv_multisample_2 import MtToEsSv
from cpg_workflows.stages.gatk_sv.gatk_sv_single_sample import CreateSampleBatches
from cpg_workflows.stages.gcnv import AnnotateCohortgCNV, AnnotateDatasetCNV, MtToEsCNV
from cpg_workflows.stages.gvcf_qc import GvcfMultiQC
from cpg_workflows.stages.happy_validation import (
ValidationHappyOnVcf,
ValidationMtToVcf,
ValidationParseHappy,
)
from cpg_workflows.stages.large_cohort import AncestryPlots, Frequencies, LoadVqsr
from cpg_workflows.stages.mito import MitoReport
from cpg_workflows.stages.outrider import Outrider
from cpg_workflows.stages.seqr_loader import AnnotateDataset, DatasetVCF, MtToEs
from cpg_workflows.stages.seqr_loader_long_read.bam_to_cram import BamToCram
from cpg_workflows.stages.stripy import Stripy
from cpg_workflows.workflow import StageDecorator

WORKFLOWS: dict[str, list[StageDecorator]] = {
'aip': [ValidateMOI, CreateAIPHTML, GenerateSeqrFile],
'exomiser': [RunExomiser, ExomiserSeqrTSV],
'pre_alignment': [FastQCMultiQC],
'seqr_loader': [
DatasetVCF,
AnnotateDataset,
MtToEs,
GvcfMultiQC,
CramMultiQC,
Stripy,
MitoReport,
],
'seqr_loader_long_read': [
BamToCram,
],
'validation': [ValidationMtToVcf, ValidationHappyOnVcf, ValidationParseHappy],
'large_cohort': [LoadVqsr, Frequencies, AncestryPlots, GvcfMultiQC, CramMultiQC],
'gatk_sv_singlesample': [CreateSampleBatches],
'gatk_sv_multisample_1': [FilterBatch, GenotypeBatch],
'gatk_sv_sandwich': [MergeBatchSites], # stage to run between FilterBatch & GenotypeBatch
'gatk_sv_multisample_2': [MtToEsSv],
'rare_disease_rnaseq': [Outrider, Fraser],
'gcnv': [AnnotateCohortgCNV, AnnotateDatasetCNV, MtToEsCNV],
}
Loading