# skbio.sequence.DNASequence.equals¶

DNASequence.equals(other, ignore=None)[source]

Compare two biological sequences for equality.

By default, biological sequences are equal if their sequence, identifier, description, and quality scores are the same and they are the same type.

Parameters: other : BiologicalSequence The sequence to test for equality against. ignore : iterable of str, optional List of features to ignore in the equality test. By default, all features must be the same for two biological sequences to be considered equal. Features that can be ignored are 'type', 'id', 'description', 'quality', and 'sequence'. bool Indicates whether self and other are equal.

Examples

Define two biological sequences that have the same underlying sequence of characters:

>>> from skbio import BiologicalSequence
>>> s = BiologicalSequence('GGUCGUGAAGGA')
>>> t = BiologicalSequence('GGUCGUGAAGGA')


The two sequences are considered equal because they are the same type, their underlying sequence of characters are the same, and their optional attributes (id, description, and quality scores) were not provided:

>>> s.equals(t)
True
>>> t.equals(s)
True


Define another biological sequence with a different sequence of characters than the previous two biological sequences:

>>> u = BiologicalSequence('GGUCGUGACCGA')
>>> u.equals(t)
False


Define a biological sequence with the same sequence of characters as u, but with different identifier and quality scores: >>> v = BiologicalSequence(‘GGUCGUGACCGA’, id=’abc’, ... quality=[1, 5, 3, 3, 2, 42, 100, 9, 10, 55, ... 42, 42])

By default, the two sequences are not considered equal because their identifiers and quality scores do not match:

>>> u.equals(v)
False


By specifying that the quality scores and identifier should be ignored, they now compare equal:

>>> u.equals(v, ignore=['quality', 'id'])
True