Skip to content

Commit

Permalink
Merge branch 'master' into write_config_taxprofiler
Browse files Browse the repository at this point in the history
  • Loading branch information
sofstam authored Jan 28, 2025
2 parents 24d5787 + 594366b commit 4c2445e
Show file tree
Hide file tree
Showing 254 changed files with 14,542 additions and 5,769 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 66.0.2
current_version = 67.0.8
commit = True
tag = True
tag_name = v{new_version}
Expand Down
2 changes: 1 addition & 1 deletion cg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__title__ = "cg"
__version__ = "66.0.2"
__version__ = "67.0.8"
3 changes: 2 additions & 1 deletion cg/apps/hermes/hermes_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __init__(self, config: dict):
self.process = Process(
binary=config["hermes"]["binary_path"],
)
self.container_path: str = config["hermes"]["container_path"]
self.container_mount_volume = config["hermes"]["container_mount_volume"]

def convert_deliverables(
Expand All @@ -33,7 +34,7 @@ def convert_deliverables(
"run",
"--bind",
self.container_mount_volume,
"/home/proj/stage/singularity_containers/hermes_latest.sif",
self.container_path,
"convert",
"deliverables",
"--workflow",
Expand Down
2 changes: 1 addition & 1 deletion cg/apps/orderform/excel_orderform_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from cg.constants import DataDelivery
from cg.constants.orderforms import Orderform
from cg.exc import OrderFormError
from cg.models.orders.constants import OrderType
from cg.models.orders.excel_sample import ExcelSample
from cg.models.orders.order import OrderType

LOG = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion cg/apps/orderform/json_orderform_parser.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from cg.apps.orderform.orderform_parser import OrderformParser
from cg.constants import DataDelivery, Workflow
from cg.exc import OrderFormError
from cg.models.orders.constants import OrderType
from cg.models.orders.json_sample import JsonSample
from cg.models.orders.order import OrderType


class JsonOrderformParser(OrderformParser):
Expand Down
2 changes: 1 addition & 1 deletion cg/apps/orderform/orderform_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from cg.apps.orderform.utils import ORDER_TYPES_WITH_CASES
from cg.constants import DataDelivery
from cg.exc import OrderFormError
from cg.models.orders.order import OrderType
from cg.models.orders.constants import OrderType
from cg.models.orders.orderform_schema import OrderCase, Orderform, OrderPool
from cg.models.orders.sample_base import OrderSample
from cg.store.models import Customer
Expand Down
30 changes: 26 additions & 4 deletions cg/cli/workflow/fluffy/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

ARGUMENT_CASE_ID = click.argument("case_id", required=True)
OPTION_EXTERNAL_REF = click.option("-e", "--external-ref", is_flag=True)
OPTION_USE_BWA_MEM = click.option("-b", "--use-bwa-mem", is_flag=True)

LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -51,15 +52,27 @@ def create_samplesheet(context: CGConfig, case_id: str, dry_run: bool):
@DRY_RUN
@click.option("-c", "--config", help="Path to fluffy config in .json format")
@OPTION_EXTERNAL_REF
@OPTION_USE_BWA_MEM
@click.pass_obj
def run(context: CGConfig, case_id: str, dry_run: bool, config: str, external_ref: bool = False):
def run(
context: CGConfig,
case_id: str,
dry_run: bool,
config: str,
external_ref: bool,
use_bwa_mem: bool,
):
"""
Run Fluffy analysis
"""
analysis_api: FluffyAnalysisAPI = context.meta_apis["analysis_api"]
analysis_api.status_db.verify_case_exists(case_internal_id=case_id)
analysis_api.run_fluffy(
case_id=case_id, workflow_config=config, dry_run=dry_run, external_ref=external_ref
case_id=case_id,
workflow_config=config,
dry_run=dry_run,
external_ref=external_ref,
use_bwa_mem=use_bwa_mem,
)
if dry_run:
return
Expand All @@ -78,12 +91,14 @@ def run(context: CGConfig, case_id: str, dry_run: bool, config: str, external_re
@DRY_RUN
@click.option("-c", "--config", help="Path to fluffy config in .json format")
@OPTION_EXTERNAL_REF
@OPTION_USE_BWA_MEM
@click.pass_context
def start(
context: click.Context,
case_id: str,
dry_run: bool,
external_ref: bool = False,
external_ref: bool,
use_bwa_mem: bool,
config: str = None,
):
"""
Expand All @@ -96,7 +111,14 @@ def start(
analysis_api.prepare_fastq_files(case_id=case_id, dry_run=dry_run)
context.invoke(link, case_id=case_id, dry_run=dry_run)
context.invoke(create_samplesheet, case_id=case_id, dry_run=dry_run)
context.invoke(run, case_id=case_id, config=config, dry_run=dry_run, external_ref=external_ref)
context.invoke(
run,
case_id=case_id,
config=config,
dry_run=dry_run,
external_ref=external_ref,
use_bwa_mem=use_bwa_mem,
)


@fluffy.command("start-available")
Expand Down
9 changes: 1 addition & 8 deletions cg/constants/orderforms.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
from enum import StrEnum

from cg.constants import ANALYSIS_SOURCES, METAGENOME_SOURCES
from cg.models.orders.order import OrderType

SEX_MAP = {"male": "M", "female": "F", "unknown": "unknown"}
REV_SEX_MAP = {value: key for key, value in SEX_MAP.items()}
CONTAINER_TYPES = ["Tube", "96 well plate"]
SOURCE_TYPES = set().union(METAGENOME_SOURCES, ANALYSIS_SOURCES)

CASE_PROJECT_TYPES = [
OrderType.MIP_DNA,
OrderType.BALSAMIC,
OrderType.MIP_RNA,
]


class Orderform(StrEnum):
BALSAMIC: str = "1508"
Expand Down Expand Up @@ -79,4 +71,5 @@ def get_current_orderform_version(order_form: str) -> str:
"LaboratorieMedicinskt Centrum Gotland": "621 84 Visby",
"Unilabs Eskilstuna Laboratorium": "631 88 Eskilstuna",
"Norrland University Hospital": "901 85 Umeå",
"Länssjukhuset Sundsvall": "856 43 Sundsvall",
}
1 change: 1 addition & 0 deletions cg/constants/scout.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class ScoutUploadKey(StrEnum):

RAREDISEASE_SAMPLE_TAGS: dict[str, set[str]] = dict(
alignment_file={AlignmentFileTag.CRAM},
d4_file={"d4"},
vcf2cytosure={"vcf2cytosure"},
mt_bam={"bam-mt"},
eklipse_path={"eklipse-png"},
Expand Down
6 changes: 6 additions & 0 deletions cg/exc.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ class OrderError(CgError):
"""


class OrderSubmissionError(CgError):
"""
Exception related to order submission.
"""


class OrderFormError(CgError):
"""
Exception related to the order form.
Expand Down
1 change: 0 additions & 1 deletion cg/meta/orders/__init__.py

This file was deleted.

48 changes: 0 additions & 48 deletions cg/meta/orders/api.py

This file was deleted.

1 change: 1 addition & 0 deletions cg/meta/upload/scout/hk_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class SampleTags(BaseModel):
bam_file: set[str] | None = None
alignment_file: set[str] | None = None
alignment_path: set[str] | None = None
d4_file: set[str] | None = None
vcf2cytosure: set[str] | None = None
eklipse_path: set[str] | None = None
mt_bam: set[str] | None = None
Expand Down
9 changes: 4 additions & 5 deletions cg/meta/upload/scout/raredisease_config_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
from cg.apps.lims import LimsAPI
from cg.apps.madeline.api import MadelineAPI
from cg.constants.constants import FileFormat
from cg.constants.housekeeper_tags import (
HK_DELIVERY_REPORT_TAG,
AnalysisTag,
NFAnalysisTags,
)
from cg.constants.housekeeper_tags import HK_DELIVERY_REPORT_TAG, AnalysisTag, NFAnalysisTags
from cg.constants.scout import (
RANK_MODEL_THRESHOLD,
RAREDISEASE_CASE_TAGS,
Expand Down Expand Up @@ -206,3 +202,6 @@ def include_sample_files(self, config_sample: ScoutRarediseaseIndividual) -> Non
config_sample.mitodel_file = self.get_sample_file(
hk_tags=self.sample_tags.mitodel_file, sample_id=sample_id
)
config_sample.d4_file = self.get_sample_file(
hk_tags=self.sample_tags.d4_file, sample_id=sample_id
)
14 changes: 9 additions & 5 deletions cg/meta/workflow/fluffy.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,12 @@ def make_sample_sheet(self, case_id: str, dry_run: bool) -> None:
fluffy_sample_sheet.write_sample_sheet(sample_sheet_out_path)

def run_fluffy(
self, case_id: str, dry_run: bool, workflow_config: str, external_ref: bool = False
self,
case_id: str,
dry_run: bool,
workflow_config: str,
external_ref: bool,
use_bwa_mem: bool,
) -> None:
"""
Call fluffy with the configured command-line arguments
Expand All @@ -239,10 +244,8 @@ def run_fluffy(
shutil.rmtree(output_path, ignore_errors=True)
if not workflow_config:
workflow_config = self.fluffy_config.as_posix()
if not external_ref:
batch_ref_flag = "--batch-ref"
else:
batch_ref_flag = ""
batch_ref_flag = "" if external_ref else "--batch-ref"
use_bwa_mem_flag = "--bwa-mem" if use_bwa_mem else ""
command_args = [
"--config",
workflow_config,
Expand All @@ -254,6 +257,7 @@ def run_fluffy(
self.get_output_path(case_id=case_id).as_posix(),
"--analyse",
batch_ref_flag,
use_bwa_mem_flag,
"--slurm_params",
self.get_slurm_param_qos(case_id=case_id),
]
Expand Down
10 changes: 6 additions & 4 deletions cg/models/cg_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
from cg.meta.delivery.delivery import DeliveryAPI
from cg.services.analysis_service.analysis_service import AnalysisService
from cg.services.decompression_service.decompressor import Decompressor
from cg.services.deliver_files.factory import (
DeliveryServiceFactory,
)
from cg.services.deliver_files.factory import DeliveryServiceFactory
from cg.services.deliver_files.rsync.models import RsyncDeliveryConfig
from cg.services.deliver_files.rsync.service import DeliveryRsyncService
from cg.services.fastq_concatenation_service.fastq_concatenation_service import (
Expand Down Expand Up @@ -147,6 +145,10 @@ class CommonAppConfig(BaseModel):
container_mount_volume: str | None = None


class HermesConfig(CommonAppConfig):
container_path: str


class FluffyUploadConfig(BaseModel):
user: str
password: str
Expand Down Expand Up @@ -427,7 +429,7 @@ class CGConfig(BaseModel):
genotype_api_: GenotypeAPI = None
gens: CommonAppConfig = None
gens_api_: GensAPI = None
hermes: CommonAppConfig = None
hermes: HermesConfig = None
hermes_api_: HermesApi = None
janus: ClientConfig | None = None
janus_api_: JanusAPIClient | None = None
Expand Down
43 changes: 0 additions & 43 deletions cg/models/orders/order.py

This file was deleted.

Loading

0 comments on commit 4c2445e

Please sign in to comment.