Description Usage Arguments Details Value Examples
View source: R/sangerCoxSurv.R
Performs survival analysis using Cox proportional hazard models on imputed genetic data stored in compressed VCF files.
1 2 3 4 5 |
vcf.file |
character(1) path to VCF file. |
covariate.file |
matrix(1) comprising phenotype (time, event) and additional covariate data. |
id.column |
character(1) providing exact match to sample ID column
from |
sample.ids |
character vector with sample ids to include in analysis |
time.to.event |
character(1) string that matches time column name in pheno.file |
event |
character(1) string that matches event column name in pheno.file |
covariates |
character vector with matching column names in pheno.file of covariates of interest |
inter.term |
character(1) string giving the column name of the covariate
that will be added to the interaction term with SNP (e.g. |
print.covs |
character(1) string of either |
out.file |
character(1) string with output name |
maf.filter |
integer(1) filter out minor allele frequency below threshold (i.e. 0.005 will filter MAF > 0.005) |
info.filter |
integer(1) of imputation quality score filter (i.e. 0.7 will filter info > 0.7) |
chunk.size |
integer(1) number of variants to process per thread |
verbose |
logical(1) for messages that describe which part of the analysis is currently being run |
clusterObj |
A cluster object that can be used with the |
Testing for SNP-covariate interactions:
User can define the column name of the covariate that will be included in the
interaction term.
For example, for given covariates a
and b
, where c
is
defined as the inter.term
the model will be:
~ a + b + c + SNP + c*SNP
.
Printing results of other covariates:
print.covs
argument controls the number of covariates will be printed
as output. The function is set to only
by default and will only print
the SNP or if an interaction term is given, the results of the interaction
term (e.g. SNP*covariate
). Whereas, all
will print results
(coef, se.coef, p.value etc) of all covariates included in the model.
some
is only applicable if an interaction term is given and will print
the results for SNP, covariate tested for interaction and the interaction
term. User should be mindful about using the all
option, as it will
likely slow down the analysis and will increase the output file size.
User defined parallelization:
This function uses parApply
from parallel
package to fit models
to SNPs in parallel.
User is not required to set any options for the parallelization.
However, advanced users who wish to optimize it, can provide a cluster object
generated by makeCluster
family of functions that suits their need and
platform.
Saves two text files directly to disk:
.coxph
extension containing CoxPH survival analysis results.
.snps_removed
extension containing SNPs that were removed
due to low variance or user-defined thresholds.
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 | vcf.file <- system.file(package="gwasurvivr",
"extdata",
"sanger.pbwt_reference_impute.vcf.gz")
pheno.fl <- system.file(package="gwasurvivr",
"extdata",
"simulated_pheno.txt")
pheno.file <- read.table(pheno.fl,
sep=" ",
header=TRUE,
stringsAsFactors = FALSE)
pheno.file$SexFemale <- ifelse(pheno.file$sex=="female", 1L, 0L)
sample.ids <- pheno.file[pheno.file$group=="experimental",]$ID_2
sangerCoxSurv(vcf.file=vcf.file,
covariate.file=pheno.file,
id.column="ID_2",
sample.ids=sample.ids,
time.to.event="time",
event="event",
covariates=c("age", "SexFemale", "DrugTxYes"),
inter.term=NULL,
print.covs="only",
out.file="sanger_example",
info.filter=0.3,
maf.filter=0.005,
chunk.size=50,
verbose=TRUE,
clusterObj=NULL)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.