Stores and extracts items from a single annotation entry of the annotations dictionary.
Exists to support modularity and readibility within the Query class.
| Attributes: |
|
|---|
Examples:
>>> from metahq_core.query import UnParsedEntry
>>> entry = {
'GSM281311': {
'organism': 'homo sapiens',
'tissue': {
'ursa': {
'id': 'UBERON:0002113', 'value': 'kidney', 'ecode': 'expert-curated'
}
}
}
}
>>> UnParsedEntry(
entry,
attribute='tissue',
ecodes=['expert-curated'],
species='homo sapiens',
allowed_sources=None,
)
get_annotations()
¶
Retrieves the ID and value annotations for a single entry.
| Returns: |
|
|---|
Examples:
>>> from metahq_core.query import UnParsedEntry
>>> entry = {
'GSM281311': {
'organism': 'homo sapiens',
'tissue': {
'ursa': {
'id': 'UBERON:0002113', 'value': 'kidney', 'ecode': 'expert-curated'
}
}
}
}
>>> unparsed = UnParsedEntry(
entry,
attribute='tissue',
ecodes=['expert-curated'],
'homo sapiens'
)
>>> unparsed.get_annotations()
('UBERON:0002113', 'kidney')
is_acceptable()
¶
Checks if the entry is not empty and is an acceptable annotation given the passed attribute, ecode, and species.
| Returns: |
|
|---|
Examples:
>>> from metahq_core.query import UnParsedEntry
>>> entry = {
'GSM281311': {
'organism': 'homo sapiens',
'tissue': {
'ursa': {
'id': 'UBERON:0002113', 'value': 'kidney', 'ecode': 'expert-curated'
}
}
}
}
>>> unparsed = UnParsedEntry(
entry,
attribute='tissue',
ecodes=['expert-curated'],
'homo sapiens'
)
>>> unparsed.is_acceptable()
True
If an attribute doesn't exist, it will return False.
get_id_value(source_anno)
staticmethod
¶
Extracts the ID and value for an annotation.
| Parameters: |
|
|---|
| Returns: |
|
|---|