Package obitools :: Package obo :: Module parser :: Class SynonymValue
[hide private]
[frames] | no frames]

Class SynonymValue

source code


A couple 'synonym:value' inherited from the class TaggedValue. Used to manage synonym tags, exact_synonym tags, broad_synonym tags and narrow_synonym tags.

Instance Methods [hide private]
 
__init__(self, line)
Constructor of the class SynonymValue.
source code
 
__eq__(self, b) source code
 
__hash__(self)
hash(x)
source code

Inherited from TaggedValue: __repr__, __str__

Inherited from object: __delattr__, __format__, __getattribute__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]
  _match_scope = re.compile(r'(?<="")[^\[]*(?=\[|$)')
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, line)
(Constructor)

source code 

Constructor of the class SynonymValue.

Parameters:
  • line (string) - a line of an OBOEntry composed of a tag named 'synonym' or 'exact_synonym' or 'broad_synonym' or 'narrow_synonym' and a value.
Overrides: object.__init__

Note: SynonymValue is composed of a tag, a value, a scope, a list of types and dbxrefs. The constructor calls the TaggedValue constructor. A regular expression is used to extract 'definition' from TaggedValue.value (definition is a not quoted TaggedValue.value). Definition is saved as the new value of the class SynonymValue. A regular expression is used to extract 'attributes' from the rest of the string. Attributes may contain an optional synonym scope and an optional list of synonym types. The scope is extracted from attributes or set by default to 'RELATED'. It is saved as the scope of the class. The types are the rest of the attributes and are saved as the list of types of the class. For deprecated tags 'exact_synonym', 'broad_synonym' and 'narrow_synonym', tag is set to 'synonym' and scope is set respectively to 'EXACT', 'BROAD' and 'NARROW'. A regular expression is used to extract 'dbxrefs' from the TaggedValue.value without the definition (dbxrefs are between brackets and definition can be so). dbxrefs are saved.

__hash__(self)
(Hashing function)

source code 

hash(x)

Overrides: object.__hash__
(inherited documentation)