Merge haplo.score And haplo.group Objects
Combine information from returned objects of haplo.score and haplo.group, 'score' and 'group' respectively. 'score' and 'group' are sorted differently and 'score' keeps a subset of all the haplotypes while 'group' has all of them. To combine results from the two objects, merge them by haplotype and sort by score of the haplotype. The merged object includes all haplotypes; i.e. those appearing in 'group', but the print default only shows haplotypes which have a score.
Object returned from haplo.score of class "haplo.score".
Object returned from haplo.group of class "haplo.group".
Haplo.score returns score statistic and p-value for haplotypes with an overall frequency above the user-specified threshold, skip.haplo. For haplotypes with frequencies below the threshold, the score and p-value will be NA. Overall haplotype frequencies and for sub-groups are estimated by haplo.group.
Data frame including haplotypes, score-statistics, score p-value, estimated haplotype frequency for all subjects, and haplotype frequency from group subsets.
Warning: The merge will not detect if the group and score objects resulted from different subject phenotypes selected by memory-usage parameters, rm.geno.na and enum.limit. Users must use the same values for these parameters in haplo.score and haplo.group so the merged objects are consistent.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
data(hla.demo) geno <- as.matrix(hla.demo[,c(17,18,21:24)]) keep <- !apply(is.na(geno) | geno==0, 1, any) hla.demo <- hla.demo[keep,] geno <- geno[keep,] attach(hla.demo) y.ord <- as.numeric(resp.cat) y.bin <-ifelse(y.ord==1,1,0) group.bin <- haplo.group(y.bin, geno, miss.val=0) score.bin <- haplo.score(y.bin, geno, trait.type="binomial") score.merged <- haplo.score.merge(score.bin, group.bin) print(score.merged)