Skip to content

Commit

Permalink
Updates to include pp
Browse files Browse the repository at this point in the history
  • Loading branch information
eleanorsanderson committed Dec 3, 2024
1 parent 2192fa7 commit cf1dcbb
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 33 deletions.
48 changes: 24 additions & 24 deletions phenotype_list.csv
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
Name,pheno_id,var_type,units,min,max,covs,transformation,standardisation,opengwasid
Body mass index,bmi,cont,kg/m2,0,60,sex,log,yes,ukb-b-19953
Height,height,cont,cm,10,250,sex,none,yes,ebi-a-GCST90029008
Waist circumference,wc,cont,cm,0,250,sex,none,yes,ukb-b-9405
Waist to hip ratio,whr,cont,ratio,0,20,sex,none,yes,ebi-a-GCST90029009
Total body bone mineral density,tb-bmd,cont,g/cm2,0,20,sex,none,yes,ebi-a-GCST004772
Forced expiratory volume in 1 second,fev1,cont,l,0,10,sex,none,yes,ukb-b-19657
FEV1/FVC ratio,fev1fvc,cont,l,0,10,sex,none,yes,ebi-a-GCST90029026
Systolic blood pressure,sbp,cont,mmHg,0,250,sex:bp_medication,none,yes,ukb-b-20175
Diastolic blood pressure,dbp,cont,mmHg,0,250,sex:bp_medication,none,yes,
LDL cholesterol,ldl,cont,mmol/L,0,10,sex:cholesterol_med,none,yes,ieu-b-110
HDL cholesterol,hdl,cont,mmol/L,0,10,sex,none,yes,ieu-b-109
Triglycerides,trig,cont,mmol/L,0,20,sex,none,yes,ieu-b-111
C-reactive protein,crp,cont,mg/L,0,100,sex,none,yes,ebi-a-GCST90014002
Interleukin 6,il6,cont,pg/ml,0,100,sex,none,yes,ebi-a-GCST90012005
Leptin,leptin,cont,ng/ml,0,100,sex,none,yes,ebi-a-GCST90007307
Glycated haemoglobin,hba1c,cont,mmol/mol,0,70,sex,none,yes,ebi-a-GCST90014006
Insulin,insulin,cont,pmol/L,0,200,sex,none,yes,ukb-b-15445
Adiponectin,adiponectin,cont,ug/ml,0,100,sex,none,yes,ieu-a-1
Calcium,calcium,cont,mmol/L,0,10,sex,none,yes,ebi-a-GCST90013999
Vitamin D,vitd,cont,nmol/L,0,400,sex,none,yes,ebi-a-GCST90000618
Estradiol,estradiol,cont,pmol/L,0,15000,sex,none,yes,ebi-a-GCST90012105
Testosterone,testosterone,cont,nmol/L,0,60,sex,none,yes,ebi-a-GCST90012114
Sex hormone binding globulin,shbg,cont,nmol/L,0,300,sex,none,yes,ieu-b-4870
Name,pheno_id,var_type,units,min,max,covs,transformation,standardisation,opengwasid
Body mass index,bmi,cont,kg/m2,0,60,sex,log,yes,ukb-b-19953
Height,height,cont,cm,10,250,sex,none,yes,ebi-a-GCST90029008
Waist circumference,wc,cont,cm,0,250,sex,none,yes,ukb-b-9405
Waist to hip ratio,whr,cont,ratio,0,20,sex,none,yes,ebi-a-GCST90029009
Total body bone mineral density,tb-bmd,cont,g/cm2,0,20,sex,none,yes,ebi-a-GCST004772
Forced expiratory volume in 1 second,fev1,cont,l,0,10,sex,none,yes,ukb-b-19657
FEV1/FVC ratio,fev1fvc,cont,l,0,10,sex,none,yes,ebi-a-GCST90029026
Systolic blood pressure,sbp,cont,mmHg,0,250,sex:bp_med,none,yes,ukb-b-20175
Diastolic blood pressure,dbp,cont,mmHg,0,250,sex:bp_med,none,yes,
LDL cholesterol,ldl,cont,mmol/L,0,10,sex:cholesterol_med,none,yes,ieu-b-110
HDL cholesterol,hdl,cont,mmol/L,0,10,sex,none,yes,ieu-b-109
Triglycerides,trig,cont,mmol/L,0,20,sex,none,yes,ieu-b-111
C-reactive protein,crp,cont,mg/L,0,100,sex,none,yes,ebi-a-GCST90014002
Interleukin 6,il6,cont,pg/ml,0,100,sex,none,yes,ebi-a-GCST90012005
Leptin,leptin,cont,ng/ml,0,100,sex,none,yes,ebi-a-GCST90007307
Glycated haemoglobin,hba1c,cont,mmol/mol,0,70,sex,none,yes,ebi-a-GCST90014006
Insulin,insulin,cont,pmol/L,0,200,sex,none,yes,ukb-b-15445
Adiponectin,adiponectin,cont,ug/ml,0,100,sex,none,yes,ieu-a-1
Calcium,calcium,cont,mmol/L,0,10,sex,none,yes,ebi-a-GCST90013999
Vitamin D,vitd,cont,nmol/L,0,400,sex,none,yes,ebi-a-GCST90000618
Estradiol,estradiol,cont,pmol/L,0,15000,sex,none,yes,ebi-a-GCST90012105
Testosterone,testosterone,cont,nmol/L,0,60,sex,none,yes,ebi-a-GCST90012114
Sex hormone binding globulin,shbg,cont,nmol/L,0,300,sex,none,yes,ieu-b-4870
26 changes: 17 additions & 9 deletions resources/phenotypes/phenotype_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -323,40 +323,48 @@ organise_phenotype <- function(phecode, phenotypes, df, gen_covs, covdat, agebin
type <- filter(df, pheno_id == phecode)$var_type
str(filter(df, pheno_id == phecode))
cs <- list()
phen <- read_phenotype_data(phecode, Sys.getenv("phenotype_input_dir"), agebins)
adjust_covs <- NULL
if(phecode == "ldl"){
adjust_covs <- "cholesterol_med"
}
phen <- read_phenotype_data(phecode, Sys.getenv("phenotype_input_dir"), agebins, adjust_covs)
}

