haplobin_bounds#

pybrops.core.util.haplo.haplobin_bounds(haplobin)[source]#

Calculate haplotype bin boundaries and lengths.

Parameters:

haplobin (numpy.ndarray) –

Array of shape (p,) containing haplotype bin assignments for each marker across the genome. Bins are assigned starting at 0 and strictly increase as the index in the array increases.

Where:

  • p is the number of markers.

Example input:

[0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3]

Returns:

out – A tuple of length 3 containing (hstix, hspix, hlen).

Where:

  • hstix is a numpy.ndarray containing haplotype bin boundary start indices.

  • hspix is a numpy.ndarray containing haplotype bin boundary stop indices.

  • hlen is a numpy.ndarray containing haplotype bin lengths.

Return type:

tuple