Last updated: 2022-07-15
Checks: 7 0
Knit directory: logistic-susie-gsea/
This reproducible R Markdown analysis was created with workflowr (version 1.7.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20220105)
was run prior to running
the code in the R Markdown file. Setting a seed ensures that any results
that rely on randomness, e.g. subsampling or permutations, are
reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version adb077c. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for
the analysis have been committed to Git prior to generating the results
(you can use wflow_publish
or
wflow_git_commit
). workflowr only checks the R Markdown
file, but you know if there are other scripts or data files that it
depends on. Below is the status of the Git repository when the results
were generated:
Ignored files:
Ignored: .DS_Store
Ignored: .RData
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: _targets.R
Ignored: _targets.html
Ignored: _targets.md
Ignored: _targets/objects/
Ignored: _targets/user/
Ignored: _targets/workspaces/
Ignored: _targets_r/
Ignored: cache/
Ignored: data/.DS_Store
Ignored: data/adipose_2yr_topsnp.txt
Ignored: data/anthony/
Ignored: data/de-droplet/
Ignored: data/deng/
Ignored: data/fetal_reference_cellid_gene_sets.RData
Ignored: data/human_chimp_eb/
Ignored: data/pbmc-purified/
Ignored: data/wenhe_baboon_diet/
Ignored: data/yusha_sc_tumor/
Ignored: library/
Ignored: renv/
Ignored: staging/
Untracked files:
Untracked: .ipynb_checkpoints/
Untracked: Master's Paper.pdf
Untracked: Project_1652928411/
Untracked: Project_1653228324/
Untracked: Project_1653228355/
Untracked: VEB_Boost_Proposal_Write_Up (1).pdf
Untracked: _targets/meta/
Untracked: additive.l5.gonr.aggregate.scores
Untracked: analysis/alpha_ash_v_point_normal.Rmd
Untracked: analysis/compare_w_post_hoc_clustering.Rmd
Untracked: analysis/de_droplet_noshrink.Rmd
Untracked: analysis/de_droplet_noshrink_logistic_susie.Rmd
Untracked: analysis/fetal_reference_cellid_gsea.Rmd
Untracked: analysis/fixed_intercept.Rmd
Untracked: analysis/gsea_made_simple.Rmd
Untracked: analysis/iDEA_examples.Rmd
Untracked: analysis/latent_gene_list.Rmd
Untracked: analysis/linear_method_failure_modes.Rmd
Untracked: analysis/linear_regression_failure_regime.Rmd
Untracked: analysis/linear_v_logistic_pbmc.Rmd
Untracked: analysis/logistic_susie_veb_boost_vs_vb.Rmd
Untracked: analysis/logistic_susie_vis.Rmd
Untracked: analysis/logistic_variational_bound.Rmd
Untracked: analysis/logsitic_susie_template.Rmd
Untracked: analysis/pcb_scratch.Rmd
Untracked: analysis/references.bib
Untracked: analysis/roadmap.Rmd
Untracked: analysis/simulations.Rmd
Untracked: analysis/simulations_l1.Rmd
Untracked: analysis/tccm_vs_logistic_susie.Rmd
Untracked: analysis/template.Rmd
Untracked: analysis/test.Rmd
Untracked: build_site.R
Untracked: code/html_tables.R
Untracked: code/latent_logistic_susie.R
Untracked: code/logistic_susie_data_driver.R
Untracked: code/marginal_sumstat_gsea_collapsed.R
Untracked: code/point_normal.R
Untracked: code/sumstat_gsea.py
Untracked: code/susie_gsea_queries.R
Untracked: docs.zip
Untracked: export/
Untracked: l1.sim.aggregate.scores
Untracked: pbmc_cd19_symbol.txt
Untracked: pbmc_cd19b_0.1_background.csv
Untracked: pbmc_cd19b_0.1_david_annotation_clusters.txt
Untracked: pbmc_cd19b_0.1_david_results.txt
Untracked: pbmc_cd19b_0.1_list.csv
Untracked: presentations/
Untracked: references.bib
Unstaged changes:
Modified: analysis/example_pbmc.Rmd
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were
made to the R Markdown (analysis/example_anthony.Rmd
) and
HTML (docs/example_anthony.html
) files. If you’ve
configured a remote Git repository (see ?wflow_git_remote
),
click on the hyperlinks in the table below to view the files as they
were in that past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | adb077c | karltayeb | 2022-07-15 | wflow_publish(files = c("analysis/example_anthony.Rmd", "analysis/example_yusha_sc_tumor.Rmd")) |
html | ef048c4 | karltayeb | 2022-07-14 | Build site. |
Rmd | 2dd378e | karltayeb | 2022-07-14 | wflow_publish("analysis/example_anthony.Rmd") |
Anthony differentiated IPSCS -> MSC -> Chondrocytes and treated with physical stress and IL1B.
source('code/load_data.R')
library(gseasusie)
# save output to a folder... helps for running many factors
cache_rds = purrr::partial(xfun::cache_rds, dir='cache/chondrocyte_oa/')
driver = function(gs, experiment){
dat <- gseasusie::prep_binary_data(gs, data[[experiment]], thresh = 0.05)
ora <- gseasusie::fit_ora(dat$X, dat$y)
# add description
ora <- ora %>%
dplyr::left_join(gs$geneSetDes)
fit <- gseasusie::fit_logistic_susie_veb_boost(dat$X, dat$y)
return(list(fit=fit, ora=ora))
}
driver_cached = function(prefix, gs, experiment, ...){
file = paste0(prefix, '_', gs$db, '_', experiment, '.rds')
print(file)
cache_rds(driver(gs, experiment), file=file, ...)
}
data <- load_chondrocyte_data2()
go <- gseasusie::load_all_go()
res <- purrr::map(names(data), ~driver_cached('hnscc', go, .x, rerun=F))
#> [1] "hnscc_all_go_CTS.rds"
#> [1] "hnscc_all_go_IL1B.rds"
names(res) <- names(data)
pack_group = function(tbl){
components <- tbl$component
unique.components <- unique(components)
start <- match(unique.components, components)
end <- c(tail(start, -1) - 1, length(components))
res <- tbl %>% dplyr::select(-c(component)) %>% kableExtra::kbl()
for(i in 1:length(unique.components)){
res <- kableExtra::pack_rows(res, unique.components[i], start[i], end[i])
}
return(res)
}
#' Report credible set based summary of SuSiE
#' @export
static_table = function(fit, ora){
# get credible sets
res <- gseasusie:::get_gene_set_summary(fit) %>%
dplyr::left_join(ora)
csdat <- gseasusie:::get_credible_set_summary(fit) %>%
dplyr::left_join(ora) %>%
dplyr::filter(in_cs, active_cs) %>%
dplyr::select(geneSet, description, component, in_cs, alpha, conditional_beta) %>%
distinct()
# manipulate table
columns <- c(
'geneSet', 'description', 'geneSetSize', 'overlap',
'log2OR', 'effect', 'alpha', 'pip', 'nlog10pFishersExact', 'fisherRank',
'component'
)
color_columns <- which(columns %in% c('log2OR', 'effect'))
dt <- res %>%
dplyr::filter(overlap > 0) %>%
dplyr::mutate(
log2OR = log2(oddsRatio),
nlog10pFishersExact = -log10(pFishersExact)
) %>%
dplyr::left_join(csdat) %>%
dplyr::arrange(dplyr::desc(nlog10pFishersExact)) %>%
dplyr::mutate(
fisherRank = dplyr::row_number(),
in_cs = dplyr::if_else(is.na(in_cs), FALSE, in_cs),
effect = conditional_beta * log2(exp(1))
) %>%
dplyr::filter(in_cs) %>%
dplyr::select(columns) %>%
dplyr::mutate(dplyr::across(!where(is.numeric) , as.factor)) %>%
mutate(
component = reorder(factor(component), fisherRank, FUN=min)
# sorts components
) %>%
dplyr::arrange(component) %>%
dplyr::mutate_if(is.numeric, funs(as.character(signif(., 3))))
# display table
dt %>%
pack_group %>%
kableExtra::column_spec(
color_columns, color=ifelse(dt$effect > 0, 'green', 'red')) %>%
kableExtra::kable_styling()
}
static_table(fit, ora)
results <- res
experiments <- names(results)
safe_static_table <- purrr::safely(
gseasusie::static_table,
otherwise = 'nothing to report')
for(this_experiment in experiments){
sub_res <- results[[this_experiment]]
volcano <- gseasusie::enrichment_volcano(fit=sub_res$fit, ora=sub_res$ora)
results[[this_experiment]]$volcano <- volcano
table <- safe_static_table(sub_res$fit, sub_res$ora)$result
results[[this_experiment]]$table <- table
}
cat('\n')
cat('##', 'Results')
for(this_experiment in experiments){
cat('\n')
cat('###', this_experiment)
#sub_res <- results[[this_experiment]]
#volcano <- gseasusie::enrichment_volcano(fit=sub_res$fit, ora=sub_res$ora)
print(results[[this_experiment]]$volcano)
cat("\n\n")
#table <- safe_static_table(sub_res$fit, sub_res$ora)$result
print(results[[this_experiment]]$table)
}
Version | Author | Date |
---|---|---|
ef048c4 | karltayeb | 2022-07-14 |
geneSet | description | geneSetSize | overlap | log2OR | effect | alpha | pip | nlog10pFishersExact | fisherRank |
---|---|---|---|---|---|---|---|---|---|
L1 | |||||||||
GO:0006952 | defense response | 710 | 317 | 1.22 | 0.94 | 1 | 1 | 24.8 | 1 |
L4 | |||||||||
GO:0071944 | cell periphery | 2460 | 862 | 0.729 | 0.468 | 0.654 | 0.654 | 22.8 | 2 |
GO:0005886 | plasma membrane | 2400 | 840 | 0.726 | 0.465 | 0.332 | 0.332 | 22.3 | 5 |
L2 | |||||||||
GO:0005634 | nucleus | 4890 | 1100 | -0.647 | -0.527 | 1 | 1 | 22.6 | 3 |
L3 | |||||||||
GO:0031012 | extracellular matrix | 280 | 147 | 1.63 | 1.17 | 0.999 | 0.999 | 19.2 | 18 |
L5 | |||||||||
GO:0009888 | tissue development | 1110 | 421 | 0.813 | 0.615 | 0.995 | 0.995 | 16.1 | 33 |
knitr::knit_exit()