Skip to content

Commit

Permalink
Use stairval instead of the Auditor API.
Browse files Browse the repository at this point in the history
  • Loading branch information
ielis committed Oct 29, 2024
1 parent 8e0a747 commit c1b9acf
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 412 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ classifiers = [
]
dependencies = [
"hpo-toolkit>=0.3.0",
"stairval>=0.2.0",
"Jinja2>=3.1.4,<4.0.0",
"protobuf>=3.15.0",
"pandas>=2.0.0,<3.0.0",
Expand Down
10 changes: 7 additions & 3 deletions src/gpsea/model/_cohort.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,16 @@ def __hash__(self) -> int:


class Cohort(typing.Sized, typing.Iterable[Patient]):
"""
Cohort is a collection of individuals that have been preprocessed
and are ready for genotype-phenotype association analysis.
"""

@staticmethod
def from_patients(
members: typing.Iterable[Patient],
include_patients_with_no_HPO: bool = False,
include_patients_with_no_variants: bool = False,
members: typing.Iterable[Patient],
include_patients_with_no_HPO: bool = False,
include_patients_with_no_variants: bool = False,
):
"""
Create a cohort from a sequence of patients.
Expand Down
2 changes: 0 additions & 2 deletions src/gpsea/preprocessing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from ._api import PreprocessingValidationResult
from ._api import TranscriptCoordinateService, GeneCoordinateService
from ._api import VariantCoordinateFinder, FunctionalAnnotator, ImpreciseSvFunctionalAnnotator, ProteinMetadataService
from ._audit import Auditor, DataSanityIssue, Level, Notepad, NotepadTree
from ._config import load_phenopacket_folder, load_phenopacket_files, load_phenopackets
from ._config import configure_caching_cohort_creator, configure_cohort_creator
from ._config import configure_default_protein_metadata_service, configure_protein_metadata_service
Expand All @@ -27,6 +26,5 @@
'UniprotProteinMetadataService',
'VepFunctionalAnnotator', 'VariantAnnotationCache', 'VarCachingFunctionalAnnotator',
'VVHgvsVariantCoordinateFinder', 'VVMultiCoordinateService',
'Auditor', 'DataSanityIssue', 'Level', 'Notepad', 'NotepadTree',
'DefaultImpreciseSvFunctionalAnnotator',
]
12 changes: 6 additions & 6 deletions src/gpsea/preprocessing/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import sys
import typing

from stairval.notepad import Notepad

from gpsea.model import (
VariantCoordinates,
ProteinMetadata,
Expand All @@ -12,8 +14,6 @@
ImpreciseSvInfo,
)

from ._audit import NotepadTree

T = typing.TypeVar("T")


Expand Down Expand Up @@ -141,7 +141,7 @@ class PreprocessingValidationResult:
def __init__(
self,
policy: str,
notepad: NotepadTree,
notepad: Notepad,
):
self._policy = policy
self._notepad = notepad
Expand Down Expand Up @@ -188,13 +188,13 @@ def summarize(
file.write(f"Validated under {self._policy} policy")
file.write(os.linesep)

n_errors = sum(node.error_count() for node in self._notepad.iterate_nodes())
n_warnings = sum(node.warning_count() for node in self._notepad.iterate_nodes())
n_errors = sum(node.error_count() for node in self._notepad.iter_sections())
n_warnings = sum(node.warning_count() for node in self._notepad.iter_sections())
if n_errors > 0 or n_warnings > 0:
file.write("Showing errors and warnings")
file.write(os.linesep)

for node in self._notepad.iterate_nodes():
for node in self._notepad.iter_sections():
if node.has_errors_or_warnings(include_subsections=True):
# We must report the node label even if there are no issues with the node.
l_pad = " " * (node.level * indent)
Expand Down
Loading

0 comments on commit c1b9acf

Please sign in to comment.