-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add nallo cg workflow config-case (#4098)
### Added - cg workflow nallo config-case
- Loading branch information
Showing
9 changed files
with
360 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
from enum import StrEnum | ||
from pathlib import Path | ||
|
||
from pydantic import BaseModel, field_validator | ||
|
||
from cg.exc import NfSampleSheetError | ||
from cg.models.nf_analysis import WorkflowParameters | ||
|
||
|
||
class NalloSampleSheetEntry(BaseModel): | ||
"""Nallo sample model is used when building the sample sheet.""" | ||
|
||
project: str | ||
sample: str | ||
read_file: Path | ||
family_id: str | ||
paternal_id: str | ||
maternal_id: str | ||
sex: int | ||
phenotype: int | ||
|
||
@property | ||
def reformat_sample_content(self) -> list[list[str]]: | ||
"""Reformat sample sheet content as a list of lists, where each list represents a line in the final file.""" | ||
return [ | ||
[ | ||
self.project, | ||
self.sample, | ||
self.read_file, | ||
self.family_id, | ||
self.paternal_id, | ||
self.maternal_id, | ||
self.sex, | ||
self.phenotype, | ||
] | ||
] | ||
|
||
@field_validator("read_file") | ||
@classmethod | ||
def read_file_exists(cls, bam_path: Path) -> Path: | ||
"""Verify that bam files exist.""" | ||
if not bam_path.is_file(): | ||
raise NfSampleSheetError(f"Bam file does not exist: {str(bam_path)}") | ||
return bam_path | ||
|
||
|
||
class NalloSampleSheetHeaders(StrEnum): | ||
project: str = "project" | ||
sample: str = "sample" | ||
file: str = "file" | ||
family_id: str = "family_id" | ||
paternal_id: str = "paternal_id" | ||
maternal_id: str = "maternal_id" | ||
sex: str = "sex" | ||
phenotype: str = "phenotype" | ||
|
||
@classmethod | ||
def list(cls) -> list[str]: | ||
return list(map(lambda header: header.value, cls)) | ||
|
||
|
||
class NalloParameters(WorkflowParameters): | ||
"""Model for Nallo parameters.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.