|
1 | 1 | Annotations |
2 | 2 | =========== |
3 | 3 |
|
4 | | -The ``Annotations`` section contains various metadata annotations for HPO terms. |
| 4 | +The ``Annotations`` module contains the gene and disease associations of HPOTerms. |
5 | 5 |
|
6 | | -``GeneSingleton`` class |
7 | | -*********************** |
8 | | -.. autoclass:: pyhpo.annotations.GeneSingleton |
9 | | - :no-private-members: |
10 | | - :no-special-members: |
| 6 | +.. code:: |
11 | 7 |
|
12 | | -toJSON |
13 | | ------- |
14 | | -.. automethod:: pyhpo.annotations.GeneSingleton.toJSON |
| 8 | + from pyhpo import Ontology |
| 9 | + from pyhpo.annotations import Omim, Orpha |
15 | 10 |
|
| 11 | + Ontology() |
16 | 12 |
|
17 | | -``GeneDict`` class |
18 | | -****************** |
19 | | -.. autoclass:: pyhpo.annotations.GeneDict |
20 | | - :no-private-members: |
21 | | - :no-special-members: |
| 13 | + # All genes and diseases can be accessed through the Ontology |
22 | 14 |
|
| 15 | + for gene in Ontology.genes: |
| 16 | + print(gene.name) |
| 17 | + # >> "EZH2" |
| 18 | + # ... |
23 | 19 |
|
24 | | -``DiseaseSingleton`` class |
25 | | -************************** |
26 | | -.. autoclass:: pyhpo.annotations.DiseaseSingleton |
27 | | - :no-private-members: |
28 | | - :no-special-members: |
| 20 | + for orpha in Ontology.orpha_diseases: |
| 21 | + print(orpha.id) |
| 22 | + # >> 231401 |
| 23 | + # ... |
29 | 24 |
|
30 | | -toJSON |
31 | | ------- |
32 | | -.. automethod:: pyhpo.annotations.DiseaseSingleton.toJSON |
33 | 25 |
|
34 | | -``DiseaseDict`` class |
35 | | -********************* |
36 | | -.. autoclass:: pyhpo.annotations.DiseaseDict |
37 | | - :no-private-members: |
38 | | - :no-special-members: |
| 26 | + # or accessed directly from the `Orpha`, `Omim`, `Gene` class |
39 | 27 |
|
40 | | -Omim |
41 | | -**** |
42 | | -Instance of :class:`pyhpo.annotations.DiseaseDict` to handle Omim diseases. Ensures that diseases are not duplicated through use of Singletons. |
| 28 | + orpha_disease = Orpha.get(77260) |
| 29 | + omim_disease = Omim.get(230900) |
43 | 30 |
|
44 | | -Orpha |
45 | | -***** |
46 | | -Instance of :class:`pyhpo.annotations.DiseaseDict` to handle Orphanet diseases. Ensures that diseases are not duplicated through use of Singletons. |
47 | 31 |
|
48 | | -Decipher |
49 | | -******** |
50 | | -Instance of :class:`pyhpo.annotations.DiseaseDict` to handle Decipher diseases. Ensures that diseases are not duplicated through use of Singletons. |
| 32 | + # Annotations can be converted to `HPOSet` |
| 33 | +
|
| 34 | + orpha_set = orpha_disease.hpo_set() |
| 35 | + omim_set = omim_disease.hpo_set() |
| 36 | +
|
| 37 | + similarity = orpha_set.similarity(omim_set) |
| 38 | + print(similarity) |
| 39 | + # >> 0.6620065792484546 |
| 40 | +
|
| 41 | +
|
| 42 | +.. class:: GeneSingleton |
| 43 | + |
| 44 | + An instance of a gene, associated to several :class:`pyhpo.term.HPOTern`. |
| 45 | + |
| 46 | + .. note:: |
| 47 | + |
| 48 | + Since version 4.0 genes do not contain references to HPOTerms transitively, i.e. only directly |
| 49 | + associated HPOTerms are linked to the gene. |
| 50 | + |
| 51 | + .. attribute:: id |
| 52 | + |
| 53 | + :Return Type: ``int`` |
| 54 | + |
| 55 | + :Returns: The HGNC ID of the gene |
| 56 | + |
| 57 | + .. attribute:: name |
| 58 | + |
| 59 | + :Return Type: ``str`` |
| 60 | + |
| 61 | + :Returns: The HUGO gene synbol of the gene |
| 62 | + |
| 63 | + .. attribute:: symbol |
| 64 | + |
| 65 | + :Return Type: ``str`` |
| 66 | + |
| 67 | + :Returns: The HUGO gene synbol of the gene (alias of :attr:`GeneSingleton.name`) |
| 68 | + |
| 69 | + .. attribute:: hpo |
| 70 | + |
| 71 | + :Return Type: ``set(int)`` |
| 72 | + |
| 73 | + :Returns: The HPO-IDs of all associated :class:`pyhpo.term.HPOTerm` s |
| 74 | + |
| 75 | + .. autofunction:: pyhpo.annotations.Annotation.toJSON |
| 76 | + |
| 77 | + .. autofunction:: pyhpo.annotations.Annotation.hpo_set |
| 78 | + |
| 79 | + |
| 80 | +.. class:: Gene |
| 81 | + |
| 82 | + ``Gene`` holds all :class:`GeneSingleton` instances and ensures they are not duplicated. |
| 83 | + It does not need to be instantiated, as it is already created as a singleton during the |
| 84 | + setup of the Ontology. |
| 85 | + |
| 86 | + .. autofunction:: pyhpo.annotations.Gene.get |
| 87 | + .. autofunction:: pyhpo.annotations.Gene.__call__ |
| 88 | + |
| 89 | + |
| 90 | +.. class:: OmimDisease |
| 91 | + |
| 92 | + An instance of an Omim disease, associated to several :class:`pyhpo.term.HPOTerm`. |
| 93 | + |
| 94 | + .. attribute:: id |
| 95 | + |
| 96 | + :Return Type: ``int`` |
| 97 | + |
| 98 | + :Returns: The Omim ID |
| 99 | + |
| 100 | + .. attribute:: name |
| 101 | + |
| 102 | + :Return Type: ``str`` |
| 103 | + |
| 104 | + :Returns: The Omim disease name |
| 105 | + |
| 106 | + .. attribute:: hpo |
| 107 | + |
| 108 | + :Return Type: ``set(int)`` |
| 109 | + |
| 110 | + :Returns: The HPO-ID of all associated :class:`HPOTerm` s |
| 111 | + |
| 112 | + .. autofunction:: pyhpo.annotations.Annotation.toJSON |
| 113 | + |
| 114 | + .. autofunction:: pyhpo.annotations.Annotation.hpo_set |
| 115 | + |
| 116 | + |
| 117 | +.. class:: Omim |
| 118 | + |
| 119 | + ``Omim`` holds all :class:`OmimDisease` instances and ensures they are not duplicated. |
| 120 | + It does not need to be instantiated, as it is already created as a singleton during the |
| 121 | + setup of the Ontology. |
| 122 | + |
| 123 | + .. autofunction:: pyhpo.annotations.DiseaseDict.get |
| 124 | + |
| 125 | + :Return type: :class:`OmimDisease` |
| 126 | + |
| 127 | + .. autofunction:: pyhpo.annotations.DiseaseDict.__call__ |
| 128 | + |
| 129 | + |
| 130 | +.. class:: OrphaDisease |
| 131 | + |
| 132 | + An instance of an Orpha disease, associated to several :class:`pyhpo.term.HPOTerm`. |
| 133 | + |
| 134 | + .. attribute:: id |
| 135 | + |
| 136 | + :Return Type: ``int`` |
| 137 | + |
| 138 | + :Returns: The Orpha ID |
| 139 | + |
| 140 | + .. attribute:: name |
| 141 | + |
| 142 | + :Return Type: ``str`` |
| 143 | + |
| 144 | + :Returns: The Orpha disease name |
| 145 | + |
| 146 | + .. attribute:: hpo |
| 147 | + |
| 148 | + :Return Type: ``set(int)`` |
| 149 | + |
| 150 | + :Returns: The HPO-ID of all associated :class:`HPOTerm` s |
| 151 | + |
| 152 | + .. autofunction:: pyhpo.annotations.Annotation.toJSON |
| 153 | + |
| 154 | + .. autofunction:: pyhpo.annotations.Annotation.hpo_set |
| 155 | + |
| 156 | + |
| 157 | +.. class:: Orpha |
| 158 | + |
| 159 | + ``Orpha`` holds all :class:`OrphaDisease` instances and ensures they are not duplicated. |
| 160 | + It does not need to be instantiated, as it is already created as a singleton during the |
| 161 | + setup of the Ontology. |
| 162 | + |
| 163 | + .. autofunction:: pyhpo.annotations.DiseaseDict.get |
| 164 | + |
| 165 | + :Return type: :class:`OrphaDisease` |
| 166 | + |
| 167 | + .. autofunction:: pyhpo.annotations.DiseaseDict.__call__ |
| 168 | + |
| 169 | + |
| 170 | +.. class:: DecipherDisease |
| 171 | + |
| 172 | + An instance of an Decipher disease, associated to several :class:`pyhpo.term.HPOTerm`. |
| 173 | + |
| 174 | + .. attribute:: id |
| 175 | + |
| 176 | + :Return Type: ``int`` |
| 177 | + |
| 178 | + :Returns: The Decipher ID |
| 179 | + |
| 180 | + .. attribute:: name |
| 181 | + |
| 182 | + :Return Type: ``str`` |
| 183 | + |
| 184 | + :Returns: The Decipher disease name |
| 185 | + |
| 186 | + .. attribute:: hpo |
| 187 | + |
| 188 | + :Return Type: ``set(int)`` |
| 189 | + |
| 190 | + :Returns: The HPO-ID of all associated :class:`HPOTerm` s |
| 191 | + |
| 192 | + .. autofunction:: pyhpo.annotations.Annotation.toJSON |
| 193 | + |
| 194 | + .. autofunction:: pyhpo.annotations.Annotation.hpo_set |
| 195 | + |
| 196 | + |
| 197 | +.. class:: Decipher |
| 198 | + |
| 199 | + ``Decipher`` holds all :class:`DecipherDisease` instances and ensures they are not duplicated. |
| 200 | + |
| 201 | + .. autofunction:: pyhpo.annotations.DiseaseDict.get |
| 202 | + |
| 203 | + :Return type: :class:`DecipherDisease` |
| 204 | + |
| 205 | + .. autofunction:: pyhpo.annotations.DiseaseDict.__call__ |
0 commit comments