haplobin#
- pybrops.core.util.haplo.haplobin(nhaploblk_chrom, genpos, chrgrp_stix, chrgrp_spix)[source]#
Given the number of haplotype blocks to give to each chromosome across the genome, assign bins for each marker
- Parameters:
nhaploblk_chrom (numpy.ndarray) –
Array of shape
(c,)
containing the total number of haplotype blocks to assign to each chromosome across the genome.Where:
c
is the number of chromosomes.
genpos (numpy.ndarray) –
Array of shape
(p,)
containing genetic positions of markers across the genome.Where:
p
is the number of markers.
Input contraints:
Must be sorted in ascending order.
Must be grouped based on chromosome. The chromosome boundary start and stop indices must be provided in
chrgrp_stix
andchrgrp_spix
, respectively.
chrgrp_stix (numpy.ndarray) –
Chromosome boundary start indices array of shape
(c,)
.Where:
c
is the number of chromosomes.
chrgrp_spix (numpy.ndarray) –
Chromosome boundary stop indices array of shape
(c,)
.Where:
c
is the number of chromosomes.
- Returns:
out – Array of shape
(p,)
containing haplotype bin assignments for each marker across the genome. Bins are assigned starting at0
and strictly increase as the index in the array increases due to constraints placed ongenpos
.Where:
p
is the number of markers.
Example output:
[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]
- Return type:
numpy.ndarray