cross
. The comma-delimited format
(csv
) is recommended. All formats require chromosome
assignments for the genetic markers, and assume that markers are in
their correct order.read.cross(format=c("csv", "csvr", "csvs", "csvsr", "mm", "qtx",
"qtlcart", "gary", "karl", "mapqtl", "tidy"),
dir="", file, genfile, mapfile, phefile, chridfile,
mnamesfile, pnamesfile, na.strings=c("-","NA"),
genotypes=c("A","H","B","D","C"), alleles=c("A","B"),
estimate.map=TRUE, convertXdata=TRUE, error.prob=0.0001,
map.function=c("haldane", "kosambi", "c-f", "morgan"),
BC.gen=0, F.gen=0, crosstype, ...)
"/"
) or double backslashes
("\\"
) to specify directory trees.csv
, csvr
and mm
.csvs
,
csvsr
, karl
, gary
and mapqtl
only).csv
formats).csvs
,
csvsr
, karl
, gary
and mapqtl
only).gary
format only).gary
format only).gary
format
only).csv
and gary
formats only). For the
csv
formats, these are interpreted globally
for the entire
file, so missing value codes in phenocsv
formats only). Generally this is a vector of
length 5, with the elements corresponding to AA, AB, BB, not BB
(i.e., AA or AB), and not AA (i.e., AB or BB). Noteqtlcart
, mapqtl
,
and karl
: if TRUE and marker positions are not included in
the input files, the genetic map is estimated using the function
est.m
sex
and
pgm
in the phenotype data if they available or by inference
if they are not. If FALSE, the X chromsome data is read"bcsft"
."bcsft"
.read.table
in the case of
csv
and csvr
formats. In particular, one may use the
argument
sep
to spcross
, which is a list with two components:names(geno)
contains the names of the
chromsomes. Each chromosome is itself a list, and is given class
A
or X
according to whether it is autosomal
or the X chromosome. There are two components for each chromosome: data
, a matrix
whose rows are individuals and whose columns are markers, and
map
, either a vector of marker positions (in cM) or a matrix
of dim (2 x n.mar
) where the rows correspond to marker
positions in female and male genetic distance, respectively.
The genotype data gets converted into numeric codes, as follows.
The genotype data for a backcross is coded as NA = missing, 1 = AA, 2 = AB.
For an F2 intercross, the coding is NA = missing, 1 = AA, 2 = AB, 3 = BB, 4 = not BB (i.e. AA or AB; D in Mapmaker/qtl), 5 = not AA (i.e. AB or BB; C in Mapmaker/qtl).
For a 4-way cross, the mother and father are assumed to have genotypes AB and CD, respectively. The genotype data for the progeny is assumed to be phase-known, with the following coding scheme: NA = missing, 1 = AC, 2 = BC, 3 = AD, 4 = BD, 5 = A = AC or AD, 6 = B = BC or BD, 7 = C = AC or BC, 8 = D = AD or BD, 9 = AC or BD, 10 = AD or BC, 11 = not AC, 12 = not BC, 13 = not AD, 14 = not BD.
n.ind x n.phe
) containing the
phenotypes. If a phenotype with the name id
or ID
is
included, these identifiers will be used in top.errorlod
,
plotErrorlod
, and plotGeno
as
identifiers for the individual.subset.cross
, to
assist in pulling out portions of the data. The X chromosome should be given chromosome identifier X
or
x
. If it is labeled by a number or by Xchr
, it will be
interpreted as an autosome.
The phenotype data should contain a column named "sex"
which
indicates the sex of each individual, either coded as 0
=female and
1
=male, or as a factor with levels female
/male
or
f
/m
. Case will be
ignored both in the name and in the factor levels. If no such
phenotype column is included, it will be assumed that all individuals
are of the same sex.
In the case of an intercross, the phenotype data may also contain a
column named "pgm"
(for "paternal grandmother") indicating the
direction of the cross. It should be coded as 0/1 with 0 indicating
the cross (AxB)x(AxB) or (BxA)x(AxB) and 1 indicating the cross
(AxB)x(BxA) or (BxA)x(BxA). If no such phenotype column is included,
it will be assumed that all individuals come from the same direction
of cross.
The internal storage of X chromosome data is quite different from that
of autosomal data. Males are coded 1=AA and 2=BB; females with pgm==0
are coded 1=AA and 2=AB; and females with pgm==1 are coded 1=BB and
2=AB. If the argument convertXdata
is TRUE, conversion to this
format is made automatically; if FALSE, no conversion is done,
summary.cross
will likely return a warning, and
most analyses will not work properly.
Use of convertXdata=FALSE
(in which case the X chromosome
genotypes will not be converted to our internal standard) can be
useful for diagnosing problems in the data, but will require some
serious mucking about in the internal data structure.
sep
, which will be passed
to the function read.table
). For example, in
Europe, it is common to use a comma in place of the decimal point in
numbers and so a semi-colon in place of a comma as the field
separator; such data may be read by using sep=";"
and
dec=","
.The first line should contain the phenotype names followed by the marker names. At least one phenotype must be included; for example, include a numerical index for each individual.
The second line should contain blanks in the phenotype columns,
followed by chromosome identifiers for each marker in all other
columns. If a chromosome has the identifier X
or x
, it
is assumed to be the X chromosome; otherwise, it is assumed to be an
autosome.
An optional third line should contain blanks in the phenotype columns, followed by marker positions, in cM.
Marker order is taken from the cM positions, if provided; otherwise, it is taken from the column order.
Subsequent lines should give the data, with one line for each individual, and with phenotypes followed by genotypes. If possible, phenotypes are made numeric; otherwise they are converted to factors.
The genotype codes must be the same across all markers. For example, you can't have one marker coded AA/AB/BB and another coded A/H/B. This includes genotypes for the X chromosome, for which hemizygous individuals should be coded as if they were homoyzogous.
The cross is determined to be a backcross if only the first two elements
of the genotypes
string are found; otherwise, it is assumed to
be an intercross.
csv
format, but rotated (or really
transposed), so that rows are columns and columns are rows.csv
format, but with separate files for the
genotype and phenotype data. The first column in the genotype data must specify individuals'
identifiers, and there must be a column in the phenotype data with
precisely the same information (and with the same name). These IDs
will be included in the data as a phenotype. If the name id
or
ID
is used, these identifiers will be used in
top.errorlod
, plotErrorlod
, and
plotGeno
as identifiers for the individual.
The first row in each file contains the column names. For the
phenotype file, these are the names of the phenotypes. For the
genotype file, the first cell will be the name of the identifier
column (id
or ID
) and the subsequent fields will be the
marker names.
In the genotype data file, the second row gives the chromosome IDs. The cell in the second row, first column, must be blank. A third row giving cM positions of markers may be included, in which case the cell in the third row, first column, must be blank.
There need be no blank rows in the phenotype data file.
csvs
format, but with each file rotated
(or really transposed), so that rows are columns and columns are rows.csv
), rotated
comma-delimited (csvr
), comma-delimited with separate files for
genotype and phenotype data (csvs
), rotated comma-delimited
with separate files for genotype and phenotype data (csvsr
),
Mapmaker (mm
), Map Manager QTX (qtx
), Gary Churchill's
format (gary
), Karl Broman's format (karl
) and
MapQTL/JoinMap (mapqtl
). The required files and their
specification for each format appears below. The comma-delimited
formats are recommended. Note that most of these formats work only
for backcross and intercross data. The sampledata
directory in the package distribution contains
sample data files in multiple formats. Also see
The ...
argument enables additional arguments to be passed to
the function read.table
in the case of csv
and csvr
formats. In particular, one may use the argument
sep
to specify the field separator (the default is a comma),
dec
to specify the character used for the decimal point (the
default is a period), and comment.char
to specify a character
to indicate comment lines.