Skip to content

Commit

Permalink
Update documentation for Orpha related content
Browse files Browse the repository at this point in the history
  • Loading branch information
anergictcell committed Jun 15, 2024
1 parent b06f228 commit 3d405d9
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/annotations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Annotations
:members:
:inherited-members:

.. autoclass:: pyhpo.Orpha
:members:
:inherited-members:

.. autoclass:: pyhpo.Gene
:members:
:inherited-members:
2 changes: 2 additions & 0 deletions docs/helper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ Methods
.. autofunction:: pyhpo.helper.batch_similarity
.. autofunction:: pyhpo.helper.batch_set_similarity
.. autofunction:: pyhpo.helper.batch_disease_enrichment
.. autofunction:: pyhpo.helper.batch_omim_disease_enrichment
.. autofunction:: pyhpo.helper.batch_orpha_disease_enrichment
.. autofunction:: pyhpo.helper.batch_gene_enrichment
2 changes: 1 addition & 1 deletion docs/hposet.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Instantiation
Instance methods
----------------
.. autoclass:: pyhpo.HPOSet
:members: add, child_nodes, remove_modifier, replace_obsolete, terms, all_genes, omim_diseases, information_content, similarity, similarity_scores, toJSON, serialize
:members: add, child_nodes, remove_modifier, replace_obsolete, terms, all_genes, omim_diseases, orpha_diseases, information_content, similarity, similarity_scores, toJSON, serialize


Not yet implemented
Expand Down
1 change: 1 addition & 0 deletions docs/ontology.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Attributes
----------
.. autoattribute:: pyhpo.Ontology.__class__.genes
.. autoattribute:: pyhpo.Ontology.__class__.omim_diseases
.. autoattribute:: pyhpo.Ontology.__class__.orpha_diseases


Methods
Expand Down
1 change: 1 addition & 0 deletions src/linkage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use crate::{get_ontology, information_content::PyInformationContentKind, set::Py
/// Available options:
///
/// * **omim**
/// * **orpha**
/// * **gene**
///
/// similarity_method: `str`, default `graphic`
Expand Down
34 changes: 33 additions & 1 deletion src/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use hpo::annotations::AnnotationId;
use hpo::similarity::Similarity;
use hpo::term::HpoTermId;

use crate::annotations::PyOrphaDisease;
use crate::pyterm_from_id;
use crate::term_from_id;
use crate::ONTOLOGY;
Expand Down Expand Up @@ -279,7 +280,7 @@ impl PyHpoTerm {
/// print(disease.name)
///
#[getter(omim_diseases)]
fn diseases(&self) -> HashSet<PyOmimDisease> {
fn omim_diseases(&self) -> HashSet<PyOmimDisease> {
self.hpo()
.omim_diseases()
.fold(HashSet::new(), |mut set, disease| {
Expand All @@ -288,6 +289,37 @@ impl PyHpoTerm {
})
}

/// Returns a set of associated ORPHA diseases
///
/// The list includes "inherited" diseases that are not directly
/// linked to the term, but to one of its children
///
/// Returns
/// -------
/// Set[:class:`pyhpo.Orpha`]
/// All associated Orpha diseases
///
/// Examples
/// --------
///
/// .. code-block:: python
///
/// from pyhpo import Ontology
/// Ontology()
/// term = Ontology.hpo(188)
/// for disease in term.orpha_diseases:
/// print(disease.name)
///
#[getter(orpha_diseases)]
fn orpha_diseases(&self) -> HashSet<PyOrphaDisease> {
self.hpo()
.orpha_diseases()
.fold(HashSet::new(), |mut set, disease| {
set.insert(PyOrphaDisease::from(disease));
set
})
}

/// A list of the root phenotypical or modifier categories the term
/// belongs to
///
Expand Down

0 comments on commit 3d405d9

Please sign in to comment.