Skip to content

Commit 5b53a38

Browse files
authored
Merge branch 'master' into add-nallo-loqusdb-upload
2 parents 6176af1 + 6922e03 commit 5b53a38

File tree

64 files changed

+846
-310
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+846
-310
lines changed

.bumpversion.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 69.3.0
2+
current_version = 69.5.3
33
commit = True
44
tag = True
55
tag_name = v{new_version}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
"""add Nallo ordertype
2+
3+
Revision ID: 6362cfd4c61f
4+
Revises: 3a0250e5526d
5+
Create Date: 2025-04-17 10:42:20.943466
6+
7+
"""
8+
9+
import sqlalchemy as sa
10+
11+
from alembic import op
12+
13+
# revision identifiers, used by Alembic.
14+
revision = "6362cfd4c61f"
15+
down_revision = "3a0250e5526d"
16+
branch_labels = None
17+
depends_on = None
18+
19+
old_order_types = [
20+
"BALSAMIC",
21+
"BALSAMIC_UMI",
22+
"FASTQ",
23+
"FLUFFY",
24+
"METAGENOME",
25+
"MICROBIAL_FASTQ",
26+
"MICROSALT",
27+
"MIP_DNA",
28+
"MIP_RNA",
29+
"PACBIO_LONG_READ",
30+
"RML",
31+
"RNAFUSION",
32+
"SARS_COV_2",
33+
"TAXPROFILER",
34+
"TOMTE",
35+
]
36+
37+
new_order_types = old_order_types.copy()
38+
new_order_types.append("NALLO")
39+
40+
41+
def upgrade():
42+
op.alter_column(
43+
table_name="order_type_application",
44+
column_name="order_type",
45+
existing_type=sa.Enum(*old_order_types),
46+
type_=sa.Enum(*new_order_types),
47+
nullable=False,
48+
)
49+
50+
51+
def downgrade():
52+
op.alter_column(
53+
table_name="order_type_application",
54+
column_name="order_type",
55+
existing_type=sa.Enum(*new_order_types),
56+
type_=sa.Enum(*old_order_types),
57+
nullable=False,
58+
)

cg/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
__title__ = "cg"
2-
__version__ = "69.3.0"
2+
__version__ = "69.5.3"

cg/apps/scout/scoutapi.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
class ScoutAPI:
2121
"""Interface to Scout."""
2222

23-
def __init__(self, config, slurm_upload_service: SlurmUploadService):
24-
binary_path = config["scout"]["binary_path"]
25-
config_path = config["scout"]["config_path"]
23+
def __init__(self, scout_config, slurm_upload_service: SlurmUploadService):
24+
binary_path = scout_config.binary_path
25+
config_path = scout_config.config_path
2626
self.process = Process(binary=binary_path, config=config_path)
2727
self.slurm_upload_service = slurm_upload_service
2828
self.scout_base_command = f"{binary_path} --config {config_path}"

cg/cli/clean.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def scout_finished_cases(
122122
context: click.Context, days_old: int, skip_confirmation: bool = False, dry_run: bool = False
123123
) -> None:
124124
"""Clean up of solved and archived Scout cases."""
125-
scout_api: ScoutAPI = context.obj.scout_api
125+
scout_api: ScoutAPI = context.obj.scout_api_37
126126
bundles: list[str] = []
127127
for status in [ScoutTag.ARCHIVED, ScoutTag.SOLVED]:
128128
cases: list[ScoutExportCase] = scout_api.get_cases(status=status, reruns=False)

cg/cli/deliver/base.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
from cg.services.deliver_files.deliver_files_service.deliver_files_service import (
1616
DeliverFilesService,
1717
)
18-
from cg.services.deliver_files.factory import (
19-
DeliveryServiceFactory,
20-
)
18+
from cg.services.deliver_files.factory import DeliveryServiceFactory
2119
from cg.services.deliver_files.rsync.service import DeliveryRsyncService
2220
from cg.store.models import Analysis, Case
2321

@@ -29,6 +27,7 @@
2927
multiple=False,
3028
type=click.Choice(choices=[option for option in FileDeliveryOption]),
3129
required=False,
30+
help="The delivery type to use. Overrides any delivery type from the case",
3231
)
3332
TICKET_ID_ARG = click.option("-t", "--ticket", type=str, required=True)
3433

