Description Usage Arguments Value See Also Examples
A random haplotype matrix is generated according to some given frequencies.
1 2 3 |
freq |
vector of probabilities which gives the allele frequencies
for one or both haplotypes; if not given, a half is
assumed and |
indiv |
number of individuals |
loci |
if not given, the number of loci equals the length of
|
freq2 |
optional. Frequencies for the second chromosome.
The vector |
file, file.type |
string. If given, a file is written that mimics
the |
debugging |
logical. Mainly for internal purposes.
If |
If missing(file)
an object of class genomicmatrix is returned,
else the file name with appended extension according to file.type
A haplotype file can be read in by genomicmatrix
.
as.matrix
transforms a genomicmatrix
to
a human readable matrix.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
as.matrix(rhaplo(seq(0, 1, len=10), indiv=5))
## note that the next examples write a file on the current directory
file <- "miraculix"
if (interactive() && !file.exists(paste0(file, ".bgl"))) {
f <- rhaplo(freq = c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6),
freq2 = c(0.6, 0.4, 0.5, 0.3, 0.0, 1.0),
indiv=5, file=file, file.type="beagle",
debugging = TRUE)
print(f)
print(as.genomicmatrix(f))
print(g <- genomicmatrix(f))
print(as.matrix(g))
stopifnot(all(as.matrix(g) == attr(f, "M")))
file.remove(f)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.