Skip to content

Commit

Permalink
use the file.full_path method and fix arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
rannick committed Oct 15, 2024
1 parent 97560f2 commit 3e592c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cg/meta/upload/gt.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
from pathlib import Path

from housekeeper.store.models import File, Version
from housekeeper.store.models import File

from cg.apps.gt import GenotypeAPI
from cg.apps.housekeeper.hk import HousekeeperAPI
Expand Down Expand Up @@ -196,14 +196,15 @@ def _is_variant_file(genotype_file: File):
FileExtensions.VCF_GZ
) or genotype_file.full_path.endswith(FileExtensions.BCF)

@staticmethod
def _sort_genotype_files(hk_genotype_files: list[File]) -> File | None:
"""
Take a list of files and only keep files finishing with .bcf or .vcf.gz
Returns a single remaining file or raises ValueError if more than one file remains.
"""
allowed_extensions = (FileExtensions.BCF, FileExtensions.VCF_GZ)
filtered_files = [
file for file in hk_genotype_files if str(file).endswith(allowed_extensions)
file for file in hk_genotype_files if file.full_path.endswith(allowed_extensions)
]
if len(filtered_files) > 1:
raise ValueError(
Expand Down
1 change: 0 additions & 1 deletion tests/cli/upload/test_cli_upload_genotype.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from cg.models.cg_config import CGConfig
from cg.store.store import Store


def test_upload_genotype(
upload_context: CGConfig,
case_id: str,
Expand Down

0 comments on commit 3e592c8

Please sign in to comment.