Skip to content

Commit

Permalink
save power calcs
Browse files Browse the repository at this point in the history
  • Loading branch information
Eilis Hannon committed Jan 14, 2025
1 parent 0a3d727 commit 5dbac7d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion array/DNAm/analysis/EWAS/calcPowerinOtherCT.r
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ for(each in cellTypes){
betasCell <- as.matrix(celltypeNormbeta[,QCmetrics$Cell.type == each])
# calculate SD
betasSD <- apply(as.matrix(betasCell),1,sd)
betasSD <- as.data.frame(betasSD) %>% mutate(points_bin = ntile(betasSD, n=binSize))
betasSD <- as.data.frame(betasSD) %>% mutate(points_bin = ntile(betasSD, n=binSize))

for(j in unique(betasSD$points_bin)){
meanSD <- mean(betasSD[which(betasSD$points_bin == j),1])
Expand All @@ -154,6 +154,8 @@ for(each in cellTypes){
}
}

save(powerCalcs, file = file.path(resPath, "PowerCalcsTypicalNeuNDMP.rdata"))

pdf(file.path(resPath, "Plots","ViolinPlotPowerStatisticsAllSitesTypicalNeuNEffect.pdf"), width = 4, height = 4)
powerCalcsLong<-pivot_longer(as.data.frame(powerCalcs), cols = everything())
ggplot(powerCalcsLong, aes(x = name, y = value, fill = name)) + geom_violin() +
Expand Down

0 comments on commit 5dbac7d

Please sign in to comment.