-
Notifications
You must be signed in to change notification settings - Fork 17
/
STAARpipeline_Null_Model.r
37 lines (32 loc) · 1.31 KB
/
STAARpipeline_Null_Model.r
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
###########################################################
# fit STAAR null model for single-trait analysis
# Xihao Li, Zilin Li
# Initiate date: 11/04/2021
# Current date: 06/13/2024
###########################################################
rm(list=ls())
gc()
library(gdsfmt)
library(SeqArray)
library(SeqVarTools)
library(STAAR)
library(STAARpipeline)
###########################################################
# User Input
###########################################################
## Phenotype file
phenotype <- read.csv("/path_to_the_file/pheno.csv")
## (sparse) GRM file
sgrm <- get(load("/path_to_the_file/sGRM.Rdata"))
## file directory for the output file
output_path <- "/path_to_the_output_file/"
## output file name
output_name <- "obj_nullmodel.Rdata"
###########################################################
# Main Function
###########################################################
## fit null model
obj_nullmodel <- fit_nullmodel(LDLadj.norm~age+age2+sex+PC1+PC2+PC3+PC4+PC5+PC6+PC7+PC8+PC9+PC10+as.factor(study_ethnicity),
data=phenotype,kins=sgrm,use_sparse=TRUE,kins_cutoff=0.022,id="sample.id",
groups="study_ethnicity",family=gaussian(link="identity"),verbose=TRUE)
save(obj_nullmodel,file=paste0(output_path,output_name))