biopython v1.71.0 Bio.SeqFeature.OneOfPosition

Specify a position where the location can be multiple positions.

This models the GenBank ‘one-of(1888,1901)’ function, and tries to make this fit within the Biopython Position models. If this was a start position it should act like 1888, but as an end position 1901.

 >>> p = OneOfPosition(1888, [ExactPosition(1888), ExactPosition(1901)])
 >>> p
 OneOfPosition(1888, choices=[ExactPosition(1888), ExactPosition(1901)])
 >>> int(p)
 1888

Interget comparisons and operators act like using int(p),

 >>> p == 1888
 True
 >>> p <= 1888
 True
 >>> p > 1888
 False
 >>> p + 100
 1988

 >>> isinstance(p, OneOfPosition)
 True
 >>> isinstance(p, AbstractPosition)
 True
 >>> isinstance(p, int)
 True

The old legacy properties of position and extension give the starting/lowest/left-most position as an integer, and the distance to the ending/highest/right-most position as an integer. Note that the position object will act like one of the list of possible locations depending on how it was created:

 >>> p2 = OneOfPosition(1901, [ExactPosition(1888), ExactPosition(1901)])
 >>> p.position == p2.position == 1888
 True
 >>> p.extension == p2.extension == 13
 True
 >>> int(p) == int(p2)
 False
 >>> p == 1888
 True
 >>> p2 == 1901
 True

Link to this section Summary

Functions

Initialize with a set of possible positions

Represent the OneOfPosition object as a string for debugging

Return a representation of the OneOfPosition object (with python counting)

Return a copy of the location after the parent is reversed (PRIVATE)

Return a copy of the position object with its location shifted (PRIVATE)

Legacy attribute to get extension as integer (OBSOLETE)

Legacy attribute to get (left) position as integer (OBSOLETE)

Link to this section Functions

Initialize with a set of possible positions.

position_list is a list of AbstractPosition derived objects, specifying possible locations.

position is an integer specifying the default behaviour.

Represent the OneOfPosition object as a string for debugging.

Return a representation of the OneOfPosition object (with python counting).

Return a copy of the location after the parent is reversed (PRIVATE).

Return a copy of the position object with its location shifted (PRIVATE).

Legacy attribute to get extension as integer (OBSOLETE).

Legacy attribute to get (left) position as integer (OBSOLETE).