cg/cli/upload/mutacc.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from cg.apps.mutacc_auto import MutaccAutoAPI
88
from cg.apps.scout.scout_export import ScoutExportCase
99
from cg.apps.scout.scoutapi import ScoutAPI
10+
from cg.cli.upload.utils import get_scout_api
1011
from cg.constants.cli_options import DRY_RUN
1112
from cg.meta.upload.mutacc import UploadToMutaccAPI
1213
from cg.models.cg_config import CGConfig
@@ -28,7 +29,7 @@ def process_solved(
2829

2930
LOG.info("----------------- PROCESS-SOLVED ----------------")
3031

31-
scout_api: ScoutAPI = context.scout_api
32+
scout_api: ScoutAPI = get_scout_api(cg_config=context, case_id=case_id)
3233
mutacc_auto_api: MutaccAutoAPI = context.mutacc_auto_api
3334
mutacc_upload_api = UploadToMutaccAPI(scout_api=scout_api, mutacc_auto_api=mutacc_auto_api)
3435

cg/cli/upload/scout.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from cg.apps.housekeeper.hk import HousekeeperAPI
1010
from cg.apps.scout.scoutapi import ScoutAPI
11-
from cg.cli.upload.utils import suggest_cases_to_upload
11+
from cg.cli.upload.utils import get_scout_api, suggest_cases_to_upload
1212
from cg.constants import Workflow
1313
from cg.constants.cli_options import DRY_RUN
1414
from cg.constants.constants import FileFormat
@@ -145,7 +145,7 @@ def upload_case_to_scout(context: CGConfig, re_upload: bool, dry_run: bool, case
145145
LOG.info("----------------- UPLOAD -----------------------")
146146

147147
housekeeper_api: HousekeeperAPI = context.housekeeper_api
148-
scout_api: ScoutAPI = context.scout_api
148+
scout_api: ScoutAPI = get_scout_api(cg_config=context, case_id=case_id)
149149

150150
tag_name: str = UploadScoutAPI.get_load_config_tag()
151151
version: Version = housekeeper_api.last_version(bundle=case_id)

cg/cli/upload/utils.py

+7
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
import rich_click as click
66

7+
from cg.apps.scout.scoutapi import ScoutAPI
78
from cg.constants import Workflow
89
from cg.constants.constants import MAX_ITEMS_TO_RETRIEVE
10+
from cg.models.cg_config import CGConfig
911
from cg.store.models import Analysis
1012
from cg.store.store import Store
1113

@@ -20,3 +22,8 @@ def suggest_cases_to_upload(status_db: Store, workflow: Workflow | None = None)
2022
]
2123
for case_obj in records:
2224
click.echo(case_obj)
25+
26+
27+
def get_scout_api(cg_config: CGConfig, case_id: str) -> ScoutAPI:
28+
workflow = cg_config.status_db.get_case_by_internal_id(case_id).data_analysis
29+
return cg_config.scout_api_38 if workflow == Workflow.NALLO else cg_config.scout_api_37

cg/constants/constants.py

+3
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ class DataDelivery(StrEnum):
176176
FASTQ_ANALYSIS_SCOUT: str = "fastq-analysis-scout"
177177
NIPT_VIEWER: str = "nipt-viewer"
178178
NO_DELIVERY: str = "no-delivery"
179+
RAW_DATA_ANALYSIS: str = "raw_data-analysis"
180+
RAW_DATA_ANALYSIS_SCOUT: str = "raw_data-analysis-scout"
181+
RAW_DATA_SCOUT: str = "raw_data-scout"
179182
SCOUT: str = "scout"
180183
STATINA: str = "statina"
181184

cg/constants/delivery.py

+2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868

6969
RAW_DATA_ANALYSIS_SAMPLE_TAGS: list[set[str]] = [
7070
{"fastq"},
71+
{"bam"},
7172
]
7273

7374
MIP_DNA_ANALYSIS_CASE_TAGS: list[set[str]] = [
@@ -200,3 +201,4 @@ class FileDeliveryOption(StrEnum):
200201
BAM: str = "bam"
201202
FASTQ: str = "fastq"
202203
FASTQ_ANALYSIS: str = "fastq-analysis"
204+
RAW_DATA_ANALYSIS: str = "raw_data-analysis"

cg/constants/nf_analysis.py

-4
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,11 @@ class NfTowerStatus(StrEnum):
2020
"predicted_sex_sex_check": {"norm": "eq", "threshold": None},
2121
}
2222

23-
RAREDISEASE_ADAPTER_BASES_PERCENTAGE_THRESHOLD = 0.005
24-
2523
RAREDISEASE_PREDICTED_SEX_METRIC = "predicted_sex_sex_check"
2624

2725
RAREDISEASE_METRIC_CONDITIONS_WES: dict[str, dict[str, Any]] = {
2826
"PERCENT_DUPLICATION": {"norm": "lt", "threshold": 0.20},
2927
"Contamination Status": {"norm": "eq", "threshold": "NO"},
30-
"adapter_cutting_adapter_trimmed_reads": {"norm": "lt", "threshold": None},
3128
"PCT_PF_UQ_READS_ALIGNED": {"norm": "gt", "threshold": 0.95},
3229
"PCT_TARGET_BASES_10X": {"norm": "gt", "threshold": 0.95},
3330
"AT_DROPOUT": {"norm": "lt", "threshold": 10},
@@ -39,7 +36,6 @@ class NfTowerStatus(StrEnum):
3936
RAREDISEASE_METRIC_CONDITIONS_WGS: dict[str, dict[str, Any]] = {
4037
"PERCENT_DUPLICATION": {"norm": "lt", "threshold": 0.20},
4138
"Contamination Status": {"norm": "eq", "threshold": "NO"},
42-
"adapter_cutting_adapter_trimmed_reads": {"norm": "lt", "threshold": None},
4339
"PCT_PF_UQ_READS_ALIGNED": {"norm": "gt", "threshold": 0.95},
4440
"MEDIAN_TARGET_COVERAGE": {"norm": "gt", "threshold": 25},
4541
"PCT_TARGET_BASES_10X": {"norm": "gt", "threshold": 0.95},

cg/constants/report.py

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
DataDelivery.FASTQ_ANALYSIS_SCOUT,
3838
DataDelivery.FASTQ_QC_ANALYSIS,
3939
DataDelivery.FASTQ_SCOUT,
40+
DataDelivery.RAW_DATA_ANALYSIS,
41+
DataDelivery.RAW_DATA_ANALYSIS_SCOUT,
42+
DataDelivery.RAW_DATA_SCOUT,
4043
DataDelivery.SCOUT,
4144
)
4245

cg/constants/scout.py

+8-20
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ class ScoutUploadKey(StrEnum):
6565
NALLO_CASE_TAGS = dict(
6666
delivery_report={"delivery-report"},
6767
multiqc={"multiqc-html"},
68+
peddy_check={"ped-check", "peddy"},
69+
peddy_ped={"ped", "peddy"},
70+
peddy_sex={"sex-check", "peddy"},
6871
vcf_snv_research={"vcf-snv-research"},
6972
vcf_snv={"vcf-snv-clinical"},
7073
vcf_sv_research={"vcf-sv-research"},
@@ -89,18 +92,6 @@ class ScoutUploadKey(StrEnum):
8992
vcf_str={"vcf-str"},
9093
)
9194

92-
NALLO_CASE_TAGS = dict(
93-
delivery_report={"delivery-report"},
94-
multiqc={"multiqc-html"},
95-
somalier_pairs={"relate-pairs", "somalier"},
96-
somalier_samples={"relate-samples", "somalier"},
97-
vcf_snv_research={"vcf-snv-research"},
98-
vcf_snv={"vcf-snv-clinical"},
99-
vcf_sv_research={"vcf-sv-research"},
100-
vcf_sv={"vcf-sv-clinical"},
101-
vcf_str={"vcf-str"},
102-
)
103-
10495
BALSAMIC_CASE_TAGS = dict(
10596
sv_vcf={"vcf-sv-clinical"},
10697
snv_vcf={"vcf-snv-clinical"},
@@ -146,11 +137,14 @@ class ScoutUploadKey(StrEnum):
146137
)
147138

148139
NALLO_SAMPLE_TAGS: dict[str, set[str]] = dict(
149-
alignment_file={"alignment_haplotags"},
140+
alignment_path={AlignmentFileTag.BAM, "haplotags"},
141+
assembly_alignment_path={AlignmentFileTag.BAM, "assembly"},
150142
d4_file={"mosdepth_d4"},
143+
hificnv_coverage={"hificnv", "bigwig"},
144+
paraphase_alignment_path={AlignmentFileTag.BAM, NalloAnalysisTag.PARAPHASE},
145+
minor_allele_frequency_wig={"hificnv", "bigwig", "maf"},
151146
)
152147

153-
154148
MIP_SAMPLE_TAGS: dict[str, set[str]] = dict(
155149
bam_file={"bam"},
156150
alignment_file={"cram"},
@@ -166,12 +160,6 @@ class ScoutUploadKey(StrEnum):
166160
mitodel_file={"mitodel"},
167161
)
168162

169-
NALLO_SAMPLE_TAGS: dict[str, set[str]] = dict(
170-
alignment_file={AlignmentFileTag.BAM, NalloAnalysisTag.HAPLOTAGS},
171-
d4_file={"d4"},
172-
paraphase_alignment_path={AlignmentFileTag.BAM, NalloAnalysisTag.PARAPHASE},
173-
)
174-
175163
BALSAMIC_SAMPLE_TAGS = dict(
176164
bam_file={"bam"},
177165
alignment_file={"cram"},

cg/constants/sequencing.py

-2
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,3 @@ class SeqLibraryPrepCategory(StrEnum):
7979
SeqLibraryPrepCategory.TARGETED_GENOME_SEQUENCING,
8080
SeqLibraryPrepCategory.WHOLE_EXOME_SEQUENCING,
8181
]
82-
83-
NOVASEQ_SEQUENCING_READ_LENGTH = 151

cg/meta/delivery_report/delivery_report_api.py

+1-8
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,7 @@
3737
SampleModel,
3838
TimestampModel,
3939
)
40-
from cg.store.models import (
41-
Analysis,
42-
Application,
43-
ApplicationLimitations,
44-
Case,
45-
CaseSample,
46-
Sample,
47-
)
40+
from cg.store.models import Analysis, Application, ApplicationLimitations, Case, CaseSample, Sample
4841
from cg.store.store import Store
4942

5043
LOG = logging.getLogger(__name__)

cg/meta/delivery_report/mip_dna.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
from cg.meta.delivery_report.data_validators import get_million_read_pairs
2020
from cg.meta.delivery_report.delivery_report_api import DeliveryReportAPI
2121
from cg.meta.workflow.mip_dna import MipDNAAnalysisAPI
22-
from cg.models.mip.mip_analysis import MipAnalysis
23-
from cg.models.mip.mip_metrics_deliverables import get_sample_id_metric
2422
from cg.models.delivery_report.metadata import MipDNASampleMetadataModel
2523
from cg.models.delivery_report.report import CaseModel, ReportRequiredFields, ScoutVariantsFiles
2624
from cg.models.delivery_report.sample import SampleModel
25+
from cg.models.mip.mip_analysis import MipAnalysis
26+
from cg.models.mip.mip_metrics_deliverables import get_sample_id_metric
2727
from cg.store.models import Case, Sample
2828

2929
LOG = logging.getLogger(__name__)

cg/meta/meta.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def __init__(self, config: CGConfig):
4949
),
5050
),
5151
)
52-
self.scout_api: ScoutAPI = config.scout_api
52+
self.scout_api_37: ScoutAPI = config.scout_api_37
53+
self.scout_api_38: ScoutAPI = config.scout_api_38
5354
self.status_db: Store = config.status_db
5455
self.trailblazer_api: TrailblazerAPI = config.trailblazer_api

