Skip to content

Commit

Permalink
ordering columns #27
Browse files Browse the repository at this point in the history
  • Loading branch information
dariushghasemi committed Nov 7, 2024
1 parent 9207c12 commit c4d8ce0
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ cojo.ht=function(D=dataset_gwas
mlog10p = safe_pnorm(b, se), # compute unconditional MLOG10P
mlog10pJ = safe_pnorm(bJ, bJ_se) # compute joint MLOG10P
) %>%
dplyr::relocate(Chr:freq, freq_geno, b:p, mlog10p, n:pJ, mlog10pJ) %>% # tidying columns order
dplyr::relocate(Chr:freq, freq_geno, b:p, p_org, mlog10p, n:pJ, pJ_org, mlog10pJ) %>% # tidying columns order
filter(mlog10p > - log10(p.jumper)) %>% # avoid including any non-significant independent variant to conditional model
left_join(D %>% dplyr::select(SNP,any_of(c("type", "sdY", opt$p_label))), by="SNP")

Expand Down Expand Up @@ -240,7 +240,7 @@ cojo.ht=function(D=dataset_gwas
mlog10p = safe_pnorm(b, se), # compute unconditional MLOG10P
mlog10pC = safe_pnorm(bC, bC_se) # compute joint MLOG10P
) %>%
dplyr::relocate(Chr:freq, freq_geno, b:p, mlog10p, n:pC, mlog10pC) %>% # tidying columns order
dplyr::relocate(Chr:freq, freq_geno, b:p, p_org, mlog10p, n:pC, pC_org, mlog10pC) %>% # tidying columns order
left_join(D %>% dplyr::select(SNP, any_of(c("type", "sdY", opt$p_label))), by="SNP") %>%
dplyr::mutate(cojo_snp=ind.snp$SNP[i])
# Add SNPs to the ind.snps dataframe
Expand All @@ -267,7 +267,7 @@ cojo.ht=function(D=dataset_gwas
p = safe_pnorm(b, se, p = TRUE), # compute unconditional p-value
mlog10p = safe_pnorm(b, se), # compute unconditional MLOG10P
) %>%
dplyr::relocate(Chr:freq, freq_geno, b:p, mlog10p) %>% # tidying columns order
dplyr::relocate(Chr:freq, freq_geno, b:p, p_org, mlog10p) %>% # tidying columns order
left_join(D %>% dplyr::select(SNP,!!ea.label, any_of(c("type", "sdY", opt$p_label))), by=c("SNP", "refA"=opt$ea_label))

#### Add back top SNP, removed from the data frame with the conditioning step
Expand All @@ -280,6 +280,7 @@ cojo.ht=function(D=dataset_gwas
step2.res$bC <- step2.res$b
step2.res$bC_se <- step2.res$se
step2.res$pC <- step2.res$p
step2.res$pC_org <- step2.res$p_org
step2.res$mlog10pC <- step2.res$mlog10p

dataset.list$ind.snps <- rbind(dataset.list$ind.snps, ind.snp)
Expand Down

0 comments on commit c4d8ce0

Please sign in to comment.