tracts.tract.Tract#
- class Tract(start, end, label, bpstart=None, bpend=None)#
Bases:
objectRepresent a labeled genomic interval.
A tract is the basic object manipulated by Tracts. Higher-level structures are built from collections of tracts. Each tract is defined by an interval and an associated label, typically corresponding to an ancestry.
- Parameters:
start (float) – Starting position of the tract, in Morgans.
end (float) – Ending position of the tract, in Morgans.
label (str) – Identifier associated with the tract. In most applications, this corresponds to the ancestry carried by the tract.
bpstart (int, optional) – Starting position of the tract, in base pairs. This attribute is optional, since Tracts primarily uses Morgans internally. Default is
None.bpend (int, optional) – Ending position of the tract, in base pairs. This attribute is optional, since Tracts primarily uses Morgans internally. Default is
None.
- __init__(start, end, label, bpstart=None, bpend=None)#
Initialize a
Tractinstance.- Parameters:
start (float) – Starting position of the tract, in Morgans.
end (float) – Ending position of the tract, in Morgans.
label (str) – Identifier associated with the tract. In most applications, this corresponds to the ancestry carried by the tract.
bpstart (int, optional) – Starting position of the tract, in base pairs. This attribute is optional, since Tracts primarily uses Morgans internally. Default is
None.bpend (int, optional) – Ending position of the tract, in base pairs. This attribute is optional, since Tracts primarily uses Morgans internally. Default is
None.
- copy()#
Return a copy of the tract.
- get_label()#
Return the label of the tract.
- Returns:
Label associated with the tract.
- Return type:
str
- is_equal(other)#
Check whether two tracts have the same start, end, and label.
- Parameters:
other (Tract) – Tract to compare with the current instance.
- Returns:
Trueif both tracts have identicalstart,end, andlabelattributes, andFalseotherwise.- Return type:
bool
- len()#
Return the length of the tract in Morgans.
- Returns:
Length of the tract, computed as
end - start.- Return type:
float