Skip to content

Commit

Permalink
Update MAKE_KEY.R
Browse files Browse the repository at this point in the history
  • Loading branch information
ammegandchips authored Jan 29, 2024
1 parent 69f1257 commit a10751c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions making_key/MAKE_KEY.R
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,9 @@ key$covariates_model4c <- apply(key[,c("covariates_model4a","other_parents_expos
key$covariates_model2c[key$exposure_subclass=="polygenic risk score"]<-NA
key$covariates_model3c[key$exposure_subclass=="polygenic risk score"]<-NA

## add ethnicity of other parent
## add ethnicity of other parent (if cohort not BIB_SA or BIB_WE)

if(tolower(cohort) %in% c("moba","alspac","bib","mcs")){
key$covariates_model1c[key$person_exposed=="mother"&key$exposure_subclass!="polygenic risk score"]<-paste(key$covariates_model1c[key$person_exposed=="mother"&key$exposure_subclass!="polygenic risk score"],"covs_ethnicity_father",sep=",")
key$covariates_model1c[key$person_exposed=="partner"&key$exposure_subclass!="polygenic risk score"]<-paste(key$covariates_model1c[key$person_exposed=="partner"&key$exposure_subclass!="polygenic risk score"],"covs_ethnicity_mother",sep=",")
key$covariates_model2c[key$person_exposed=="mother"&key$exposure_subclass!="polygenic risk score"]<-paste(key$covariates_model2c[key$person_exposed=="mother"&key$exposure_subclass!="polygenic risk score"],"covs_ethnicity_father",sep=",")
Expand All @@ -223,7 +224,8 @@ key$covariates_model3c[key$person_exposed=="mother"&key$exposure_subclass!="poly
key$covariates_model3c[key$person_exposed=="partner"&key$exposure_subclass!="polygenic risk score"]<-paste(key$covariates_model3c[key$person_exposed=="partner"&key$exposure_subclass!="polygenic risk score"],"covs_ethnicity_mother",sep=",")
key$covariates_model4c[key$person_exposed=="mother"&key$exposure_subclass!="polygenic risk score"]<-paste(key$covariates_model4c[key$person_exposed=="mother"&key$exposure_subclass!="polygenic risk score"],"covs_ethnicity_father",sep=",")
key$covariates_model4c[key$person_exposed=="partner"&key$exposure_subclass!="polygenic risk score"]<-paste(key$covariates_model4c[key$person_exposed=="partner"&key$exposure_subclass!="polygenic risk score"],"covs_ethnicity_mother",sep=",")

}

# remove NAs in all lists of covariates

print("tidying up key...")
Expand Down

0 comments on commit a10751c

Please sign in to comment.