cg/meta/upload/scout/hk_tags.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ class CaseTags(BaseModel):
2929
)
3030
cnv_report: set[str] | None = Field(None, description="CNV visualization report for cancer")
3131
smn_tsv: set[str] | None = Field(None, description="SMN gene variants, only for rare disease")
32-
peddy_ped: set[str] = Field(None, description="Ped info from peddy, only for rare disease")
33-
peddy_sex: set[str] | None = Field(None, description="Peddy sex check, only for rare disease")
34-
peddy_check: set[str] = Field(None, description="Peddy pedigree check, only for rare disease")
32+
peddy_ped: set[str] = Field(None, description="Ped info from peddy")
33+
peddy_sex: set[str] | None = Field(None, description="Peddy sex check")
34+
peddy_check: set[str] = Field(None, description="Peddy pedigree check")
3535
somalier_samples: set[str] = Field(None, description="Somalier samples info")
3636
somalier_pairs: set[str] = Field(None, description="Somalier pairs info")
37-
sex_check: set[str] = Field(None, description="Somalier sex check info, only for rare disease")
37+
sex_check: set[str] = Field(None, description="Somalier sex check info")
3838
multiqc_report: set[str] | None = Field(None, description="MultiQC report")
3939
multiqc: set[str] | None = Field(None, description="MultiQC report")
4040
delivery_report: set[str] | None = Field(None, description="Delivery report")
@@ -74,6 +74,7 @@ class SampleTags(BaseModel):
7474
bam_file: set[str] | None = None
7575
alignment_file: set[str] | None = None
7676
alignment_path: set[str] | None = None
77+
assembly_alignment_path: set[str] | None = None
7778
d4_file: set[str] | None = None
7879
vcf2cytosure: set[str] | None = None
7980
eklipse_path: set[str] | None = None
@@ -82,6 +83,8 @@ class SampleTags(BaseModel):
8283
chromograph_coverage: set[str] | None = None
8384
chromograph_regions: set[str] | None = None
8485
chromograph_sites: set[str] | None = None
86+
hificnv_coverage: set[str] | None = None
87+
minor_allele_frequency_wig: set[str] | None = None
8588
reviewer_alignment: set[str] | None = None
8689
reviewer_alignment_index: set[str] | None = None
8790
reviewer_catalog: set[str] | None = None

cg/meta/upload/scout/mip_config_builder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def build_load_config(
8181
load_config.samples.append(
8282
self.build_config_sample(case_sample=db_sample, hk_version=hk_version)
8383
)
84-
self.include_pedigree_picture(load_config)
84+
self.include_pedigree_picture(load_config=load_config, analysis=analysis)
8585
return load_config
8686

8787
def include_case_files(self, load_config: MipLoadConfig, hk_version: Version) -> None:

0 commit comments

Comments
 (0)