skbio.sequence.GeneticCode.__eq__#

GeneticCode.__eq__(other)[source]#

Determine if the genetic code is equal to another.

Genetic codes are equal if they are exactly the same type and defined by the same amino_acids and starts. A genetic code’s name (accessed via name property) does not affect equality.

Parameters:
otherGeneticCode

Genetic code to test for equality against.

Returns:
bool

Indicates whether the genetic code is equal to other.

Examples

NCBI genetic codes 1 and 2 are not equal:

>>> GeneticCode.from_ncbi(1) == GeneticCode.from_ncbi(2)
False

Define a custom genetic code:

>>> gc = GeneticCode('M' * 64, '-' * 64)

Define a second genetic code with the same amino_acids and starts. Note that the presence of a name does not make the genetic codes unequal:

>>> named_gc = GeneticCode('M' * 64, '-' * 64, name='example name')
>>> gc == named_gc
True