HPOSetο
HPOSet
instances contains a set of HPO terms. This class is useful to represent a patientβs clinical information.
It provides analytical helper functions to narrow down the actual provided clinical information.
HPOSet
classο
child_nodesο
- HPOSet.child_nodes()[source]ο
Return a new HPOSet tha contains only the most specific HPO term for each subtree
It basically will return only HPO terms that do not have descendant HPO terms present in the set
- Returns:
HPOSet instance that contains only the most specific child nodes of the current HPOSet
- Return type:
remove_modifierο
- HPOSet.remove_modifier()[source]ο
Removes all modifier terms. By default, this includes
Mode of inheritance: 'HP:0000005'
Clinical modifier: 'HP:0012823'
Frequency: 'HP:0040279'
Clinical course: 'HP:0031797'
Blood group: 'HP:0032223'
Past medical history: 'HP:0032443'
- Returns:
HPOSet instance that contains only
Phenotypic abnormality
HPO terms- Return type:
replace_obsoleteο
- HPOSet.replace_obsolete(verbose=False)[source]ο
Replaces obsolete terms with the replacement term
Warning
Not all obsolete terms have a replacement. Obsolete terms without replacements will be removed from the set.
- Parameters:
verbose (bool, default:
False
) β Print warnings if an obsolete term does not have a replacement.- Returns:
A new HPOSet
- Return type:
all_genesο
omim_diseasesο
information_contentο
- HPOSet.information_content(kind='')[source]ο
Gives back basic information content stats about the HPOTerms within the set
- Parameters:
kind (str, default:
omim
) β Which kind of information content should be calculated. Options are [βomimβ, βorphaβ, βdecipherβ, βgeneβ]- Returns:
Dict with the following items
mean - float - Mean information content
max - float - Maximum information content value
total - float - Sum of all information content values
all - list of float - List with all information content values
- Return type:
dict
varianceο
- HPOSet.variance()[source]ο
Calculates the distances between all its term-pairs. It also provides basic calculations for variances among the pairs.
- Returns:
Tuple with the variance metrices
float Average distance between pairs
int Smallest distance between pairs
int Largest distance between pairs
list of int List of all distances between pairs
- Return type:
tuple of (int, int, int, list of int)
combinationsο
- HPOSet.combinations()[source]ο
Helper generator function that returns all possible two-pair combination between all its terms
This function is direction dependent. That means that every pair will appear twice. Once for each direction :rtype:
Iterator
[Tuple
[HPOTerm
,HPOTerm
]]- Yields:
Tuple of
term.HPOTerm
β Tuple containing the follow itemsHPOTerm instance 1 of the pair
HPOTerm instance 2 of the pair
- Return type:
Examples
ci = HPOSet([term1, term2, term3]) ci.combinations() # Output: [ (term1, term2), (term1, term3), (term2, term1), (term2, term3), (term3, term1), (term3, term2) ]
combinations_one_wayο
- HPOSet.combinations_one_way()[source]ο
Helper generator function that returns all possible two-pair combination between all its terms
This methow will report each pair only once :rtype:
Iterator
[Tuple
[HPOTerm
,HPOTerm
]]See also
- Yields:
Tuple of
term.HPOTerm
β Tuple containing the follow itemsHPOTerm instance 1 of the pair
HPOTerm instance 2 of the pair
- Return type:
Example
ci = HPOSet([term1, term2, term3]) ci.combinations() # Output: [ (term1, term2), (term1, term3), (term2, term3) ]
similarityο
- HPOSet.similarity(other, kind='', method='', combine='funSimAvg')[source]ο
Calculates the similarity to another HPOSet According to Robinson et al, American Journal of Human Genetics, (2008) and Pesquita et al, BMC Bioinformatics, (2008)
- Parameters:
other (HPOSet) β Another HPOSet to measure the similarity to
kind (str, default
''
) β Which kind of information content should be calculated. Options are [βomimβ, βorphaβ, βdecipherβ, βgeneβ] Seepyhpo.term.HPOTerm.similarity_score()
for optionsmethod (string, default
''
) βThe method to use to calculate the similarity. See
pyhpo.term.HPOTerm.similarity_score()
for optionsAdditional options:
equal - Calculates exact matches between both sets
combine (string, default
funSimAvg
) βThe method to combine similarity measures.
Available options:
funSimAvg - Schlicker A, BMC Bioinformatics, (2006)
funSimMax - Schlicker A, BMC Bioinformatics, (2006)
BMA - Deng Y, et. al., PLoS One, (2015)
- Returns:
The similarity score to the other HPOSet
- Return type:
float
- Raises:
RuntimeError β The specified
method
orcombine
does not existNotImplementedError β This error can only occur with custom Similarity-Score methods that do not have a
similarity
method defined.AttributeError β The information content for
kind
does not exist
toJSONο
serializeο
- HPOSet.serialize()[source]ο
Creates a string serialization that can be used to rebuild the same HPOSet via
pyhpo.set.HPOSet.from_serialized()
- Returns:
A string representation of the HPOSet
- Return type:
str
BasicHPOSet
classο
Class methodsο
from_queriesο
- classmethod HPOSet.from_queries(queries)[source]ο
Builds an HPO set by specifying a list of queries to run on the
pyhpo.ontology.Ontology
- Parameters:
queries (list of (string or int)) β The queries to be run the identify the HPOTerm from the ontology
- Returns:
A new HPOset
- Return type:
Examples
ci = HPOSet([ 'Scoliosis', 'HP:0001234', 12 ])