seqMetaExample: Example data for illustrating seqMeta

Description Usage Format Examples

Description

Contains simulated data for two cohorts. See the example for the exact code used to generate the data.

Usage

1

Format

This contains simulated data for two cohorts to illustrate seqMeta package

Z1,Z2

Genotype matrices for cohorts 1 and 2 respectively

pheno1,pheno2

phenotype matrices for cohorts 1 and 2 respectively

kins

The kinship matrix for cohort 2

Examples

 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
#Data generated by
## Not run: 
set.seed(20)
n <- 600 #observations per cohort
d <- 2000 #SNPs
k <- 100 #genes

##### First cohort of unrelated individuals:
Z1 <- replicate(d,rbinom(n,2,rbeta((n),3,200)))

## assign SNP id's to the columns 
colnames(Z1) <- sample(d+50,d) + 1e6

pheno1 <-  data.frame("y" = rnorm(n), "sex"=rep(1:2,(n/2)), "bmi"=rnorm(n,25,2),
	"ybin" = rbinom(n,1,.5), "time"=rpois(n,5), "status"=rbinom(n,1,.9))

genes <- paste0("gene",1:k)
SNPInfo <-data.frame("Name"=as.character(1:(d+50) + 1e6), 
"gene"=sort(sample(genes,d+50,replace=T)), stringsAsFactors=FALSE)
#SNPInfo <- data.frame("Name" =1:(d+50) + 1e6, "gene" = sort(sample(genes,d+50,replace=T)))

#####Second cohort of family data:
# 150 families of size 4
require(kinship2)
fullped<-data.frame(famid=rep(1:(n/4),each=4),id=10001:(10000+n),fa=rep(0,n),mo=rep(0,n))
fullped$fa[(1:(n/4))*4-1]<-fullped$fa[(1:(n/4))*4]<-(1:(n/4))*4+9997
fullped$mo[(1:(n/4))*4-1]<-fullped$mo[(1:(n/4))*4]<-(1:(n/4))*4+9998
kins = makekinship(fullped$famid, fullped$id, fullped$fa, fullped$mo)

## generate a phenotype with 20% `heritability': 
pheno2<-data.frame("id"=10001:(10000+n),"y"=t(rnorm(n)%*%chol(0.2*2*as.matrix(kins) + 
	0.8*diag(n))),"sex"=rep(1:2,(n/2)),"bmi"=rnorm(n,25,2))

Z2 <- replicate(d,rbinom(n,2,rbeta((n/4),3,200)[fullped$famid]))
colnames(Z2) <- sample(d+50,d) + 1e6

## End(Not run)

Example output

Loading required package: survival
Loading required package: kinship2
Loading required package: Matrix
Loading required package: quadprog

seqMeta documentation built on May 2, 2019, 10:59 a.m.