AlternateIDs

class pronto.entity.attributes.AlternateIDs[source]

A dedicated mutable set to manage the alternate IDs of an entity.

Editing the alternate IDs of an entity also allows retrieving it in the source ontology using its alternate IDs.

Example

>>> ont = pronto.Ontology()
>>> t1 = ont.create_term("TST:001")
>>> ont["ALT:001"]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 'ALT:001'
>>> t1.alternate_ids.add("ALT:001")
>>> ont["ALT:001"]
Term('TST:001')
__repr__()[source]

Return repr(self).

add(id: str)[source]

Add an element.

discard(item: str)[source]

Remove an element. Do not raise an exception if absent.

clear()[source]

This is slow (creates N new iterators!) but effective.

pop() → str[source]

Return the popped value. Raise KeyError if empty.

__eq__(other)

Return self==value.

__ge__(other)

Return self>=value.

__gt__(other)

Return self>value.

__le__(other)

Return self<=value.

__lt__(other)

Return self<value.

classmethod _from_iterable(it)

Construct an instance of the class from any iterable input.

Must override this method if the class constructor signature does not accept an iterable for an input.

_hash()

Compute the hash value of a set.

Note that we don’t define __hash__: not all sets are hashable. But if you define a hashable set type, its __hash__ should call this function.

This must be compatible __eq__.

All sets ought to compare equal if they contain the same elements, regardless of how they are implemented, and regardless of the order of the elements; so there’s not much freedom for __eq__ or __hash__. We match the algorithm used by the built-in frozenset type.

isdisjoint(other)

Return True if two sets have a null intersection.

remove(value)

Remove an element. If not a member, raise a KeyError.