Description Usage Arguments Details Value Author(s) See Also Examples
Carries out the data restructuring performed by gls.batch()
. Useful if calling fgls()
directly.
Several arguments to gls.batch.get()
are accepted only for the sake of parallelism with gls.batch()
, and are ignored: covmtxfile.in, theta, outfile, col.names, return.value, covmtxfile.out, and covmtxparams.out.
1 2 3 4 5 6 7 8 9 | gls.batch.get(phenfile,genfile,pedifile,covmtxfile.in=NULL,theta=NULL,
snp.names=NULL,input.mode=c(1,2,3),pediheader=FALSE,
pedicolname=c("FAMID","ID","PID","MID","SEX"),
sep.phe=" ",sep.gen=" ",sep.ped=" ",
phen,covars=NULL,med=c("UN","VC"),
outfile,col.names=TRUE,return.value=FALSE,
covmtxfile.out=NULL,
covmtxparams.out=NULL,
sizeLab=NULL,Mz=NULL,Bo=NULL,Ad=NULL,Mix=NULL,indobs=NULL)
|
phenfile |
This can be either (1) a character string specifying a phenotype file on disk which includes the phenotypes and other covariates, or (2) a data frame object containing the same data. In either case, the data must be appropriately structured. See below under "Details." |
genfile |
This can be Note that genotype scores need not be integers; they can also be numeric. So, |
pedifile |
This can be either (1) a character string specifying the pedigree file corresponding to genfile, to be read from disk, or (2) a data frame object containing this pedigree information. At minimum, pedifile must have a column of subject IDs, named The pedigree file or data frame can also include other columns of pedigree information, like father's ID, mother's ID, etc. Argument pediheader (see below) is an indicator of whether the pedigree file on disk has a header or not, with default as |
covmtxfile.in |
Accepted but not used. |
theta |
Accepted but not used. |
snp.names |
An optional character vector with length equal to the number of markers in genfile, providing names for those markers. Defaults to |
input.mode |
Either 1 (default), 2, or 3, which tells |
pediheader |
A logical indicator specifying whether the pedigree file to be read from disk has a header row, to ensure it is read in correctly. Even if |
pedicolname |
A vector of character strings giving the column names that |
sep.phe |
Separator character of the phenotype file to be read from disk. Defaults to a single space. |
sep.gen |
Separator character of the genotype file to be read from disk. Defaults to a single space. |
sep.ped |
Separator character of the pedigree file. Defaults to a single space. |
phen |
A character string specifying the phenotype (column name) in the phenotype file to be analyzed. |
covars |
A character string or character vector that holds the (column) names of the covariates, in the phenotype file, to be used in the regression model. Defaults to |
med |
A character string, either |
outfile |
Accepted but not used. |
col.names |
Accepted but not used. |
return.value |
Accepted but not used. |
covmtxfile.out |
Accepted but not used. |
covmtxparams.out |
Accepted but not used. |
sizeLab |
This is an optional argument, and may be eliminated in future versions of this package. Defaults to |
Mz, Bo, Ad, Mix |
These are optional logical indicators that specify whether families containing MZ twins (MZ; family-type 1), DZ twins or full siblings (Bo; family-types 2 and 4), two adoptees (Ad; family-type 3), or 1 biological offspring and 1 adoptee (Mix; family-type 5) are present in the data. The values of each are checked against the actual family types present, after loading and merging the data and trimming out incomplete cases, and a warning is generated for each mismatch. If any of these four arguments is |
indobs |
An optional logical indicator of whether there are "independent observations" who do not fit into a four-person nuclear family present in the data. After loading and merging the data and trimming out incomplete cases, the value of indobs is checked against whether such individuals are actually present, and a warning is generated in case of a mismatch. If |
Though originally used for debugging purposes, gls.batch.get()
was included because it facilitates directly invoking fgls()
when the need arises. This function first reads in the files and merges the files into a data frame with columns of family-structure information, phenotype, covariates, and genotypes. It then creates a tlist vector and a sizelist vector, which comprise the family labels and family sizes in the data.
It returns a list containing the merged data frame, and the tlist and sizelist vectors.
At the bare minimum, the phenotype file must contain columns named "ID"
, "FAMID"
, and whatever character string is supplied to phen. These columns respectively contain individual IDs, family IDs, and phenotype scores; individual IDs must be unique.
At the bare minimum, the pedigree file need only contain a column consisting of unique individual IDs, corresponding to the label "ID"
in pedicolname. The number of participants in the pedigree file must equal the number of participants in the genotype file, with participants ordered the same way in both files. However, the default value for argument pedicolname (see above) assumes five columns, in the familiar "pedigree table" format.
The phenotype file or pedigree file may also contain the two key family-structure variables, "FTYPE"
(family-type) and "INDIV"
(individual code). If both contain these variables, then by default, they are read from the phenotype file (but see argument input.mode above). There are six recognized family types, which are distinguished primarily by how the offspring in the family are related to one another:
FTYPE=1
, containing MZ twins;
FTYPE=2
, containing DZ twins;
FTYPE=3
, containing adoptees;
FTYPE=4
, containing non-twin full siblings;
FTYPE=5
, "mixed" families containing one biological offspring and one adoptee;
FTYPE=6
, containing "independent observations" who do not fit into a four-person nuclear family.
It is assumed that all offspring except adoptees are biological children of the parents in the family. The four individual codes are:
INDIV=1
is for "Offspring #1;"
INDIV=2
is for "Offspring #2;"
INDIV=3
is for mothers;
INDIV=4
is for fathers.
The distinction between "Offspring #1" and "#2" is mostly arbitrary, except that in "mixed" families(FTYPE=5
), the biological offspring MUST have INDIV=1
, and the adopted offspring, INDIV=2
. If the phenotype file contains variables "FTYPE"
and "INDIV"
, it should be ordered by family ID ("FAMID"
), and by individual code "INDIV"
within family ID. Note that gls.batch.get()
treats participants with FTYPE=6
as the sole members of their own family units, and not as part of the family corresponding to their family ID.
If neither the phenotype nor pedigree file contain "FTYPE"
and "INDIV"
, gls.batch()
will construct them via FSV.frompedi()
.
A list with these three components:
test.dat |
The merged data frame of family-structure variables, phenotype, covariates, and genotypes. Participants of family-type 6 will be moved to the end of the data frame. There will also be three additional columns:
|
tlist |
A character vector of family labels, with length equal to the number of families in the data (each participant of family-type 6 is treated as a separate family). The names of its components are the family IDs. |
sizelist |
A vector of family sizes, with length equal to the number of families in the data (each participant of family-type 6 is treated as a separate family). The names of its components are the family IDs. |
Xiang Li lixxx554@umn.edu, Robert M. Kirkpatrick kirk0191@umn.edu, and Saonli Basu saonli@umn.edu .
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | data(pheno)
data(geno)
data(map)
data(pedigree)
foo <- gls.batch.get(
phenfile=pheno,genfile=data.frame(t(geno)),pedifile=pedigree,
covmtxfile.in=NULL,theta=NULL,snp.names=map[,2],input.mode=c(1,2,3),
pediheader=FALSE,pedicolname=c("FAMID","ID","PID","MID","SEX"),
sep.phe=" ",sep.gen=" ",sep.ped=" ",
phen="Zscore",covars="IsFemale",med=c("UN","VC"),
outfile,col.names=TRUE,return.value=FALSE,
covmtxfile.out=NULL,
covmtxparams.out=NULL,
sizeLab=NULL,Mz=NULL,Bo=NULL,Ad=NULL,Mix=NULL,indobs=NULL)
olsmod <- lm( ##<--OLS regression could be applied to the merged dataset...
Zscore ~ rs3934834 + IsFemale, data=foo$test.dat)
summary(olsmod) ##<--...but the standard errors and t-statistics will not be valid.
##The 'tlist' vector can be useful for figuring out if any residual-covariance
##parameters are poorly identified in the data:
pheno2 <- subset(pheno, (pheno$INDIV<3 & pheno$FAMID>20) |
(pheno$ID %in% c(11,12,13,21,22,23)))
foo2 <- gls.batch.get(
phenfile=pheno2,
genfile=data.frame(t(geno)),pedifile=pedigree,
covmtxfile.in=NULL,theta=NULL,snp.names=map[,2],input.mode=c(1,2,3),
pediheader=FALSE,pedicolname=c("FAMID","ID","PID","MID","SEX"),
sep.phe=" ",sep.gen=" ",sep.ped=" ",
phen="Zscore",covars="IsFemale",med=c("UN","VC"),
outfile,col.names=TRUE,return.value=FALSE,
covmtxfile.out=NULL,
covmtxparams.out=NULL,
sizeLab=NULL,Mz=NULL,Bo=NULL,Ad=NULL,Mix=NULL,indobs=NULL)
table(foo2$tlist)
##Only two families have the label 'ccm', that is, only two have
##a mother. So, if calling fgls()
##with med="UN", it would probably be a good idea to drop the
##mother variance [drop=10], or the biological mother-offspring
##correlation [drop=2], or both [drop=c(2,10)].
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.