Skip to content

Commit e1e4397

Browse files
committed
replace str with Path objects and rename method
1 parent 7a054b3 commit e1e4397

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

cg/meta/workflow/nallo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ def sample_sheet_headers(self) -> list[str]:
4646

4747
def get_sample_sheet_content_per_sample(self, case_sample: CaseSample) -> list[list[str]]:
4848
"""Collect and format information required to build a sample sheet for a single sample."""
49-
bam_unmapped_read_paths = self.get_unmapped_bam_read_paths(sample=case_sample.sample)
49+
read_file_paths = self.get_bam_read_file_paths(sample=case_sample.sample)
5050
sample_sheet_entries = []
5151

52-
for bam_path in bam_unmapped_read_paths:
52+
for bam_path in read_file_paths:
5353
sample_sheet_entry = NalloSampleSheetEntry(
5454
project=case_sample.case.internal_id,
5555
sample=case_sample.sample.internal_id,
56-
bam_unmapped_read_path=Path(bam_path),
56+
read_file=Path(bam_path),
5757
family_id=case_sample.case.internal_id,
5858
paternal_id=case_sample.get_paternal_sample_id or "0",
5959
maternal_id=case_sample.get_maternal_sample_id or "0",

cg/meta/workflow/nf_analysis.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,10 @@ def get_paired_read_paths(self, sample=Sample) -> tuple[list[str], list[str]]:
253253
)
254254
return fastq_forward_read_paths, fastq_reverse_read_paths
255255

256-
def get_unmapped_bam_read_paths(self, sample=Sample) -> list[str]:
256+
def get_bam_read_file_paths(self, sample=Sample) -> list[Path]:
257257
"""Gather BAM file path for a sample based on the BAM tag."""
258258
return [
259-
hk_file.full_path
259+
Path(hk_file.full_path)
260260
for hk_file in self.housekeeper_api.files(
261261
bundle=sample.internal_id, tags={AlignmentFileTag.BAM}
262262
)

cg/models/nallo/nallo.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class NalloSampleSheetEntry(BaseModel):
1212

1313
project: str
1414
sample: str
15-
bam_unmapped_read_path: Path
15+
read_file: Path
1616
family_id: str
1717
paternal_id: str
1818
maternal_id: str
@@ -26,7 +26,7 @@ def reformat_sample_content(self) -> list[list[str]]:
2626
[
2727
self.project,
2828
self.sample,
29-
self.bam_unmapped_read_path,
29+
self.read_file,
3030
self.family_id,
3131
self.paternal_id,
3232
self.maternal_id,
@@ -35,9 +35,9 @@ def reformat_sample_content(self) -> list[list[str]]:
3535
]
3636
]
3737

38-
@field_validator("bam_unmapped_read_path")
38+
@field_validator("read_file")
3939
@classmethod
40-
def unmapped_bam_file_exists(cls, bam_path: Path) -> Path:
40+
def read_file_exists(cls, bam_path: Path) -> Path:
4141
"""Verify that bam files exist."""
4242
if not bam_path.is_file():
4343
raise NfSampleSheetError(f"Bam file does not exist: {str(bam_path)}")

0 commit comments

Comments
 (0)