hpotk.validate package
The hpotk.validate package provides code for Q/C of HPO applications.
- class hpotk.validate.RuleValidator[source]
Bases:
objectRuleValidator checks if a sequence of
hpotk.model.Identifiedorhpotk.model.TermIditems meet the validation requirements. The observation status is included in case the items extendhpotk.model.ObservableFeature.The validators can check each item individually or as a collection, for instance, to discover violation of the annotation propagation rule, etc.
The issues are returned as
ValidationResults.- abstractmethod validate(items: Sequence[TermId | Identified]) ValidationResults[source]
Validate the sequence of term IDs or items that have an identifier.
- Parameters:
items – the items to validate.
- Returns:
results packaged in
ValidationResultscontainer.
- class hpotk.validate.ValidationResult(level, category, message)
Bases:
tuple- category
Alias for field number 1
- level
Alias for field number 0
- message
Alias for field number 2
- class hpotk.validate.ValidationLevel(*values)[source]
Bases:
EnumAn enumeration of the validation levels.
- WARNING = 1
Validation warning represents a potential issue that can be fixed.
- ERROR = 2
Validation error represents an issue that MUST be fixed
- class hpotk.validate.ValidationResults(results: Sequence[ValidationResult])[source]
Bases:
objectA container for results of a single validation run.
- Parameters:
results
- is_ok() bool[source]
Test if the validation run found no errors.
- Returns:
True if no errors were found or False otherwise.
- property results: Sequence[ValidationResult]
Get a sequence of validation results.
- class hpotk.validate.AnnotationPropagationValidator(ontology: MinimalOntology)[source]
Bases:
BaseOntologyRuleValidatorValidator to check that a sequence of terms, when interpreted together, does not violate the annotation propagation rule.
More formally, the terms must not satisfy the following:
terms must not contain a present term and its present or excluded ancestor
terms must not contain an excluded term and its excluded ancestor
Violation of annotation propagation rule produces an
ValidationLevel.ERROR.The validator replaces obsolete term IDs with the current term IDs before performing the validation.
- Parameters:
ontology – HPO represented as
hpotk.ontology.MinimalOntology.
- validate(items: Sequence[TermId | Identified]) ValidationResults[source]
Validate the sequence of term IDs or items that have an identifier.
- Parameters:
items – the items to validate.
- Returns:
results packaged in
ValidationResultscontainer.
- class hpotk.validate.PhenotypicAbnormalityValidator(ontology: MinimalOntology)[source]
Bases:
BaseOntologyRuleValidatorValidator for checking that the term is a phenotypic abnormality (a descendant of Phenotypic abnormality [HP:0000118]).
Presence of a term that is not a descendant of Phenotypic abnormality is a
ValidationLevel.WARNING.The validator replaces obsolete term IDs with the current term IDs before performing the validation.
- Parameters:
ontology – HPO represented as
hpotk.ontology.MinimalOntology.
- validate(items: Sequence[TermId | Identified]) ValidationResults[source]
Validate the sequence of term IDs or items that have an identifier.
- Parameters:
items – the items to validate.
- Returns:
results packaged in
ValidationResultscontainer.
- class hpotk.validate.ObsoleteTermIdsValidator(ontology: MinimalOntology)[source]
Bases:
BaseOntologyRuleValidatorObsoleteTermIdsValidator points out usage of obsolete term ids in items.
Presence of an obsolete term ID is a
ValidationLevel.WARNING.- Parameters:
ontology – HPO represented as
hpotk.ontology.MinimalOntology.
- validate(items: Sequence[TermId | Identified]) ValidationResults[source]
Validate the sequence of term IDs or items that have an identifier.
- Parameters:
items – the items to validate.
- Returns:
results packaged in
ValidationResultscontainer.
- class hpotk.validate.ValidationRunner(validators: Iterable[RuleValidator])[source]
Bases:
objectThe runner applies a sequence of rule validators on items and packs the results into
ValidationResults.- Parameters:
validators – an iterable of
RuleValidators to apply.
- validate_all(items: Sequence[TermId | Identified]) ValidationResults[source]
Validate the items with all rules.
- Returns:
the results packed into
ValidationResults.