Skip to content

Commit

Permalink
Merge pull request #245 from monarch-initiative/ielis/issue236
Browse files Browse the repository at this point in the history
Allow using `Sex` and disease diagnosis as a genotype predicate
  • Loading branch information
ielis authored Sep 4, 2024
2 parents 0a4ebc2 + c61b087 commit f8be8ea
Show file tree
Hide file tree
Showing 5 changed files with 280 additions and 36 deletions.
39 changes: 39 additions & 0 deletions docs/user-guide/predicates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,45 @@ for testing if the individual has at least one missense vs. frameshift vs. synon
'Genotype group: Missense, Frameshift, Synonymous'


.. _sex-predicate:

Partition by the sex of the individual
======================================

It is easy to investigate the phenotypic differences between females and males.
The :func:`~gpsea.analysis.predicate.genotype.sex_predicate` provides a predicate
for partitioning based on the sex of the individual:

>>> from gpsea.analysis.predicate.genotype import sex_predicate
>>> gt_predicate = sex_predicate()
>>> gt_predicate.display_question()
'Sex of the individual: FEMALE, MALE'

The individuals with :class:`~gpsea.model.Sex.UNKNOWN_SEX` will be omitted from the analysis.


.. _diagnosis-predicate:

Partition by a diagnosis
========================

It is also possible to bin the individuals based on a diagnosis.
The :func:`~gpsea.analysis.predicate.genotype.diagnosis_predicate`
prepares a genotype predicate for assigning an individual into a diagnosis group:

>>> from gpsea.analysis.predicate.genotype import diagnosis_predicate
>>> gt_predicate = diagnosis_predicate(
... diagnoses=('OMIM:154700', 'OMIM:129600'),
... labels=('Marfan syndrome', 'Ectopia lentis, familial'),
... )
>>> gt_predicate.display_question()
'What disease was diagnosed: OMIM:154700, OMIM:129600'

Note, an individual must match only one diagnosis group. Any individuals labeled with two or more diagnoses
(e.g. an individual with both *Marfan syndrome* and *Ectopia lentis, familial*)
will be automatically omitted from the analysis.


.. _phenotype-predicates:

********************
Expand Down
4 changes: 2 additions & 2 deletions src/gpsea/analysis/predicate/genotype/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from ._api import GenotypePolyPredicate
from ._api import VariantPredicate
from ._counter import AlleleCounter
from ._gt_predicates import boolean_predicate, groups_predicate, filtering_predicate
from ._gt_predicates import boolean_predicate, groups_predicate, filtering_predicate, sex_predicate, diagnosis_predicate
from ._gt_predicates import ModeOfInheritancePredicate
from ._variant import VariantPredicates, ProteinPredicates

__all__ = [
'GenotypePolyPredicate',
'boolean_predicate', 'groups_predicate', 'filtering_predicate',
'boolean_predicate', 'groups_predicate', 'filtering_predicate', 'sex_predicate', 'diagnosis_predicate',
'ModeOfInheritancePredicate',
'AlleleCounter', 'VariantPredicate',
'VariantPredicates', 'ProteinPredicates',
Expand Down
Loading

0 comments on commit f8be8ea

Please sign in to comment.