Title: | Simulate and Test Marker Dosage for Dominant Markers in Autopolyploids |
---|---|
Description: | Perform classic chi-squared tests and Ripol et al(1999) binomial confidence interval approach for autopolyploid dominant markers. Also, dominant markers may be generated for families of offspring where either one or both of the parents possess the marker. Missing values and misclassified markers may be generated at random. |
Authors: | Peter Baker [aut, cre] |
Maintainer: | Peter Baker <[email protected]> |
License: | GPL-3 |
Version: | 0.2-5 |
Built: | 2025-02-20 02:42:59 UTC |
Source: | https://github.com/petebaker/polysegratio |
These functions provide tools for computing expected segregation ratios (or more correctly segregation proportions) for dominant markers in regular autopolyploids and simulating such marker data as well as conducting standard Chi squared tests and Binomial confidance intervals for assigning marker dosage.
Package: | polySegratio |
Type: | Package |
Version: | 0.2-5 |
Date: | 2018-03-22 |
License: | GPL-3 |
Use expected.segRatio
to compute expected segregation
proportions for regular autopolyploids
Use segregationRatios
to compute segregation ratios for
a matrix of markers
Use test.segRatio
to assignmarker dosage via Chi squared
tests or Binomial CIs
Use sim.autoMarkers
and sim.autoCross
to
simulate marker data under various scenarios
Use addMisclass
and addMissing
make some
markers misclassified or missing at random
Peter Baker [email protected]
J B S Haldane (1930) Theoretical genetics of autopolyploids. Journal of genetics 22 359–372
Ripol, M I et al(1999) Statistical aspects of genetic mapping in autopolyploids. Gene 235 31–41
## expected segregation proportions heterogeneous parents expected.segRatio(4) expected.segRatio("Tetraploid") expected.segRatio("Octa") ## expected segregation proportions homogeneous parents expected.segRatio("Octa",type="heter") ## generate dominant markers for autotetraploids a1 <- sim.autoMarkers(4,c(0.8,0.2)) print(a1) plot(a1) ## generate crosses for different parental types p2 <- sim.autoCross(4, dose.proportion=list(p01=c(0.7,0.3), p10=c(0.7,0.3),p11=c(0.6,0.2,0.2))) print(p2) plot(p2) ## simulate and test some markers, printing out a summary table of ## no.s of correct marker dosages a <- sim.autoMarkers(ploidy = 8, c(0.7,0.2,0.09,0.01), type="hetero", n.markers=500,n.individuals=100) a <- addMissing(a, 0.07) # make seven percent missing at random at <- test.segRatio(a$seg.ratios, ploidy=8, type.parents="het", method="bin") print(addmargins(table(a$true.doses$dosage, at$dosage, exclude=NULL)))
## expected segregation proportions heterogeneous parents expected.segRatio(4) expected.segRatio("Tetraploid") expected.segRatio("Octa") ## expected segregation proportions homogeneous parents expected.segRatio("Octa",type="heter") ## generate dominant markers for autotetraploids a1 <- sim.autoMarkers(4,c(0.8,0.2)) print(a1) plot(a1) ## generate crosses for different parental types p2 <- sim.autoCross(4, dose.proportion=list(p01=c(0.7,0.3), p10=c(0.7,0.3),p11=c(0.6,0.2,0.2))) print(p2) plot(p2) ## simulate and test some markers, printing out a summary table of ## no.s of correct marker dosages a <- sim.autoMarkers(ploidy = 8, c(0.7,0.2,0.09,0.01), type="hetero", n.markers=500,n.individuals=100) a <- addMissing(a, 0.07) # make seven percent missing at random at <- test.segRatio(a$seg.ratios, ploidy=8, type.parents="het", method="bin") print(addmargins(table(a$true.doses$dosage, at$dosage, exclude=NULL)))
Marker data are misclassified at a specified rate for objects
of class simAutoMarkers
or simAutoCross
. The rate may be
specified either as a proportion of missing at random or a proportion
of columns and rows with specified proportions of missings.
addMisclass(x, misclass = 0, bands.missed=0, parents = FALSE, parent.cols = c(1, 2), seed)
addMisclass(x, misclass = 0, bands.missed=0, parents = FALSE, parent.cols = c(1, 2), seed)
x |
object of class |
misclass |
proportion misclassified specified as for na.proportion (Default: 0) |
bands.missed |
proportion of bands that are not scored when they are actually present. Note this is applied to correctly specified markers after markers are misclassified (Default: 0) |
parents |
if TRUE then misclassify parental alleles, otherwise misclassify offspring marker alleles |
parent.cols |
for object of simAutoClass the columns containg parental markers |
seed |
random number generator (RNG) state for random number which will be set at start to reproduce results |
returns object of class simAutoMarkers
or simAutoCross
,
or a matrix with
dominant markers scored as 0 or 1 with extra components
misclass.info |
list with components
|
Peter Baker [email protected]
addMissing
add missing markers at random,
sim.autoMarkers
simulate autopolyploid markers,
sim.autoCross
simulate autopolyploid markers for a cross
## simulate autopolyploid markers p1 <- sim.autoCross(4, dose.proportion=c(0.7,0.3), n.markers=20, n.indiv=10) p2 <- sim.autoCross(4, dose.proportion=list(p01=c(0.7,0.3),p10=c(0.7,0.3),p11=c( 0.6,0.2,0.2))) ## add misclassified for a whopping 20% of markers print(addMisclass(p1, 0.2, parents=TRUE), row=1:20) addMisclass(p2, 0.1)
## simulate autopolyploid markers p1 <- sim.autoCross(4, dose.proportion=c(0.7,0.3), n.markers=20, n.indiv=10) p2 <- sim.autoCross(4, dose.proportion=list(p01=c(0.7,0.3),p10=c(0.7,0.3),p11=c( 0.6,0.2,0.2))) ## add misclassified for a whopping 20% of markers print(addMisclass(p1, 0.2, parents=TRUE), row=1:20) addMisclass(p2, 0.1)
Adds missing data to objects of class simAutoMarkers
or
simAutoCross
as specified either as a proportion of missing at
random or a proportion of columns and rows with specified proportions
of missings.
addMissing(x, na.proportion = 0, parent.cols = c(1, 2), seed)
addMissing(x, na.proportion = 0, parent.cols = c(1, 2), seed)
x |
object of class |
na.proportion |
proportion missing at random or a list with two components indiv and marker each containing c(prop. markers missing, prop. missing) (Default: 0) |
parent.cols |
columns containing parental markers (etc) not
altered only used if object of class |
seed |
random number generator (RNG) state for random number which will be set at start to reproduce results |
Returns object of class simAutoMarkers
or simAutoCross
, or a
matrix
with dominant markers scored as 0 or 1 with extra
component na.proportion
which has the following elements
na.proportion |
proportion missing at random or a list with two components indiv and marker each containing c(prop. markers missing, prop. missing) |
time.generated |
time/date when data set generated + when missing added |
seed |
random number generator seed which could be used to reproduce results (I hope) |
call |
matches arguments when function called |
Peter Baker [email protected]
addMisclass
misclassifies markers at random,
sim.autoMarkers
simulate autopolyploid markers,
sim.autoCross
simulate autopolyploid markers for a cross
## simulate autopolyploid markers p1 <- sim.autoCross(4, dose.proportion=c(0.7,0.3), n.markers=20, n.indiv=10) p2 <- sim.autoCross(4, dose.proportion=list(p01=c(0.7,0.3),p10=c(0.7,0.3),p11=c( 0.6,0.2,0.2))) ## add missings addMissing(p2, 0.1)
## simulate autopolyploid markers p1 <- sim.autoCross(4, dose.proportion=c(0.7,0.3), n.markers=20, n.indiv=10) p2 <- sim.autoCross(4, dose.proportion=list(p01=c(0.7,0.3),p10=c(0.7,0.3),p11=c( 0.6,0.2,0.2))) ## add missings addMissing(p2, 0.1)
autoFill
is commonly used to generate labels from columns of a
spreadsheet when many cells are left blank in order to save a lot of
typing. For instance, c("a","","","b","") becomes
c("a","a","a","b","b")
autoFill(x, squash = FALSE)
autoFill(x, squash = FALSE)
x |
a vector of character strings |
squash |
If set to TRUE then leading and trailing spaces are removed which is useful if spaces are inadvertantly typed because these may be hard to track down. Default: FALSE |
x |
a vector of character strings with blank strings replaced by preceding non–blank strings |
While this function may be called directly, it is more often
called by makeLabel
Peter Baker [email protected]
makeLabel
uses autoFill
to create labels
from two columns of marker names
## description: fill out blanks of a vector with preceeding label label.1 <- c("a","","","b","") print(autoFill(label.1)) label.2 <- c("agc","","","","gct5","","ccc","","") print(autoFill(label.2))
## description: fill out blanks of a vector with preceeding label label.1 <- c("a","","","b","") print(autoFill(label.1)) label.2 <- c("agc","","","","gct5","","ccc","","") print(autoFill(label.2))
Given markers (or more correctly dominant 1,0) marker data and return list object of containing markers data split according to parental alleles, namely 1,0 for each parent and 1,1 for both parents
divide.autoMarkers(markers, description = paste("Markers split for", deparse(substitute(markers))), parent.cols = c(1, 2), extra.cols = NULL, cols.drop = c(parent.cols, extra.cols))
divide.autoMarkers(markers, description = paste("Markers split for", deparse(substitute(markers))), parent.cols = c(1, 2), extra.cols = NULL, cols.drop = c(parent.cols, extra.cols))
markers |
matrix of 1, 0, NA indicating marker alleles where rownames are markernames, column names are progeny names |
description |
text containing a description for printing |
parent.cols |
column(s) for parental markers (default: 1,2) |
extra.cols |
extra column(s) to be subsetted (default: NULL) |
cols.drop |
columns to be dropped from markers before splitting data which can be set to NULL if no columns are to be dropped (Default: c(parent.cols,extra.cols)) |
Returns S3 class divideAutoMarkers
containing
p10 , p01 , p11
|
lists for where the first, second components are heterozygous for parents 1, 2 and both resp. Each list contains
|
Peter Baker [email protected]
p2 <- sim.autoCross(4, dose.proportion=list(p01=c(0.7,0.3),p10=c(0.7,0.3), p11=c(0.6,0.2,0.2))) print(p2) ss <- divide.autoMarkers(p2$markers) print(ss)
p2 <- sim.autoCross(4, dose.proportion=list(p01=c(0.7,0.3),p10=c(0.7,0.3), p11=c(0.6,0.2,0.2))) print(p2) ss <- divide.autoMarkers(p2$markers) print(ss)
An S3 class which contains marker data and segregation proportions split into three groups corresponding to parents with ‘01’, ‘10’ and ‘11’ markers
p10 , p01 , p11
|
lists for where the first, second components are heterozygous for parents 1, 2 and both resp. Each list contains
|
Peter Baker [email protected]
p2 <- sim.autoCross(4, dose.proportion=list(p01=c(0.7,0.3),p10=c(0.7,0.3), p11=c(0.6,0.2,0.2))) print(p2) ss <- divide.autoMarkers(p2$markers) print(ss)
p2 <- sim.autoCross(4, dose.proportion=list(p01=c(0.7,0.3),p10=c(0.7,0.3), p11=c(0.6,0.2,0.2))) print(p2) ss <- divide.autoMarkers(p2$markers) print(ss)
Expected segregation proportions for various dosages of dominant markers for regular autopolyploids are calculated using the formula of Ripol et al (1999) based on Haldane (1930) for single dose and multiple dose parents cross nulliplex ("homozygous") and an unpublished formula where both parents possess at least single dose markers ("heterogeneous")
expected.segRatio(ploidy.level = stop("No ploidy level set"), type.parents = c("heterogeneous", "homozygous"))
expected.segRatio(ploidy.level = stop("No ploidy level set"), type.parents = c("heterogeneous", "homozygous"))
ploidy.level |
the number of homologous chromosomes, either as numeric or as a character string |
type.parents |
"heterogeneous" if parental markers are 0,1 or "homogeneous" if parental markers are both 1 |
ratio |
vector of proportions for each dosage |
ploidy.level |
numeric value of ploidy level 2,4,6,8, ... |
ploidy.name |
name of ploidy |
While results will be returned if the ploidy level is set as an odd number, the formula used are only for even numbers.
Peter Baker [email protected]
J B S Haldane (1930) Theoretical genetics of autopolyploids. Journal of genetics 22 359–372
Ripol, M I et al(1999) Statistical aspects of genetic mapping in autopolyploids. Gene 235 31–41
## heterogeneous parents expected.segRatio(2) expected.segRatio("Tetraploid") expected.segRatio("tEtR") expected.segRatio("octo") expected.segRatio("Octa") expected.segRatio(14) ## warning expected.segRatio(9) ## errors - not run ## expected.segRatio("abcd") ## expected.segRatio(-1) ## homogeneous parents expected.segRatio("Octa", type.parents="heter") expected.segRatio("Octa", type.parents="homo") expected.segRatio("tetra", type.parents="homo") expected.segRatio(6, type.parents="homo") expected.segRatio(9, type.parents="homo")
## heterogeneous parents expected.segRatio(2) expected.segRatio("Tetraploid") expected.segRatio("tEtR") expected.segRatio("octo") expected.segRatio("Octa") expected.segRatio(14) ## warning expected.segRatio(9) ## errors - not run ## expected.segRatio("abcd") ## expected.segRatio(-1) ## homogeneous parents expected.segRatio("Octa", type.parents="heter") expected.segRatio("Octa", type.parents="homo") expected.segRatio("tetra", type.parents="homo") expected.segRatio(6, type.parents="homo") expected.segRatio(9, type.parents="homo")
Primarily used to generate marker labels from two columns where the first column is a nucleotide sequence which is mainly blank in that it is the same as the previous one while the second column is increasing numbers (fragment size) for each nucleotide combination
makeLabel(x, columns = c(1, 2), squash = TRUE, sep = "")
makeLabel(x, columns = c(1, 2), squash = TRUE, sep = "")
x |
data frame of markers including labels |
columns |
the column numbers containing labels (default: c(1,2)) |
squash |
remove trailing/leading blanks in 1st column (default:TRUE) |
sep |
separator when combining two label columns (default: "") |
returns vector of marker names
Peter Baker [email protected]
autoFill
is used to replace blanks in first column
## imaginary data frame representing ceq marker names read in from ## spreadsheet x <- data.frame( col1 = c("agc","","","","gct5","","ccc","",""), col2 = c(1,3,4,5,1,2,2,4,6)) print(x) print(makeLabel(x)) print(cbind(x,lab=makeLabel(x, sep=".")))
## imaginary data frame representing ceq marker names read in from ## spreadsheet x <- data.frame( col1 = c("agc","","","","gct5","","ccc","",""), col2 = c(1,3,4,5,1,2,2,4,6)) print(x) print(makeLabel(x)) print(cbind(x,lab=makeLabel(x, sep=".")))
Plots an object of S3 class segRatio
## S3 method for class 'segRatio' plot(x, main = deparse(substitute(x)), xlab="", xlab.segRatio = "Segregation ratio", xlab.nobs = "Number of dominant markers", xlab.miss = "Number of missing markers per individual", NCLASS = 100, type = c("seg.ratio", "all","no","missing"), ...) ## S3 method for class 'simAutoMarkers' plot(x, main = deparse(substitute(x)), xlab = "Segregation ratio",...) ## S3 method for class 'simAutoCross' plot(x, main = deparse(substitute(x)), xlab = "Segregation ratio", ...)
## S3 method for class 'segRatio' plot(x, main = deparse(substitute(x)), xlab="", xlab.segRatio = "Segregation ratio", xlab.nobs = "Number of dominant markers", xlab.miss = "Number of missing markers per individual", NCLASS = 100, type = c("seg.ratio", "all","no","missing"), ...) ## S3 method for class 'simAutoMarkers' plot(x, main = deparse(substitute(x)), xlab = "Segregation ratio",...) ## S3 method for class 'simAutoCross' plot(x, main = deparse(substitute(x)), xlab = "Segregation ratio", ...)
x |
An object of class |
xlab |
label for x axis: not usually set |
main |
Title for plot |
xlab.segRatio |
x–axis label when plotting segregation proportions |
xlab.nobs |
x axis label when plotting no. of 1's |
xlab.miss |
x axis label when plotting number of missing individuals per marker |
NCLASS |
number of classes for histograms (Default: 100) |
type |
type of plot may be set to
|
... |
other parameters passed to plot function |
By default the histograms are produced of the segregation proportions. Other histograms that may be produced are numbers of observed dominant markers (recorded as a 1) and the number of individuals missing a particular marker.
Used for its side-effects
Peter Baker [email protected]
segRatio
, segregationRatios
,
sim.autoMarkers
, sim.autoCross
## generate some autooctoploid data a <- sim.autoMarkers(8,c(0.7,0.2,0.09,0.01)) ## print markers and plot segratios print(a) plot(a$seg.ratios) # plot the segregation ratios directly plot(a) # plot the simAutoMarkers object ## add some missing values and plot all histograms plot(addMissing(a,0.2)$seg.ratios, type="all")
## generate some autooctoploid data a <- sim.autoMarkers(8,c(0.7,0.2,0.09,0.01)) ## print markers and plot segratios print(a) plot(a$seg.ratios) # plot the segregation ratios directly plot(a) # plot the simAutoMarkers object ## add some missing values and plot all histograms plot(addMissing(a,0.2)$seg.ratios, type="all")
Prints an object of S3 class segRatio
## S3 method for class 'segRatio' print(x, digits=3, ..., index = c(1:min(10,length(x$r))) )
## S3 method for class 'segRatio' print(x, digits=3, ..., index = c(1:min(10,length(x$r))) )
x |
object of class |
digits |
minimal number of |
index |
which rows of the marker matrix and segregation proportions to print. (Default: c(1:10)) |
... |
extra parameters passed on to |
None.
Objects of class segRatio
may be produced from
a matrix
of markers by
employing the function segregationRatios
Peter Baker [email protected]
segRatio
, segregationRatios
,
print
,print.default
## generate autopolyploid markers a1 <- sim.autoMarkers(4,c(0.8,0.2),n.markers=20,n.individuals=10) print(class(a1$seg.ratios)) print(a1$seg.ratios)
## generate autopolyploid markers a1 <- sim.autoMarkers(4,c(0.8,0.2),n.markers=20,n.individuals=10) print(class(a1$seg.ratios)) print(a1$seg.ratios)
Prints an object of S3 class simAutoMarkers
## S3 method for class 'simAutoMarkers' print(x, ..., row.index = c(1:min(10, nrow(x$markers))), col.index = c(1:min(10, ncol(x$markers))) ) ## S3 method for class 'simAutoCross' print(x, ..., row.index = c(1:min(10, nrow(x$markers))), col.index = c(1:min(10, ncol(x$markers)))) ## S3 method for class 'divideAutoMarkers' print(x, ..., row.index = c(1:10), col.index = c(1:10), tabulate.extras = FALSE )
## S3 method for class 'simAutoMarkers' print(x, ..., row.index = c(1:min(10, nrow(x$markers))), col.index = c(1:min(10, ncol(x$markers))) ) ## S3 method for class 'simAutoCross' print(x, ..., row.index = c(1:min(10, nrow(x$markers))), col.index = c(1:min(10, ncol(x$markers)))) ## S3 method for class 'divideAutoMarkers' print(x, ..., row.index = c(1:10), col.index = c(1:10), tabulate.extras = FALSE )
x |
object of class |
row.index |
which rows to print (Default: first 10) |
col.index |
which columns to print (Default: first 10) |
tabulate.extras |
If TRUE then cross–tabulate any axtra columns (Default: FALSE) |
... |
extra options for printing |
None.
Objects of class simAutoMarkers
may be produced from
by employing the function sim.autoMarkers
and the same
for sim.autoCross
and divide.autoMarkers
Peter Baker [email protected]
segRatio
, segregationRatios
,
sim.autoCross
, sim.autoMarkers
,
divide.autoMarkers
, print
## generate data sets a1 <- sim.autoMarkers(4,c(0.8,0.2)) a2 <- sim.autoMarkers(8,c(0.7,0.2,0.09,0.01),type="homo",n.markers=20,n.individuals=10) print(a1) print(a2) ## datasets from crosses p1 <- sim.autoCross(4, dose.proportion=c(0.7,0.3), n.markers=20, n.indiv=10) print(p1) p2 <- sim.autoCross(4, dose.proportion=list(p01=c(0.7,0.3),p10=c(0.7,0.3),p11=c(0.6,0.2,0.2))) print(p2) ## divide up data from crosses ss <- divide.autoMarkers(p2$markers) print(ss)
## generate data sets a1 <- sim.autoMarkers(4,c(0.8,0.2)) a2 <- sim.autoMarkers(8,c(0.7,0.2,0.09,0.01),type="homo",n.markers=20,n.individuals=10) print(a1) print(a2) ## datasets from crosses p1 <- sim.autoCross(4, dose.proportion=c(0.7,0.3), n.markers=20, n.indiv=10) print(p1) p2 <- sim.autoCross(4, dose.proportion=list(p01=c(0.7,0.3),p10=c(0.7,0.3),p11=c(0.6,0.2,0.2))) print(p2) ## divide up data from crosses ss <- divide.autoMarkers(p2$markers) print(ss)
Prints an object of S3 class testSegRatio
## S3 method for class 'testSegRatio' print(x, ..., last = 10)
## S3 method for class 'testSegRatio' print(x, ..., last = 10)
x |
object of class |
last |
prints from 1 to |
... |
extra printing options |
None
Peter Baker [email protected]
segRatio
, segregationRatios
,
test.segRatio
## simulated data a <- sim.autoMarkers(ploidy = 8, c(0.7,0.2,0.09,0.01)) ac <- test.segRatio(a$seg.ratios, ploidy=8, method="chi.squared") print(ac)
## simulated data a <- sim.autoMarkers(ploidy = 8, c(0.7,0.2,0.09,0.01)) ac <- test.segRatio(a$seg.ratios, ploidy=8, method="chi.squared") print(ac)
An S3 class which contains the segregation ratios for dominant markers and other information such as the number of dominant markers per individual
r |
no. of 1's for each individual |
n |
total no. of markers present for each individual |
seg.ratio |
segregation proportion for each individual |
n.individuals |
total number of individuals |
Peter Baker [email protected]
segregationRatios
: computing segregation
ratios, testSegRatio
: chi squared and
tests and Binomial
confidence intervals for assigning marker dosage,
expected.segRatio
: compute expected segregation
proportions for various dosages
for dominant markers in regular autopolyploids
Computes segregation ratios for a matrix of markers where the rows are markers and the columns are individuals and the markers are recorded as 0's and 1's
segregationRatios(x, drop.cols = NULL)
segregationRatios(x, drop.cols = NULL)
x |
|
drop.cols |
|
Returns an object of class segRatio
containing
r |
no. of 1's for each individual |
n |
total no. of markers present for each individual |
seg.ratio |
segregation proportion for each individual |
n.individuals |
total number of individuals |
Peter Baker [email protected]
testSegRatio
: chi squared and
tests and Binomial
confidence intervals for assigning marker dosage,
expected.segRatio
: compute expected segregation
proportions for various dosages
for dominant markers in regular autopolyploids
## simulate small autotetraplid data set a1 <- sim.autoMarkers(4,c(0.8,0.2),n.markers=20,n.individuals=10) print(a1) print(segregationRatios(a1$markers))
## simulate small autotetraplid data set a1 <- sim.autoMarkers(4,c(0.8,0.2),n.markers=20,n.individuals=10) print(a1) print(segregationRatios(a1$markers))
Simulates dominant markers from an autopolyploid cross given the ploidy
level and/or expected segregation ratios and the proportions in each
dosage marker class. This is a wrapper to sim.autoMarkers
to
generate markers for ‘10’, ‘01’ and ‘11’ parents
sim.autoCross(ploidy.level, prop.par.type = structure(c(0.4, 0.4, 0.2), names = c("p10", "p01", "p11")), n.markers = 500, n.individuals = 200, dose.proportion, true.seg.ratios, no.dosage.classes, marker.names = paste("M", 1:n.markers, sep = "."), individual.names = paste("X", 1:n.individuals, sep = "."), parent.names = c("P.1", "P.2"), seed)
sim.autoCross(ploidy.level, prop.par.type = structure(c(0.4, 0.4, 0.2), names = c("p10", "p01", "p11")), n.markers = 500, n.individuals = 200, dose.proportion, true.seg.ratios, no.dosage.classes, marker.names = paste("M", 1:n.markers, sep = "."), individual.names = paste("X", 1:n.individuals, sep = "."), parent.names = c("P.1", "P.2"), seed)
ploidy.level |
the number of homologous chromosomes, either as numeric (single value) or as a character string containing type tetraploid, hexaploid, octoploid, ... |
prop.par.type |
the proportion of markers generated from each parental type '10', '01' and '11'. Note that the exact number will be randomly generated from the multinomial distribution (Default: c(0.4,0.4,0.2)) |
n.markers |
number of markers (Default: 500) |
n.individuals |
number of individuals in the cross (Default: 200) |
dose.proportion |
the proportion of markers to be simulated in each dosage class. Note that the exact number will be randomly generated from the multinomial distribution NB: If a vector is supplied the dose.proportion is same for each parental type otherwise as list with components ‘p01’, ‘p10’ and ‘p11’ |
true.seg.ratios |
numeric vector containing segregation proportion to be supplied if you wish to overide automatic calculations using ploidy.level |
no.dosage.classes |
numeric vector containing the number of dosage classes |
marker.names |
labels for markers (Default: M.1 ... M.n.markers) |
individual.names |
labels for offspring (Default: ... X.j ... ) |
parent.names |
numeric vector of length 2 containing columns of marker matrix containing parental markers (Default: first 2 columns) |
seed |
integer used to set seed for random number generator (RNG) which (if set) may be used to reproduce results |
Returns an object of class simAutoCross
containing
markers |
matrix of 0,1 dominant markers with individuals as cols and rows as markers |
true.dosage |
true doses for each marker |
name.true.dose |
names of true doses for each marker |
p10 |
object of class |
p01 |
object of class |
p11 |
object of class |
ploidy.level |
the number of homologous chromosomes as numeric (single value) |
prop.par.type |
proportion of markers for each parental type ‘p01’, ‘p10’ and ‘p11’ |
n.markers |
number of markers (Default: 500) |
n.individuals |
number of individuals in the cross (Default: 200) |
dose.proportion |
proportion in each dose – if numeric vector is the same for ‘p01’, ‘p10’ and ‘p11’ else a list with components ‘p01’, ‘p10’ and ‘p11’ |
no.dosage.classes |
number in each dosage class |
no.parType |
number in each parental type |
time.generated |
time/date when data set generated |
seed |
seed for random number generator seed which could be used to reproduce results (I hope) |
call |
matches arguments when function called |
All parameters except the proportions of marker dosage types can be left at the default. If only one value is set, then individual list components will be assumed to be equal. The marker matrix is prepended with parental marker alleles. An alternative is to simply create each group using sim.automarkers and cbind them.
Peter Baker [email protected]
simAutoCross
,simAutoMarkers
,
sim.autoMarkers
p1 <- sim.autoCross(4, dose.proportion=c(0.7,0.3), n.markers=20, n.indiv=10) print(p1) p2 <- sim.autoCross(4, dose.proportion=list(p01=c(0.7,0.3),p10=c(0.7,0.3),p11=c(0.6,0.2,0.2))) print(p2)
p1 <- sim.autoCross(4, dose.proportion=c(0.7,0.3), n.markers=20, n.indiv=10) print(p1) p2 <- sim.autoCross(4, dose.proportion=list(p01=c(0.7,0.3),p10=c(0.7,0.3),p11=c(0.6,0.2,0.2))) print(p2)
Dominant markers are simulated from an autopolyploid cross given the ploidy level, expected segregation ratios and the proportions in each dosage marker class. This may be chosen from tetraploid to heccaidecaploid and the segregation ratios may be specified explicitly or generated automatically.
sim.autoMarkers(ploidy.level, dose.proportion, n.markers = 500, n.individuals = 200, seg.ratios, no.dosage.classes, type.parents = c("heterogeneous", "homozygous"), marker.names = paste("M", 1:n.markers, sep = "."), individual.names = paste("X", 1:n.individuals, sep = "."), overdispersion=FALSE, shape1=50, seed)
sim.autoMarkers(ploidy.level, dose.proportion, n.markers = 500, n.individuals = 200, seg.ratios, no.dosage.classes, type.parents = c("heterogeneous", "homozygous"), marker.names = paste("M", 1:n.markers, sep = "."), individual.names = paste("X", 1:n.individuals, sep = "."), overdispersion=FALSE, shape1=50, seed)
ploidy.level |
the number of homologous chromosomes, either as numeric (single value) or as a character string containing type tetraploid, hexaploid, octoploid, ... |
dose.proportion |
the proportion of markers to be simulated in each dosage class. Note that the exact number will be randomly generated from the multinomial distribution |
n.markers |
number of markers (Default: 500) |
n.individuals |
number of individuals in the cross (Default: 200) |
seg.ratios |
numeric vector containing segregation proportion to be supplied if you wish to override automatic calculations using ploidy.level |
no.dosage.classes |
only generate markers for the first
|
type.parents |
heterogeneous for (1,0) or (0,1) homozygous for (1,1) (default: heterogeneous) |
marker.names |
labels for markers (Default: M.1 ... M.n.markers) |
individual.names |
labels for offspring (Default: ... X.j ... ) |
overdispersion |
logical indicating overdispersion (Default: FALSE) |
shape1 |
shape1 parameter(s) for the beta distribution used to generate the Binomial probability p, either of length 1 or no.dosage.classes. Default: 50 which implies very little overdispersion. NB: 'shape2' is calculated from shape 1 and expected segregation ratios |
seed |
integer used to set seed for random number generator (RNG) which (if set) may be used to reproduce results |
Returns an object of class simAutoMarkers
containing
markers |
matrix of 0,1 dominant markers with individuals as cols and rows as markers |
E.segRatio |
expected segregation proportions, list with components
|
type.parents |
heterogeneous for (1,0) or (0,1) homozygous for (1,1) |
dose.proportion |
proportions of markers set for each dosage class |
n.markers |
number of markers (Default: 500) |
n.individuals |
number of individuals in the cross (Default: 200) |
true.doses |
list containing
|
seg.ratios |
object of class segRatio containing segregation ratios |
time.generated |
time/date when data set generated |
seed |
seed for random number generator seed which could be used to reproduce results (I hope) |
overdispersion |
either a list with components 'overdispersion': logical for whether overdispersion is set or not and if TRUE then two extra components 'shape1' and 'shape2' contain parameters for the beta distribution employed to generate Binomial probabilities |
call |
matches arguments when function called |
For use in simulation studies, other parameters such as the true dosage of each marker are also returned. Also, if extra binomial variation or overdispersion is requested then a beta-binomial distribution is employed to simulate marker data.Note that as the 'shape1' parameter becomes larger, the resulting marker data are less overdispersed.
Peter Baker [email protected]
simAutoMarkers
,
print.simAutoMarkers
,
plot.simAutoMarkers
,
segRatio
## generate autopolyploid markers a1 <- sim.autoMarkers(4,c(0.8,0.2),n.markers=20,n.individuals=10) print(a1) a2 <- sim.autoMarkers(8,c(0.7,0.2,0.09,0.01),type.parents="homo",n.markers=20,n.individuals=10) print(a2)
## generate autopolyploid markers a1 <- sim.autoMarkers(4,c(0.8,0.2),n.markers=20,n.individuals=10) print(a1) a2 <- sim.autoMarkers(8,c(0.7,0.2,0.09,0.01),type.parents="homo",n.markers=20,n.individuals=10) print(a2)
An S3 class which contains simulated dominant marker data for autopolyploids and other data of interest such as segregation proportions as well as parameters set for the generating given parents with ‘01’, ‘10’ and ‘11’ markers
markers |
matrix of 0,1 dominant markers with individuals as cols and rows as markers |
true.dosage |
true doses for each marker |
name.true.dose |
names of true doses for each marker |
p10 |
object of class |
p01 |
object of class |
p11 |
object of class |
ploidy.level |
the number of homologous chromosomes as numeric (single value) |
prop.par.type |
proportion of markers for each parental type ‘p01’, ‘p10’ and ‘p11’ |
n.markers |
number of markers (Default: 500) |
n.individuals |
number of individuals in the cross (Default: 200) |
dose.proportion |
proportion in each dose – if numeric vector is the same for ‘p01’, ‘p10’ and ‘p11’ else a list with components sQuotep01, ‘p10’ and ‘p11’ |
no.dosage.classes |
number in each dosage class |
no.parType |
number in each parental type |
time.generated |
time/date when data set generated |
seed |
seed for random number generator seed which could be used to reproduce results (I hope) |
call |
matches arguments when function called |
Peter Baker [email protected]
sim.autoCross
,simAutoMarkers
,
sim.autoMarkers
An S3 class which contains the simulated dominant marker data for autopolyploids and other data of interest such as segregation proportions as well as parameters set for the generating
markers |
matrix of 0,1 dominant markers with individuals as cols and rows as markers |
E.segRatio |
expected segregation porportions, list with components
|
ploidy.level |
the number of homologous chromosomes, either as numeric (single value) or as a character string containing type tetraploid, hexaploid, octoploid, ... |
n.markers |
number of markers (Default: 500) |
n.individuals |
number of individuals in the cross (Default: 200) |
dose.proportion |
the proportion of markers to be simulated in each dosage class. Note that the exact number will be randomly generated from the multinomial distribution |
true.doses |
list containing
|
seg.ratios |
segregation proportions as class
|
time.generated |
date and time data set generated |
call |
function call used to generate data set |
Peter Baker [email protected]
expected.segRatio
,
segRatio
,
print.simAutoMarkers
,
plot.simAutoMarkers
Perform chi–squared tests or binomial CIs to obtain expected marker dosage in autopolyploids
test.segRatio(seg.ratio, ploidy.level = 4, type.parents = c("heterogeneous", "homozygous"), method = c("chi.squared", "binomial"), alpha = 0.05, expected.ratio)
test.segRatio(seg.ratio, ploidy.level = 4, type.parents = c("heterogeneous", "homozygous"), method = c("chi.squared", "binomial"), alpha = 0.05, expected.ratio)
seg.ratio |
object of class |
ploidy.level |
the number of homologous chromosomes, either as numeric or as a character string |
type.parents |
"heterogeneous" if parental markers are 0,1 or "homozygous" if parental markers are both 1 |
method |
specify which method ‘chi.squared’ or ‘binomial’ |
alpha |
significance level for tests/CIs |
expected.ratio |
vector of expected segregation proportions
Default: determined by using function |
Returns object of class testSegRatio
with components
probability |
matrix of probabilities under the test for each dosage where columns are doses and rows are markers |
dosage |
vector of allocated dosages where allocation unique
otherwise |
allocated |
matrix of 0's and 1's where 1 indicates dosage allocation where columns are doses and rows are markers |
alpha |
alpha level for significance test or CI construction |
expected.ratios |
expected segregation ratios under null hypotheses |
call |
call to test.segRatio |
Peter Baker [email protected]
K Mather(1951) The measurement of linkage in heredity. Methuen London
Ripol, M I et al(1999) Statistical aspects of genetic mapping in autopolyploids. Gene 235 31–41
segregationRatios
for computing segregation
ratios and segRatio
, expected.segRatio
## simulated data a <- sim.autoMarkers(ploidy = 8, c(0.7,0.2,0.09,0.01)) print(a) ## summarise chi-squared test vs true ac <- test.segRatio(a$seg.ratios, ploidy=8, method="chi.squared") print(addmargins(table(a$true.doses$dosage, ac$dosage, exclude=NULL))) ## summarise binomial CI vs true ab <- test.segRatio(a$seg.ratios, ploidy=8, method="bin") print(addmargins(table(a$true.doses$dosage, ab$dosage, exclude=NULL)))
## simulated data a <- sim.autoMarkers(ploidy = 8, c(0.7,0.2,0.09,0.01)) print(a) ## summarise chi-squared test vs true ac <- test.segRatio(a$seg.ratios, ploidy=8, method="chi.squared") print(addmargins(table(a$true.doses$dosage, ac$dosage, exclude=NULL))) ## summarise binomial CI vs true ab <- test.segRatio(a$seg.ratios, ploidy=8, method="bin") print(addmargins(table(a$true.doses$dosage, ab$dosage, exclude=NULL)))
An S3 class which contains results of classic tests for assessing marker dosage in autopolyploids using chi-squared tests or binomial confidence intervals
Returns object of class testSegRatio
with components
probability |
matrix of probabilities under the test for each dosage where columns are doses and rows are markers |
dosage |
vector of allocated dosages where allocation unique
otherwise |
allocated |
matrix of 0's and 1's where 1 indicates dosage allocation where columns are doses and rows are markers |
alpha |
alpha level for significance test or CI construction |
expected.ratios |
expected segregation ratios under null hypotheses |
call |
call to test.segRatio |
Peter Baker [email protected]
K Mather(1951) The measurement of linkage in heredity. Methuen London
Ripol, M I et al(1999) Statistical aspects of genetic mapping in autopolyploids. Gene 235 31–41
segRatio
, expected.segRatio
,
test.segRatio