expandHapdos {PolyHaplotyper} | R Documentation |
Add dropped rows back to haplotype dosage matrix
Description
Haplotype dosage matrices generated with the dropUnused=TRUE lack some haplotypes that are required by pedigreeHapCheck; this function adds them back.
Usage
expandHapdos(hapdos, nhap, hbname)
Arguments
hapdos |
a haplotype dosage matrix as returned by a.o. inferHaplotypes. The rownames are assumed to have all the same length: they are composed of the haploblock name to which the 0-padded haplotype number is appended, separated by "_" |
nhap |
the total number of haplotypes for the haploblock: nhap = 2^nmrk with nmrk the number of markers in the haploblock |
hbname |
the haploblock name (only used when hapdos has 0 rows) |
Value
a matrix similar to hapdos with rows for the dropped haplotypes re-inserted, with the correct rownames and containing only 0 and NA values
Examples
# specify haplotype dosages of 4 tetraploid individuals,
# only the 3 occurring haplotypes (1, 5 and 6) are given:
haplodosg <- matrix(c(1,2,1, 4,0,0, 0,4,0, 0,0,4), nrow=3,
dimnames=list(paste0("demohap_", c(1,5,6)), paste0("indiv", 1:4)))
# add the rows for the absent haplotypes, assuming the haploblock consists
# of 3 markers, so 8 haplotypes are possible:
expandHapdos(hapdos=haplodosg, nhap=8)
[Package PolyHaplotyper version 1.0.1 Index]