R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("haplo.stats-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('haplo.stats') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "Ginv" > > ### * Ginv > > flush(stderr()); flush(stdout()) > > ### Name: Ginv > ### Title: Compute Generalized Inverse of Input Matrix > ### Aliases: Ginv > > > ### ** Examples > > # for matrix x, extract the generalized inverse and > # rank of x as follows > # > save <- Ginv(x) > # > ginv.x <- save$Ginv > # > rank.x <- save$rank > > > > cleanEx(); ..nameEx <- "allele.recode" > > ### * allele.recode > > flush(stderr()); flush(stdout()) > > ### Name: allele.recode > ### Title: Recode allele values to integer ranks > ### Aliases: allele.recode > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "dglm.fit" > > ### * dglm.fit > > flush(stderr()); flush(stdout()) > > ### Name: dglm.fit > ### Title: Density function for GLM fit > ### Aliases: dglm.fit > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "geno.count.pairs" > > ### * geno.count.pairs > > flush(stderr()); flush(stdout()) > > ### Name: geno.count.pairs > ### Title: Counts of Total Haplotype Pairs Produced by Genotypes > ### Aliases: geno.count.pairs > > > ### ** Examples > > setupData(hla.demo) [1] "hla.demo" > geno <- hla.demo[,c(17,18,21:24)] > geno <- geno.recode(geno)$grec > count.geno <- geno.count.pairs(geno) > print(count.geno) [1] 4 4 4 2 4 2 4 2 2 1 [11] 2 4 1 4 4 4 4 4 4 4 [21] 4 1 4 2 4 4 4 4 4 4 [31] 4 4 4 4 1 4 4 2 1 4 [41] 1 2 1 4 4 4 1 4 4 4 [51] 4 4 2 4 1 4 2 4 4 4 [61] 2 4 2 4 2 4 4 2 4 4 [71] 4 4 4 2 2 2 4 1 2 4 [81] 1800 2 1 2 4 4 2 1 4 4 [91] 4 2 4 4 4 4 4 4 4 4 [101] 4 4 4 4 4 2 2 4 4 4 [111] 4 4 2 4 4 4 4 4 4 2 [121] 4 4 2 2 2 4 4 2 4 4 [131] 4 2 4 1 4 2 129600 4 4 4 [141] 4 2 4 4 4 4 4 4 4 4 [151] 4 2 4 4 4 4 4 4 2 1 [161] 4 2 2 2 2 2 2 4 4 4 [171] 2 1 1 4 1 4 4 4 4 4 [181] 2 2 2 2 4 2 1 2 4 4 [191] 4 4 2 2 4 4 4 4 4 2 [201] 4 4 4 4 4 4 2 4 4 2 [211] 2 4 4 4 4 4 4 4 4 4 > > > > cleanEx(); ..nameEx <- "geno.recode" > > ### * geno.recode > > flush(stderr()); flush(stdout()) > > ### Name: geno.recode > ### Title: Recode Genotypes > ### Aliases: geno.recode > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "glm.fit.nowarn" > > ### * glm.fit.nowarn > > flush(stderr()); flush(stdout()) > > ### Name: glm.fit.nowarn > ### Title: Modified from glm.fit function to not warn users for binomial > ### non-integer weights. > ### Aliases: glm.fit.nowarn > > > ### ** Examples > > > > cleanEx(); ..nameEx <- "haplo.cc" > > ### * haplo.cc > > flush(stderr()); flush(stdout()) > > ### Name: haplo.cc > ### Title: Haplotype Association Analysis in a Case-Control design > ### Aliases: haplo.cc > > > ### ** Examples > > # For a genotype matrix geno.test, case/control vector y.test > # The function call will be like this > # cc.test <- haplo.cc(y.test, geno.test, locus.label=locus.label, haplo.min.count=3, ci.prob=0.95) > # > > > > cleanEx(); ..nameEx <- "haplo.chistat" > > ### * haplo.chistat > > flush(stderr()); flush(stdout()) > > ### Name: haplo.chistat > ### Title: Calculate a score test statistic for haplotypes > ### Aliases: haplo.chistat > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "haplo.em" > > ### * haplo.em > > flush(stderr()); flush(stdout()) > > ### Name: haplo.em > ### Title: EM Computation of Haplotype Probabilities, with Progressive > ### Insertion of Loci > ### Aliases: haplo.em > > > ### ** Examples > > setupData(hla.demo) [1] "hla.demo" > attach(hla.demo) > geno <- hla.demo[,c(17,18,21:24)] > label <-c("DQB","DRB","B") > keep <- !apply(is.na(geno) | geno==0, 1, any) > > save.em.keep <- haplo.em(geno=geno[keep,], locus.label=label) > > # warning: output will not exactly match > > print.haplo.em(save.em.keep) ================================================================================ Haplotypes ================================================================================ DQB DRB B hap.freq 1 21 1 8 0.00235 2 21 2 7 0.00229 3 21 2 18 0.00229 4 21 3 8 0.10515 5 21 3 18 0.00462 6 21 3 35 0.00571 7 21 3 44 0.00363 8 21 3 49 0.00229 9 21 3 57 0.00240 10 21 3 70 0.00229 11 21 4 62 0.00459 12 21 7 7 0.01430 13 21 7 13 0.01086 14 21 7 18 0.00250 15 21 7 35 0.00238 16 21 7 44 0.02186 17 21 7 45 0.00229 18 21 7 50 0.00459 19 21 7 57 0.00229 20 21 7 62 0.00774 21 21 8 18 0.00229 22 21 8 63 0.00229 23 21 9 51 0.00229 24 21 10 8 0.00229 25 31 1 27 0.00459 26 31 2 14 0.00229 27 31 2 44 0.00230 28 31 3 8 0.00459 29 31 4 13 0.00520 30 31 4 27 0.00499 31 31 4 35 0.00459 32 31 4 41 0.00229 33 31 4 44 0.02875 34 31 4 57 0.00229 35 31 4 60 0.00692 36 31 7 7 0.00000 37 31 7 44 0.00459 38 31 7 61 0.00229 39 31 8 35 0.00229 40 31 8 37 0.00229 41 31 8 45 0.00229 42 31 8 52 0.00229 43 31 8 60 0.00459 44 31 11 7 0.00229 45 31 11 18 0.00459 46 31 11 27 0.00608 47 31 11 35 0.01725 48 31 11 37 0.00688 49 31 11 38 0.00688 50 31 11 44 0.01011 51 31 11 49 0.00459 52 31 11 51 0.01095 53 31 11 56 0.00229 54 31 11 60 0.00233 55 31 11 61 0.00459 56 31 11 62 0.00603 57 31 13 8 0.00469 58 31 13 14 0.00229 59 31 13 41 0.00459 60 31 13 57 0.00219 61 31 14 58 0.00229 62 31 14 63 0.00229 63 32 1 7 0.00229 64 32 1 35 0.00224 65 32 2 44 0.00291 66 32 3 35 0.00235 67 32 3 51 0.00229 68 32 4 7 0.01714 69 32 4 8 0.00473 70 32 4 14 0.00459 71 32 4 35 0.00345 72 32 4 44 0.00243 73 32 4 45 0.00167 74 32 4 51 0.00229 75 32 4 55 0.00251 76 32 4 60 0.03090 77 32 4 62 0.02371 78 32 7 14 0.00229 79 32 7 39 0.00229 80 32 7 57 0.00459 81 32 8 7 0.00688 82 32 9 51 0.00229 83 32 10 39 0.00229 84 33 7 7 0.00459 85 33 7 57 0.00688 86 33 9 8 0.00229 87 33 9 46 0.00229 88 33 9 48 0.00229 89 33 9 60 0.00688 90 33 10 51 0.00229 91 42 4 35 0.00229 92 42 8 18 0.00229 93 42 8 55 0.00229 94 42 8 60 0.00229 95 51 1 8 0.00461 96 51 1 18 0.00241 97 51 1 27 0.01416 98 51 1 35 0.02966 99 51 1 39 0.00459 100 51 1 44 0.01743 101 51 1 47 0.00229 102 51 1 48 0.00229 103 51 1 51 0.00740 104 51 1 58 0.00229 105 51 1 60 0.00231 106 51 2 51 0.00229 107 51 4 27 0.00229 108 51 8 7 0.00459 109 51 10 7 0.00229 110 51 10 14 0.00229 111 51 10 18 0.00229 112 51 10 35 0.00229 113 51 10 37 0.00459 114 51 14 56 0.00229 115 52 2 27 0.00229 116 52 2 42 0.00229 117 52 2 56 0.00459 118 52 2 62 0.00459 119 52 4 39 0.00229 120 52 8 60 0.00229 121 53 8 57 0.00229 122 53 9 51 0.00229 123 53 14 35 0.00229 124 53 14 38 0.00459 125 53 14 44 0.00229 126 53 14 51 0.00229 127 53 14 55 0.00459 128 61 2 44 0.00229 129 61 2 60 0.00229 130 61 2 61 0.00459 131 61 2 62 0.00229 132 61 4 52 0.00229 133 61 8 35 0.00000 134 61 8 44 0.00229 135 61 13 39 0.00229 136 61 13 44 0.00229 137 62 2 7 0.05068 138 62 2 8 0.00462 139 62 2 18 0.01570 140 62 2 27 0.00459 141 62 2 35 0.01045 142 62 2 44 0.01369 143 62 2 60 0.00515 144 62 4 7 0.00230 145 62 4 45 0.00291 146 62 7 57 0.00229 147 62 8 35 0.00229 148 62 8 39 0.00229 149 62 10 51 0.00229 150 62 11 55 0.00229 151 62 13 51 0.00229 152 62 14 51 0.00229 153 63 2 7 0.01376 154 63 2 35 0.00000 155 63 2 44 0.00229 156 63 4 48 0.00229 157 63 8 18 0.00229 158 63 8 58 0.00229 159 63 10 44 0.00229 160 63 13 7 0.01606 161 63 13 35 0.00000 162 63 13 38 0.00688 163 63 13 44 0.01606 164 63 13 55 0.00437 165 63 13 60 0.00558 166 63 13 62 0.00840 167 64 2 51 0.00229 168 64 11 38 0.00229 169 64 13 7 0.00961 170 64 13 14 0.00459 171 64 13 35 0.00680 172 64 13 44 0.00238 173 64 13 51 0.00229 174 64 13 57 0.00229 175 64 13 60 0.00415 176 64 13 61 0.00229 177 64 13 63 0.00688 ================================================================================ Details ================================================================================ lnlike = -1837.008 lr stat for no LD = 598.3421 , df = 123 , p-val = 0 > > > > cleanEx(); ..nameEx <- "haplo.em.control" > > ### * haplo.em.control > > flush(stderr()); flush(stdout()) > > ### Name: haplo.em.control > ### Title: Create the Control Parameters for the EM Computation of > ### Haplotype Probabilities, with Progressive Insertion of Loci > ### Aliases: haplo.em.control > > > ### ** Examples > > # This is how it is used within haplo.score > # > score.gauss <- haplo.score(resp, geno, trait.type="gaussian", > # > em.control=haplo.em.control(insert.batch.size = 2, n.try=1)) > > > > cleanEx(); ..nameEx <- "haplo.em.fitter" > > ### * haplo.em.fitter > > flush(stderr()); flush(stdout()) > > ### Name: haplo.em.fitter > ### Title: Compute engine for haplotype EM algorithm > ### Aliases: haplo.em.fitter > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "haplo.enum" > > ### * haplo.enum > > flush(stderr()); flush(stdout()) > > ### Name: haplo.enum > ### Title: Enumerate all possible pairs of haplotypes that are consistent > ### with a set of un-phased multilocus markers > ### Aliases: haplo.enum > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "haplo.glm" > > ### * haplo.glm > > flush(stderr()); flush(stdout()) > > ### Name: haplo.glm > ### Title: GLM Regression of Trait on Ambiguous Haplotypes > ### Aliases: haplo.glm > > > ### ** Examples > > # FOR REGULAR USAGE, DO NOT DISCARD GENOTYPES WITH MISSING VALUES > # WE ONLY SUBSET BY KEEP HERE SO THE EXAMPLES RUN FASTER > > setupData(hla.demo) [1] "hla.demo" > geno <- as.matrix(hla.demo[,c(17,18,21:24)]) > keep <- !apply(is.na(geno) | geno==0, 1, any) # SKIP THESE THREE LINES > hla.demo <- hla.demo[keep,] # IN AN ANALYSIS > geno <- geno[keep,] # > attach(hla.demo) > label <-c("DQB","DRB","B") > y <- hla.demo$resp > y.bin <- 1*(hla.demo$resp.cat=="low") > > # set up a genotype array as a model.matrix for inserting into data frame > # Note that hla.demo is a data.frame, and we need to subset to columns > # of interest. Also also need to convert to a matrix object, so that > # setupGeno can code alleles and convert geno to 'model.matrix' class. > > geno <- setupGeno(geno, miss.val=c(0,NA)) > > # geno now has an attribute 'unique.alleles' which must be passed to > # haplo.glm as allele.lev=attributes(geno)$unique.alleles, see below > > my.data <- data.frame(geno=geno, age=hla.demo$age, male=hla.demo$male, + y=y, y.bin=y.bin) > > fit.gaus <- haplo.glm(y ~ male + geno, family = gaussian, na.action= + "na.geno.keep",allele.lev=attributes(geno)$unique.alleles, + data=my.data, locus.label=label, + control = haplo.glm.control(haplo.freq.min=0.02)) > fit.gaus Call: haplo.glm(formula = y ~ male + geno, family = gaussian, data = my.data, na.action = "na.geno.keep", locus.label = label, allele.lev = attributes(geno)$unique.alleles, control = haplo.glm.control(haplo.freq.min = 0.02)) Coefficients: coef se t.stat pval (Intercept) 1.0672 0.343 3.114 0.00211 male 0.0815 0.156 0.524 0.60100 geno.16 0.2509 0.453 0.553 0.58053 geno.33 -0.3160 0.343 -0.920 0.35863 geno.76 0.2243 0.361 0.621 0.53501 geno.77 1.1386 0.384 2.967 0.00335 geno.98 0.5882 0.362 1.625 0.10572 geno.137 0.9825 0.304 3.234 0.00142 geno.rare 0.4068 0.182 2.235 0.02647 Haplotypes: DQB DRB B hap.freq geno.16 21 7 44 0.0214 geno.33 31 4 44 0.0288 geno.76 32 4 60 0.0305 geno.77 32 4 62 0.0241 geno.98 51 1 35 0.0297 geno.137 62 2 7 0.0504 geno.rare * * * 0.7099 haplo.base 21 3 8 0.1052 > > > > > cleanEx(); ..nameEx <- "haplo.glm.control" > > ### * haplo.glm.control > > flush(stderr()); flush(stdout()) > > ### Name: haplo.glm.control > ### Title: Create list of control parameters for haplo.glm > ### Aliases: haplo.glm.control > > > ### ** Examples > > # using the data set up in the example for haplo.glm, > # the control function is used in haplo.glm as follows > # > fit <- haplo.glm(y ~ male + geno, family = gaussian, > # > na.action="na.geno.keep", > # > data=my.data, locus.label=locus.label, > # > control = haplo.glm.control(haplo.min.count=5, > # > em.c=haplo.em.control(n.try=1))) > > > > cleanEx(); ..nameEx <- "haplo.group" > > ### * haplo.group > > flush(stderr()); flush(stdout()) > > ### Name: haplo.group > ### Title: Frequencies for Haplotypes by Grouping Variable > ### Aliases: haplo.group > > > ### ** Examples > > setupData(hla.demo) [1] "hla.demo" > geno <- as.matrix(hla.demo[,c(17,18,21:24)]) > > # remove any subjects with missing alleles for faster examples, > # but you may keep them in practice > 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) > print.haplo.group(group.bin) -------------------------------------------------------------------------------- Counts per Grouping Variable Value -------------------------------------------------------------------------------- group 0 1 156 62 -------------------------------------------------------------------------------- Haplotype Frequencies By Group -------------------------------------------------------------------------------- loc.1 loc.2 loc.3 Total y.bin.0 y.bin.1 1 21 1 8 0.00235 0.00337 NA 2 21 10 8 0.00229 0.00321 NA 3 21 2 18 0.00229 0.00321 NA 4 21 2 7 0.00229 0.00321 NA 5 21 3 18 0.00462 0.00675 NA 6 21 3 35 0.00571 0.00651 NA 7 21 3 44 0.00363 0.00335 0.01613 8 21 3 49 0.00229 NA NA 9 21 3 57 0.00240 NA NA 10 21 3 70 0.00229 NA NA 11 21 3 8 0.10515 0.06976 0.19355 12 21 4 62 0.00459 0.00641 NA 13 21 7 13 0.01086 NA 0.02419 14 21 7 18 0.00250 NA NA 15 21 7 35 0.00238 NA 0.00806 16 21 7 44 0.02186 0.01764 0.04839 17 21 7 45 0.00229 0.00321 NA 18 21 7 50 0.00459 0.00321 0.00806 19 21 7 57 0.00229 0.00641 NA 20 21 7 62 0.00774 0.00742 NA 21 21 7 7 0.01430 0.01981 NA 22 21 8 18 0.00229 0.00286 NA 23 21 8 63 0.00229 NA NA 24 21 9 51 0.00229 NA NA 25 31 1 27 0.00459 0.00641 NA 26 31 11 18 0.00459 NA 0.00806 27 31 11 27 0.00608 0.00507 0.00806 28 31 11 35 0.01725 0.01923 0.01613 29 31 11 37 0.00688 0.00641 0.00806 30 31 11 38 0.00688 0.00641 0.00806 31 31 11 44 0.01011 0.00943 NA 32 31 11 49 0.00459 NA 0.01613 33 31 11 51 0.01095 0.01215 NA 34 31 11 56 0.00229 NA 0.00806 35 31 11 60 0.00233 NA 0.00806 36 31 11 61 0.00459 0.00641 NA 37 31 11 62 0.00603 0.00860 NA 38 31 11 7 0.00229 0.00321 NA 39 31 13 14 0.00229 0.00321 NA 40 31 13 41 0.00459 0.00641 NA 41 31 13 57 0.00219 NA 0.00806 42 31 13 8 0.00469 NA NA 43 31 14 58 0.00229 NA NA 44 31 14 63 0.00229 0.00321 NA 45 31 2 14 0.00229 NA NA 46 31 2 44 0.00230 NA 0.01613 47 31 3 8 0.00459 0.00321 0.00806 48 31 4 13 0.00520 0.00321 NA 49 31 4 27 0.00499 0.00758 NA 50 31 4 35 0.00459 NA 0.01613 51 31 4 41 0.00229 0.00321 NA 52 31 4 44 0.02875 0.01458 0.06452 53 31 4 57 0.00229 NA NA 54 31 4 60 0.00692 0.01310 NA 55 31 7 44 0.00459 0.00641 NA 56 31 7 61 0.00229 NA NA 57 31 7 7 0.00000 NA 0.00806 58 31 8 35 0.00229 0.00321 NA 59 31 8 37 0.00229 0.00321 NA 60 31 8 45 0.00229 0.00321 NA 61 31 8 52 0.00229 0.00321 NA 62 31 8 60 0.00459 0.00321 NA 63 32 1 35 0.00224 0.00304 NA 64 32 1 7 0.00229 0.00000 NA 65 32 10 39 0.00229 0.00321 NA 66 32 2 44 0.00291 0.00321 NA 67 32 3 35 0.00235 0.00337 NA 68 32 3 51 0.00229 0.00321 NA 69 32 4 14 0.00459 NA NA 70 32 4 35 0.00345 0.00565 NA 71 32 4 44 0.00243 0.00333 0.01613 72 32 4 45 0.00167 NA NA 73 32 4 51 0.00229 0.00321 NA 74 32 4 55 0.00251 NA 0.00000 75 32 4 60 0.03090 0.03173 0.04032 76 32 4 62 0.02371 0.01923 NA 77 32 4 7 0.01714 0.02645 0.00806 78 32 4 8 0.00473 0.00335 0.00806 79 32 7 14 0.00229 NA 0.00806 80 32 7 39 0.00229 0.00321 NA 81 32 7 57 0.00459 NA NA 82 32 8 7 0.00688 0.00962 NA 83 32 9 51 0.00229 0.00321 NA 84 33 10 51 0.00229 0.00321 NA 85 33 7 57 0.00688 NA 0.01613 86 33 7 7 0.00459 0.00321 NA 87 33 9 46 0.00229 0.00321 NA 88 33 9 48 0.00229 0.00321 NA 89 33 9 60 0.00688 0.00321 0.01613 90 33 9 8 0.00229 NA NA 91 42 4 35 0.00229 NA NA 92 42 8 18 0.00229 0.00321 NA 93 42 8 55 0.00229 NA NA 94 42 8 60 0.00229 NA NA 95 51 1 18 0.00241 0.00331 NA 96 51 1 27 0.01416 0.01619 0.00806 97 51 1 35 0.02966 0.03779 0.00806 98 51 1 39 0.00459 NA 0.00806 99 51 1 44 0.01743 0.01791 NA 100 51 1 47 0.00229 NA NA 101 51 1 48 0.00229 NA 0.00806 102 51 1 51 0.00740 0.01029 NA 103 51 1 58 0.00229 NA 0.00806 104 51 1 60 0.00231 0.00325 NA 105 51 1 8 0.00461 0.00323 0.00806 106 51 10 14 0.00229 0.00321 NA 107 51 10 18 0.00229 0.00321 NA 108 51 10 35 0.00229 0.00321 NA 109 51 10 37 0.00459 NA 0.00806 110 51 10 7 0.00229 0.00000 NA 111 51 14 56 0.00229 0.00321 NA 112 51 2 51 0.00229 0.00321 NA 113 51 4 27 0.00229 0.00321 NA 114 51 8 7 0.00459 NA 0.00806 115 52 2 27 0.00229 0.00321 NA 116 52 2 42 0.00229 0.00321 NA 117 52 2 56 0.00459 0.00321 0.00806 118 52 2 62 0.00459 0.00641 NA 119 52 4 39 0.00229 0.00321 NA 120 52 8 60 0.00229 0.00321 NA 121 53 14 35 0.00229 NA 0.00806 122 53 14 38 0.00459 0.00641 NA 123 53 14 44 0.00229 NA 0.00806 124 53 14 51 0.00229 0.00321 NA 125 53 14 55 0.00459 NA 0.00806 126 53 8 57 0.00229 0.00321 NA 127 53 9 51 0.00229 0.00321 NA 128 61 13 39 0.00229 0.00321 NA 129 61 13 44 0.00229 0.00321 NA 130 61 2 44 0.00229 0.00321 NA 131 61 2 60 0.00229 0.00321 NA 132 61 2 61 0.00459 0.00321 NA 133 61 2 62 0.00229 0.00321 NA 134 61 4 52 0.00229 NA NA 135 61 8 35 0.00000 NA NA 136 61 8 44 0.00229 0.00321 NA 137 62 10 51 0.00229 0.00321 NA 138 62 11 55 0.00229 0.00321 NA 139 62 13 51 0.00229 0.00321 NA 140 62 14 51 0.00229 0.00321 NA 141 62 2 18 0.01570 0.01272 0.02419 142 62 2 27 0.00459 NA NA 143 62 2 35 0.01045 0.00491 0.00806 144 62 2 44 0.01369 0.01340 NA 145 62 2 60 0.00515 NA 0.00806 146 62 2 7 0.05068 0.06833 0.01613 147 62 2 8 0.00462 0.00641 NA 148 62 4 45 0.00291 0.00321 NA 149 62 4 7 0.00230 0.00321 NA 150 62 7 57 0.00229 0.00321 NA 151 62 8 35 0.00229 NA 0.00806 152 62 8 39 0.00229 0.00321 NA 153 63 10 44 0.00229 0.00321 NA 154 63 13 35 0.00000 NA NA 155 63 13 38 0.00688 0.00641 0.00806 156 63 13 44 0.01606 0.01650 0.00806 157 63 13 55 0.00437 NA 0.00806 158 63 13 60 0.00558 NA 0.01613 159 63 13 62 0.00840 0.01282 NA 160 63 13 7 0.01606 0.02196 NA 161 63 2 35 0.00000 0.00246 NA 162 63 2 44 0.00229 NA NA 163 63 2 7 0.01376 0.01036 0.01613 164 63 4 48 0.00229 0.00321 NA 165 63 8 18 0.00229 NA 0.00806 166 63 8 58 0.00229 0.00321 NA 167 64 11 38 0.00229 0.00321 NA 168 64 13 14 0.00459 NA 0.01613 169 64 13 35 0.00680 0.01319 NA 170 64 13 44 0.00238 NA 0.00806 171 64 13 51 0.00229 0.00321 NA 172 64 13 57 0.00229 NA NA 173 64 13 60 0.00415 0.00641 NA 174 64 13 61 0.00229 0.00321 NA 175 64 13 63 0.00688 0.00962 NA 176 64 13 7 0.00961 0.00918 NA 177 64 2 51 0.00229 0.00321 NA > > > > cleanEx(); ..nameEx <- "haplo.hash" > > ### * haplo.hash > > flush(stderr()); flush(stdout()) > > ### Name: haplo.hash > ### Title: Integer Rank Codes for Haplotypes > ### Aliases: haplo.hash > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "haplo.model.frame" > > ### * haplo.model.frame > > flush(stderr()); flush(stdout()) > > ### Name: haplo.model.frame > ### Title: Sets up a model frame for haplo.glm > ### Aliases: haplo.model.frame > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "haplo.scan" > > ### * haplo.scan > > flush(stderr()); flush(stdout()) > > ### Name: haplo.scan > ### Title: Search for a trait-locus by sliding a fixed-width window over > ### each marker locus and scanning all possible haplotype lengths within > ### the window > ### Aliases: haplo.scan > > > ### ** Examples > > # create a random genotype matrix with 10 loci, 50 cases, 50 controls > set.seed(1) > tmp <- ifelse(runif(2000)>.3, 1, 2) > geno <- matrix(tmp, ncol=20) > y <- rep(c(0,1),c(50,50)) > > # search 10-locus region, typically don't limit the number of > # simulations, but run time can get long with many simulations > > scan.obj <- haplo.scan(y, geno, width=3, + sim.control = score.sim.control(min.sim=10, max.sim=20)) > > print(scan.obj) Call: haplo.scan(y = y, geno = geno, width = 3, sim.control = score.sim.control(min.sim = 10, max.sim = 20)) ================================================================================ Locus Scan-statistic Simulated P-values ================================================================================ loc-1 loc-2 loc-3 loc-4 loc-5 loc-6 loc-7 loc-8 loc-9 loc-10 sim.p-val 0.25 0.05 0.05 0.05 0.3 0.45 0.4 0.8 0.95 1 Loci with max scan statistic: 2 3 4 Max-Stat Simulated Global p-value: 0.2 Number of Simulations: 20 > > > > cleanEx(); ..nameEx <- "haplo.scan.obs" > > ### * haplo.scan.obs > > flush(stderr()); flush(stdout()) > > ### Name: haplo.scan.obs > ### Title: For observed data, slide a fixed-width window over each marker > ### locus and scan all possible haplotypes within the window > ### Aliases: haplo.scan.obs > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "haplo.scan.sim" > > ### * haplo.scan.sim > > flush(stderr()); flush(stdout()) > > ### Name: haplo.scan.sim > ### Title: For simulated data, slide a fixed-width window over each marker > ### locus and scan all possible haplotypes within the window > ### Aliases: haplo.scan.sim > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "haplo.score" > > ### * haplo.score > > flush(stderr()); flush(stdout()) > > ### Name: haplo.score > ### Title: Score Statistics for Association of Traits with Haplotypes > ### Aliases: haplo.score > > > ### ** Examples > > # establish all hla.demo data, > # remove genotypes with missing alleles just so haplo.score runs faster > # with missing values included, this example takes 2-4 minutes > # FOR REGULAR USAGE, DO NOT DISCARD GENOTYPES WITH MISSING VALUES > > setupData(hla.demo) [1] "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) > label <- c("DQB","DRB","B") > > # For quantitative, normally distributed trait: > > score.gaus <- haplo.score(resp, geno, locus.label=label, + trait.type = "gaussian") > print(score.gaus) -------------------------------------------------------------------------------- Global Score Statistics -------------------------------------------------------------------------------- global-stat = 30.79521, df = 17, p-val = 0.02115 -------------------------------------------------------------------------------- Haplotype-specific Scores -------------------------------------------------------------------------------- DQB DRB B Hap-Freq Hap-Score p-val [1,] 21 3 8 0.10515 -2.4485 0.01435 [2,] 31 4 44 0.02875 -2.26997 0.02321 [3,] 51 1 44 0.01743 -0.93081 0.35195 [4,] 63 13 44 0.01606 -0.74713 0.45498 [5,] 63 2 7 0.01376 -0.55206 0.58091 [6,] 21 7 44 0.02186 -0.49537 0.62034 [7,] 32 4 60 0.0309 -0.49136 0.62317 [8,] 62 2 44 0.01369 -0.25836 0.79613 [9,] 62 2 18 0.0157 -0.2548 0.79888 [10,] 51 1 27 0.01416 0.05697 0.95457 [11,] 31 11 35 0.01725 0.49671 0.6194 [12,] 51 1 35 0.02966 0.79313 0.4277 [13,] 32 4 7 0.01714 1.00837 0.31328 [14,] 21 7 7 0.0143 1.19616 0.23163 [15,] 63 13 7 0.01606 2.19393 0.02824 [16,] 32 4 62 0.02371 2.35151 0.0187 [17,] 62 2 7 0.05068 2.397 0.01653 > > # For ordinal trait: > y.ord <- as.numeric(resp.cat) > score.ord <- haplo.score(y.ord, geno, locus.label=label, + trait.type="ordinal") > print(score.ord) -------------------------------------------------------------------------------- Global Score Statistics -------------------------------------------------------------------------------- global-stat = 34.46701, df = 17, p-val = 0.0073 -------------------------------------------------------------------------------- Haplotype-specific Scores -------------------------------------------------------------------------------- DQB DRB B Hap-Freq Hap-Score p-val [1,] 21 3 8 0.10502 -2.83517 0.00458 [2,] 31 4 44 0.02875 -2.6415 0.00825 [3,] 63 13 44 0.01555 -0.56699 0.57072 [4,] 62 2 18 0.01573 -0.55686 0.57763 [5,] 51 1 44 0.01744 -0.5409 0.58857 [6,] 21 7 44 0.0219 -0.33723 0.73594 [7,] 32 4 60 0.0309 -0.20674 0.83622 [8,] 63 2 7 0.01348 -0.07091 0.94347 [9,] 62 2 44 0.01369 0.02745 0.9781 [10,] 51 1 27 0.01416 0.32061 0.74851 [11,] 31 11 35 0.01728 0.64425 0.51942 [12,] 51 1 35 0.0297 0.92883 0.35298 [13,] 21 7 7 0.0143 1.42418 0.1544 [14,] 32 4 7 0.01691 1.47411 0.14045 [15,] 32 4 62 0.02371 1.89113 0.05861 [16,] 63 13 7 0.01605 1.89743 0.05777 [17,] 62 2 7 0.0512 2.40725 0.01607 > > # For a binary trait and simulations, > # limit simulations to 500 in score.sim.control, default is 20000 > y.bin <-ifelse(y.ord==1,1,0) > score.bin.sim <- haplo.score(y.bin, geno, trait.type = "binomial", + locus.label=label, simulate=TRUE, sim.control= + score.sim.control(min.sim=200,max.sim=500)) > > print(score.bin.sim) -------------------------------------------------------------------------------- Global Score Statistics -------------------------------------------------------------------------------- global-stat = 34.99167, df = 17, p-val = 0.00624 -------------------------------------------------------------------------------- Global Simulation p-value Results -------------------------------------------------------------------------------- Global sim. p-val = 0.006 Max-Stat sim. p-val = 0.008 Number of Simulations, Global: 500 , Max-Stat: 500 -------------------------------------------------------------------------------- Haplotype-specific Scores -------------------------------------------------------------------------------- DQB DRB B Hap-Freq Hap-Score p-val sim p-val [1,] 62 2 7 0.05067 -2.14348 0.03207 0.042 [2,] 51 1 35 0.02967 -1.70404 0.08837 0.064 [3,] 63 13 7 0.01606 -1.69539 0.09 0.094 [4,] 21 7 7 0.01431 -1.55298 0.12043 0.1 [5,] 32 4 7 0.01714 -1.02178 0.30689 0.282 [6,] 51 1 27 0.01416 -0.69704 0.48578 0.466 [7,] 32 4 62 0.02371 -0.66703 0.50475 0.466 [8,] 31 11 35 0.01728 -0.5236 0.60056 0.66 [9,] 51 1 44 0.01744 -0.13408 0.89334 0.788 [10,] 32 4 60 0.0309 0.04749 0.96213 0.958 [11,] 63 13 44 0.01555 0.06218 0.95042 1 [12,] 62 2 44 0.0139 0.18204 0.85555 0.924 [13,] 63 2 7 0.01376 0.26941 0.78762 0.942 [14,] 62 2 18 0.01553 0.80075 0.42327 0.636 [15,] 21 7 44 0.02167 1.04709 0.29506 0.322 [16,] 31 4 44 0.02875 2.53818 0.01114 0.008 [17,] 21 3 8 0.10502 3.82255 0.00013 0 > > # For a binary trait, adjusted for sex and age: > > x <- cbind(male, age) > score.bin.adj <- haplo.score(y.bin, geno, trait.type = "binomial", + locus.label=label, x.adj=x) > print(score.bin.adj) -------------------------------------------------------------------------------- Global Score Statistics -------------------------------------------------------------------------------- global-stat = 36.17382, df = 18, p-val = 0.0067 -------------------------------------------------------------------------------- Haplotype-specific Scores -------------------------------------------------------------------------------- DQB DRB B Hap-Freq Hap-Score p-val [1,] 62 2 7 0.04948 -2.1712 0.02992 [2,] 51 1 35 0.02968 -1.76135 0.07818 [3,] 63 13 7 0.01309 -1.60828 0.10777 [4,] 21 7 7 0.01426 -1.56454 0.11769 [5,] 32 4 7 0.02296 -1.26014 0.20762 [6,] 51 1 27 0.014 -0.74114 0.45861 [7,] 31 11 35 0.01728 -0.55781 0.57697 [8,] 32 4 62 0.02135 -0.51999 0.60307 [9,] 62 2 35 0.0116 -0.44104 0.65918 [10,] 51 1 44 0.01746 -0.16896 0.86583 [11,] 62 2 44 0.0137 0.09197 0.92672 [12,] 63 13 44 0.01555 0.19142 0.8482 [13,] 32 4 60 0.03094 0.20878 0.83462 [14,] 63 2 7 0.01376 0.39965 0.68941 [15,] 62 2 18 0.01569 0.72257 0.46995 [16,] 21 7 44 0.02192 1.01114 0.31195 [17,] 31 4 44 0.02874 2.62702 0.00861 [18,] 21 3 8 0.105 3.81016 0.00014 > > > > cleanEx(); ..nameEx <- "haplo.score.glm" > > ### * haplo.score.glm > > flush(stderr()); flush(stdout()) > > ### Name: haplo.score.glm > ### Title: Compute haplotype score statistics for GLM > ### Aliases: haplo.score.glm > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "haplo.score.merge" > > ### * haplo.score.merge > > flush(stderr()); flush(stdout()) > > ### Name: haplo.score.merge > ### Title: Merge haplo.score And haplo.group Objects > ### Aliases: haplo.score.merge > > > ### ** Examples > > setupData(hla.demo) [1] "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) -------------------------------------------------------------------------------- Haplotype Scores, p-values, and Frequencies By Group -------------------------------------------------------------------------------- loc.1 loc.2 loc.3 Hap.Score p.val Hap.Freq y.bin.0 y.bin.1 1 62 2 7 -2.08863 0.03674 0.05068 0.06833 0.01613 2 51 1 35 -1.70404 0.08837 0.02966 0.03779 0.00806 3 21 7 7 -1.56010 0.11874 0.01430 0.01981 NA 4 63 13 7 -1.53912 0.12377 0.01606 0.02196 NA 5 32 4 7 -1.24093 0.21463 0.01714 0.02645 0.00806 6 51 1 27 -0.69715 0.48571 0.01416 0.01619 0.00806 7 32 4 62 -0.66705 0.50474 0.02371 0.01923 NA 8 31 11 35 -0.53177 0.59488 0.01725 0.01923 0.01613 9 62 2 35 -0.43653 0.66245 0.01045 0.00491 0.00806 10 51 1 44 -0.13397 0.89343 0.01743 0.01791 NA 11 63 13 44 0.00781 0.99377 0.01606 0.01650 0.00806 12 32 4 60 0.04802 0.96170 0.03090 0.03173 0.04032 13 62 2 44 0.05072 0.95955 0.01369 0.01340 NA 14 63 2 7 0.26941 0.78762 0.01376 0.01036 0.01613 15 62 2 18 0.87289 0.38272 0.01570 0.01272 0.02419 16 21 7 44 1.11398 0.26529 0.02186 0.01764 0.04839 17 31 4 44 2.53701 0.01118 0.02875 0.01458 0.06452 18 21 3 8 3.81983 0.00013 0.10515 0.06976 0.19355 > > > > cleanEx(); ..nameEx <- "haplo.score.podds" > > ### * haplo.score.podds > > flush(stderr()); flush(stdout()) > > ### Name: haplo.score.podds > ### Title: Compute Haplotype Score Statistics for Ordinal Traits with > ### Proportional Odds Model > ### Aliases: haplo.score.podds > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "haplo.score.slide" > > ### * haplo.score.slide > > flush(stderr()); flush(stdout()) > > ### Name: haplo.score.slide > ### Title: Score Statistics for Association of Traits with Haplotypes > ### Aliases: haplo.score.slide > > > ### ** Examples > > setupData(hla.demo) [1] "hla.demo" > > # Continuous trait slide by 2 loci on all 11 loci, uncomment to run it. > # Takes > 20 minutes to run > # geno.11 <- hla.demo[,-c(1:4)] > # label.11 <- c("DPB","DPA","DMA","DMB","TAP1","TAP2","DQB","DQA","DRB","B","A") > # slide.gaus <- haplo.score.slide(resp, geno.11, trait.type = "gaussian", > # locus.label=label.11, n.slide=2) > > # print(slide.gaus) > # plot(slide.gaus) > > # Run shortened example on 9 loci > # For an ordinal trait, slide by 3 loci, and simulate p-values: > # geno.9 <- hla.demo[,-c(1:6,15,16)] > # label.9 <- c("DPA","DMA","DMB","TAP1","DQB","DQA","DRB","B","A") > > # y.ord <- as.numeric(hla.demo$resp.cat) > > # data is set up, to run, run these lines of code on the data that was > # set up in this example. It takes > 15 minutes to run > # slide.ord.sim <- haplo.score.slide(y.ord, geno.9, trait.type = "ordinal", > # n.slide=3, locus.label=label.9, simulate=TRUE, > # sim.control=score.sim.control(min.sim=200, max.sim=500)) > > # note, results will vary due to simulations > # print(slide.ord.sim) > # plot(slide.ord.sim) > # plot(slide.ord.sim, pval="global.sim") > # plot(slide.ord.sim, pval="max.sim") > > > > cleanEx(); ..nameEx <- "locator.haplo" > > ### * locator.haplo > > flush(stderr()); flush(stdout()) > > ### Name: locator.haplo > ### Title: Find Location from Mouse Clicks and Print Haplotypes on Plot > ### Aliases: locator.haplo > > > ### ** Examples > > # follow the pseudo-code > # score.out <- haplo.score(y, geno, trait.type = "gaussian") > > # plot(score.out) > > # locator.haplo(score.out) > > > > cleanEx(); ..nameEx <- "loci" > > ### * loci > > flush(stderr()); flush(stdout()) > > ### Name: loci > ### Title: Create a group of locus objects from a genotype matrix, assign > ### to 'model.matrix' class. > ### Aliases: loci > > > ### ** Examples > > # Create some loci to work with > a1 <- 1:6 > a2 <- 7:12 > > b1 <- c("A","A","B","C","E","D") > b2 <-c("A","A","C","E","F","G") > > c1 <- c("101","10","115","132","21","112") > c2 <- c("100","101","0","100","21","110") > > myloci <- data.frame(a1,a2,b1,b2,c1,c2) > myloci <- loci(myloci, locus.names=c("A","B","C"),miss.val=c(0,NA)) > myloci A.a1 A.a2 B.a1 B.a2 C.a1 C.a2 [1,] 1 7 1 1 3 2 [2,] 2 8 1 1 1 3 [3,] 3 9 2 3 6 NA [4,] 4 10 3 5 7 2 [5,] 5 11 5 6 8 8 [6,] 6 12 4 7 5 4 attr(,"class") [1] "model.matrix" attr(,"locus.names") [1] "A" "B" "C" attr(,"map") [1] NA attr(,"x.linked") [1] FALSE attr(,"unique.alleles") attr(,"unique.alleles")[[1]] [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" attr(,"unique.alleles")[[2]] [1] "A" "B" "C" "D" "E" "F" "G" attr(,"unique.alleles")[[3]] [1] "10" "100" "101" "110" "112" "115" "132" "21" attr(,"male.code") [1] "M" attr(,"female.code") [1] "F" > > attributes(myloci) $dim [1] 6 6 $dimnames $dimnames[[1]] NULL $dimnames[[2]] [1] "A.a1" "A.a2" "B.a1" "B.a2" "C.a1" "C.a2" $class [1] "model.matrix" $locus.names [1] "A" "B" "C" $map [1] NA $x.linked [1] FALSE $unique.alleles $unique.alleles[[1]] [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" $unique.alleles[[2]] [1] "A" "B" "C" "D" "E" "F" "G" $unique.alleles[[3]] [1] "10" "100" "101" "110" "112" "115" "132" "21" $male.code [1] "M" $female.code [1] "F" > > > > cleanEx(); ..nameEx <- "locus" > > ### * locus > > flush(stderr()); flush(stdout()) > > ### Name: locus > ### Title: Creates an object of class "locus" > ### Aliases: locus > ### Keywords: classes > > ### ** Examples > > b1 <- c("A","A","B","C","E","D") > b2 <- c("A","A","C","E","F","G") > loc1 <- locus(b1,b2,chrom=4,locus.alias="D4S1111") > > loc1 a1 a2 [1,] 1 1 [2,] 1 1 [3,] 2 3 [4,] 3 5 [5,] 5 6 [6,] 4 7 attr(,"chrom.label") [1] 4 attr(,"locus.alias") [1] "D4S1111" attr(,"x.linked") [1] FALSE attr(,"class") [1] "model.matrix" attr(,"allele.labels") [1] "A" "B" "C" "D" "E" "F" "G" > > # a second example which uses more parameters, some may not be supported. > # c1 <- c("101","10","115","132","21","112") > # c2 <- c("100","101","0","100","21","110") > > # gender <- rep(c("M","F"),3) > # loc2 <- locus(c2,c2,chrom="X",locus.alias="DXS1234",x.linked=T,sex=gender) > > > > cleanEx(); ..nameEx <- "louis.info" > > ### * louis.info > > flush(stderr()); flush(stdout()) > > ### Name: louis.info > ### Title: Louis Information for haplo.glm > ### Aliases: louis.info > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "mf.gindx" > > ### * mf.gindx > > flush(stderr()); flush(stdout()) > > ### Name: mf.gindx > ### Title: Model Frame Genotype Index to Account for Missing Data in > ### haplo.glm > ### Aliases: mf.gindx > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "na.geno.keep" > > ### * na.geno.keep > > flush(stderr()); flush(stdout()) > > ### Name: na.geno.keep > ### Title: Remove rows with NA in covariates, but keep genotypes with NAs > ### Aliases: na.geno.keep > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "plot.haplo.score" > > ### * plot.haplo.score > > flush(stderr()); flush(stdout()) > > ### Name: plot.haplo.score > ### Title: Plot Haplotype Frequencies versus Haplotype Score Statistics > ### Aliases: plot.haplo.score > > > ### ** Examples > > setupData(hla.demo) [1] "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) > label <- c("DQB","DRB","B") > > # For quantitative, normally distributed trait: > > score.gaus <- haplo.score(resp, geno, locus.label=label, + trait.type = "gaussian") > > plot.haplo.score(score.gaus) > > > > cleanEx(); ..nameEx <- "plot.haplo.score.slide" > > ### * plot.haplo.score.slide > > flush(stderr()); flush(stdout()) > > ### Name: plot.haplo.score.slide > ### Title: Plot a haplo.score.slide Object > ### Aliases: plot.haplo.score.slide > > > ### ** Examples > > # This example has a long run time, therefore it is commented > > # setupData(hla.demo) > # attach(hla.demo) > # geno.11 <- hla.demo[,-c(1:4)] > # label.11 <- c("DPB","DPA","DMA","DMB","TAP1","TAP2","DQB","DQA","DRB","B","A") > > #For an ordinal trait, slide by 3 loci, and simulate p-values: > # y.ord <- as.numeric(resp.cat) > # slide.ord.sim <- haplo.score.slide(y.ord, geno.11, trait.type = "ordinal", > # n.slide=3, locus.label=label.11, simulate=TRUE, > # sim.control=score.sim.control(min.sim=500)) > > # print(slide.ord.sim) > # plot(slide.ord.sim) > # plot(slide.ord.sim, pval="global.sim") > # plot(slide.ord.sim, pval="max.sim") > > > > cleanEx(); ..nameEx <- "print.haplo.cc" > > ### * print.haplo.cc > > flush(stderr()); flush(stdout()) > > ### Name: print.haplo.cc > ### Title: Print a haplo.cc object > ### Aliases: print.haplo.cc > > > ### ** Examples > > ## for a haplo.cc object named cc.test, > ## order results by haplotype > # print.haplo.cc(cc.test, order.by="haplotype") > > > > cleanEx(); ..nameEx <- "print.haplo.em" > > ### * print.haplo.em > > flush(stderr()); flush(stdout()) > > ### Name: print.haplo.em > ### Title: Print contents of a haplo.em object > ### Aliases: print.haplo.em > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "print.haplo.glm" > > ### * print.haplo.glm > > flush(stderr()); flush(stdout()) > > ### Name: print.haplo.glm > ### Title: Print a contents of a haplo.glm object > ### Aliases: print.haplo.glm > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "print.haplo.group" > > ### * print.haplo.group > > flush(stderr()); flush(stdout()) > > ### Name: print.haplo.group > ### Title: Print a haplo.group object > ### Aliases: print.haplo.group > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "print.haplo.scan" > > ### * print.haplo.scan > > flush(stderr()); flush(stdout()) > > ### Name: print.haplo.scan > ### Title: Print a haplo.scan object > ### Aliases: print.haplo.scan > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "print.haplo.score" > > ### * print.haplo.score > > flush(stderr()); flush(stdout()) > > ### Name: print.haplo.score > ### Title: Print a haplo.score object > ### Aliases: print.haplo.score > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "print.haplo.score.merge" > > ### * print.haplo.score.merge > > flush(stderr()); flush(stdout()) > > ### Name: print.haplo.score.merge > ### Title: Print a haplo.score.merge object > ### Aliases: print.haplo.score.merge > > > ### ** Examples > > #see example for haplo.score.merge > > > > cleanEx(); ..nameEx <- "print.haplo.score.slide" > > ### * print.haplo.score.slide > > flush(stderr()); flush(stdout()) > > ### Name: print.haplo.score.slide > ### Title: Print the contents of a haplo.score.slide object > ### Aliases: print.haplo.score.slide > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "printBanner" > > ### * printBanner > > flush(stderr()); flush(stdout()) > > ### Name: printBanner > ### Title: Print a nice banner > ### Aliases: printBanner > > > ### ** Examples > > printBanner("This is a pretty banner", banner.width=40, char.perline=30) ======================================== This is a pretty banner ======================================== > > # the output looks like this: > # ======================================== > # This is a pretty banner > # ======================================== > > > > cleanEx(); ..nameEx <- "residScaledGlmFit" > > ### * residScaledGlmFit > > flush(stderr()); flush(stdout()) > > ### Name: residScaledGlmFit > ### Title: Scaled Residuals for GLM fit > ### Aliases: residScaledGlmFit > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "score.sim.control" > > ### * score.sim.control > > flush(stderr()); flush(stdout()) > > ### Name: score.sim.control > ### Title: Create the list of control parameters for simulations in > ### haplo.score > ### Aliases: score.sim.control > > > ### ** Examples > > # it would be used in haplo.score as appears below > # > # score.sim.500 <- haplo.score(y, geno, trait.type="gaussian", simulate=T, > # sim.control=score.sim.control(min.sim=500, max.sim=2000) > > > > cleanEx(); ..nameEx <- "setupData" > > ### * setupData > > flush(stderr()); flush(stdout()) > > ### Name: setupData > ### Title: Set up an example dataset provided within the library. > ### Aliases: setupData > > > ### ** Examples > > ## for a data set named my.data load it by > # setupData(my.data) > > ## check the names of my.data to see if it is loaded > # names(my.data) > > > > cleanEx(); ..nameEx <- "setupGeno" > > ### * setupGeno > > flush(stderr()); flush(stdout()) > > ### Name: setupGeno > ### Title: Create a group of locus objects from a genotype matrix, assign > ### to 'model.matrix' class. > ### Aliases: setupGeno > > > ### ** Examples > > # Create some loci to work with > a1 <- 1:6 > a2 <- 7:12 > > b1 <- c("A","A","B","C","E","D") > b2 <-c("A","A","C","E","F","G") > > c1 <- c("101","10","115","132","21","112") > c2 <- c("100","101","0","100","21","110") > > myGeno <- data.frame(a1,a2,b1,b2,c1,c2) > myGeno <- setupGeno(myGeno) > myGeno loc-1.a1 loc-1.a2 loc-2.a1 loc-2.a2 loc-3.a1 loc-3.a2 [1,] 1 7 1 1 3 2 [2,] 2 8 1 1 1 3 [3,] 3 9 2 3 6 NA [4,] 4 10 3 5 7 2 [5,] 5 11 5 6 8 8 [6,] 6 12 4 7 5 4 attr(,"class") [1] "model.matrix" attr(,"unique.alleles") attr(,"unique.alleles")[[1]] [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" attr(,"unique.alleles")[[2]] [1] "A" "B" "C" "D" "E" "F" "G" attr(,"unique.alleles")[[3]] [1] "10" "100" "101" "110" "112" "115" "132" "21" > > attributes(myGeno)$unique.alleles [[1]] [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" [[2]] [1] "A" "B" "C" "D" "E" "F" "G" [[3]] [1] "10" "100" "101" "110" "112" "115" "132" "21" > > > > cleanEx(); ..nameEx <- "summary.haplo.em" > > ### * summary.haplo.em > > flush(stderr()); flush(stdout()) > > ### Name: summary.haplo.em > ### Title: Summarize contents of a haplo.em object > ### Aliases: summary.haplo.em > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "summaryGeno" > > ### * summaryGeno > > flush(stderr()); flush(stdout()) > > ### Name: summaryGeno > ### Title: Summarize Full Haplotype Enumeration on Genotype Matrix > ### Aliases: summaryGeno > > > ### ** Examples > > > > > > cleanEx(); ..nameEx <- "varfunc.glm.fit" > > ### * varfunc.glm.fit > > flush(stderr()); flush(stdout()) > > ### Name: varfunc.glm.fit > ### Title: Variance Function for GLM > ### Aliases: varfunc.glm.fit > > > ### ** Examples > > > > > > ### *