Skip to content

Commit

Permalink
archive dirty local repo on 2020-09-10, commit all changes
Browse files Browse the repository at this point in the history
the changes seem to be about changing a coefficients visualization
to coefficients-horizontal. might also include other things.

--HG--
branch : coefficients-horizontal
  • Loading branch information
dhimmel committed Sep 10, 2020
1 parent 94f36d3 commit 952bd5c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions MS-analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ for (primary in linked) {
exclusions <- unique(c(linked, hcs_post_wtc, xmhc))
novel.df <- subset(ms.df, ! (gene_symbol %in% exclusions))
novel.df <- novel.df[order(novel.df$prediction_pre_wtc, decreasing=TRUE), ]
sum(novel.df$prediction_pre_wtc >= 0.02430711) # novel genes exceeding prediction threshold
nominal.novel.df <- subset(novel.df, meta_p_value <= 0.05)

BonferroniValidator <- function(pvals, alpha=0.05) {
Expand Down
1 change: 1 addition & 0 deletions gene-set-subset.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ auroc.df$mask_type <- factor(auroc.df$mask_type, levels=c('node', 'edge'))

gg.auroc <- auroc.df %>%
dplyr::filter(! (mask_type == 'edge' & subset_kind == 'minimum')) %>%
dplyr::filter(! (metanode == 'tissue' & subset_kind == 'minimum')) %>%
dplyr::left_join(msigdb.df %>% dplyr::select(metanode, metanode_name)) %>%
ggplot(aes(x, auroc)) %>% SetGGTheme() +
facet_wrap( ~ metanode_name, ncol = 5) +
Expand Down
21 changes: 11 additions & 10 deletions predictions_all-diseases.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,28 +84,29 @@ close(predictions.file)
coef.df$neg_ridge_zcoef <- -coef.df$ridge_zcoef
coef.melt <- reshape2::melt(subset(coef.df, feature != 'intercept'),
measure.vars=c('neg_ridge_zcoef', 'lasso_zcoef'))
coef.melt$variable <- factor(coef.melt$variable, levels=c('lasso_zcoef', 'neg_ridge_zcoef'))

coef.melt.ridge <- subset(coef.melt, variable=='neg_ridge_zcoef')
coef.sorted <- coef.melt.ridge[order(coef.melt.ridge$value, decreasing=TRUE), 'name']
coef.sorted <- coef.melt.ridge[order(coef.melt.ridge$value, decreasing=FALSE), 'name']

gg.zcoef <- ggplot(coef.melt, aes(x=name, ymin=0, ymax=value, color=variable))
gg.zcoef <- SetGGTheme(gg.zcoef) +
geom_linerange(stat='identity', size=4.2) +
geom_linerange(stat='identity', size=4.5) +
geom_hline(yintercept=0, color=Solar('base02')) +
coord_flip() +
#coord_flip() +
ylab('Standardized Coefficient') +
scale_x_discrete(limits=coef.sorted) +
scale_y_continuous(labels=abs) +
scale_color_manual(name='Method (AUROC)', values=c(Solar('red'), Solar('blue')),
labels=c(sprintf('ridge (%.3f)', vtm.ridge$auroc),
sprintf('lasso (%.3f)', vtm.lasso$auroc))) +
scale_color_manual(name='Method (AUROC)', values=c(Solar('blue'), Solar('red')),
labels=c(sprintf('lasso (%.3f)', vtm.lasso$auroc),
sprintf('ridge (%.3f)', vtm.ridge$auroc))) +
theme(legend.key=element_rect(linetype='blank')) +
theme(axis.text.y=element_text(angle=30, hjust=1)) + xlab(NULL) +
theme(legend.justification=c(1,0), legend.position=c(1,0),
theme(axis.text.x=element_text(angle=45, hjust=1, size=9)) + xlab(NULL) +
theme(legend.justification=c(1,1), legend.position=c(1,1),
legend.background=element_rect(color='grey60', size=0.2))

path <- file.path(dirs$plots, 'coefficients.pdf')
OpenPDF(path, width=width.half, height=4.5)
path <- file.path(dirs$plots, 'coefficients-horizontal.pdf')
OpenPDF(path, width=5.25, height=2.8)
print(gg.zcoef)
ClosePDF(path)

Expand Down

0 comments on commit 952bd5c

Please sign in to comment.