if(phecode == "pp") {
type <- "cont"
cs <- list()
phecode1 <- "sbp"
phen1 <- read_phenotype_data(phecode1, Sys.getenv("phenotype_input_dir"), agebins)
phen1 <- read_phenotype_data(phecode1, Sys.getenv("phenotype_input_dir"), agebins, "bp_med")
if(is.null(phen1)) {
return(NULL)
}
phen1 <- rename(phen1, sbp = value)

phen1$value <- phen1$value + (15 * phen1$bp_med)
phen1$value <- remove_outliers(dat, phecode1)
phen1 <- remove_outliers(phen1, phecode1)
phen1 <- rename(phen1, sbp = value)

phecode2 <- "dbp"
phen2 <- read_phenotype_data(phecode2, Sys.getenv("phenotype_input_dir"), agebins)
phen2 <- read_phenotype_data(phecode2, Sys.getenv("phenotype_input_dir"), agebins, "bp_med")
if(is.null(phen2)) {
return(NULL)
}
phen2 <- rename(phen2, dbp = value)
phen2$value <- phen2$value + (10 * phen2$bp_med)
phen2$value <- remove_outliers(dat, phecode2)

phen2$value <- phen2$value + (10 * phen2$bp_med)
phen2 <- remove_outliers(phen2, phecode2)
phen2 <- rename(phen2, dbp = value)

phen <- inner_join(phen1, phen2)
phen$value <- sbp - dbp
phen$value <- phen$sbp - phen$dbp
phen <- phen %>%
select(!c(sbp, dbp))

outliers <- phen %>%
filter(!between(phen$value, 10, 180)) %>%
select('value')

phen <- phen %>%
filter(between(phen$value, 10, 180))

}

if(phecode=="bmiz"){
Expand Down

0 comments on commit cf1dcbb

Please sign in to comment.