Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Singlecell new upload #1246

Draft
wants to merge 83 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
b6c5efc
Initial setup for scRNAseq dedicated upload
zitoa Oct 29, 2024
3397aaa
wip
zitoa Oct 29, 2024
26a9d5a
wip
zitoa Oct 30, 2024
d6b8c3a
wip
zitoa Oct 30, 2024
e754e1a
wip
zitoa Oct 30, 2024
5ab9bd8
wip
zitoa Oct 30, 2024
ea324c3
wip
zitoa Oct 31, 2024
8cffe39
wip
zitoa Nov 1, 2024
d47fb66
wip
zitoa Nov 1, 2024
af0c13f
wip
zitoa Nov 1, 2024
62787d8
wip
zitoa Nov 5, 2024
3e93b3f
Merge 62787d8d86c4da4561b269c79afce496dd268cfc into 7635d27da87cccfa0…
zitoa Nov 5, 2024
fff272d
Snapshot test failed: use snapshot_review('snapshot/') (GHA)
zitoa Nov 5, 2024
4e467dc
wip
zitoa Nov 8, 2024
41c5d4b
wip
zitoa Nov 8, 2024
d3dd906
wip
zitoa Nov 10, 2024
a14600e
wip
zitoa Nov 10, 2024
b4252f9
Merge a14600ee0c491c0282c7a81cee9f178fb0bd86d4 into 6d670c0dc28605561…
zitoa Nov 10, 2024
68fd6bc
Snapshot test failed: use snapshot_review('snapshot/') (GHA)
zitoa Nov 10, 2024
a7319f5
wip
zitoa Nov 10, 2024
b560f04
wip
zitoa Nov 10, 2024
a8847a5
Merge b560f04021b24751e9abe30f0463e721102dc09e into 6d670c0dc28605561…
zitoa Nov 10, 2024
84eed44
Snapshot test failed: use snapshot_review('snapshot/') (GHA)
zitoa Nov 10, 2024
d9a3e57
wip
zitoa Nov 13, 2024
d0f0c66
Merge d9a3e57c54fd7483a31ae7ca25311055e1a7fa4b into fe938a4bdfb1218c8…
zitoa Nov 13, 2024
33a7015
Snapshot test failed: use snapshot_review('snapshot/') (GHA)
zitoa Nov 13, 2024
8f4b1e0
wip
zitoa Nov 15, 2024
889529b
wip
zitoa Nov 15, 2024
220f04d
wip
zitoa Nov 17, 2024
8014095
wip
zitoa Nov 19, 2024
9fcad42
wip
zitoa Nov 19, 2024
6287360
wip
zitoa Nov 19, 2024
5d6c72c
wip
zitoa Nov 19, 2024
c8b1684
wip
zitoa Nov 20, 2024
65aa75c
wip
zitoa Nov 21, 2024
86a2c9b
wip
zitoa Nov 23, 2024
e07e1f0
wip
zitoa Nov 23, 2024
5fce3d2
wip
zitoa Nov 24, 2024
5058637
wip
zitoa Nov 24, 2024
aa411d8
wip
zitoa Nov 26, 2024
7d1a286
wip
zitoa Nov 26, 2024
d135f91
wip
zitoa Nov 27, 2024
cbd479c
wip
zitoa Nov 27, 2024
432416e
wip
zitoa Nov 28, 2024
f0f8035
wip
zitoa Nov 29, 2024
9105bf8
splitmap downsample for scRNAseq
zitoa Nov 29, 2024
892cf46
new options at upload
zitoa Nov 29, 2024
289002d
new options at upload
zitoa Nov 29, 2024
dd68e67
new options at upload
zitoa Nov 29, 2024
129bd00
wip
zitoa Dec 2, 2024
a27c48a
adjust parameters; add filters
zitoa Dec 3, 2024
ad0a60a
fix axis
zitoa Dec 3, 2024
d35953e
adding WRS test for scRNAseq
zitoa Dec 6, 2024
b42dbc9
add WRS test
zitoa Dec 7, 2024
2dec46b
fix bugs upload
zitoa Dec 9, 2024
758270d
wip
zitoa Dec 9, 2024
a8a72ff
refactoring to avoid mem issue
zitoa Dec 11, 2024
02b0bfe
splitby phenotype default in cluster samples
zitoa Dec 12, 2024
2731f2c
wip
zitoa Dec 13, 2024
ffa581f
remove shinyreactive, improve speed and efficiency
zitoa Dec 13, 2024
65f168f
wip
zitoa Dec 13, 2024
f9c58bd
add sc_settings
zitoa Dec 14, 2024
a0183a8
wip
zitoa Dec 20, 2024
585f04f
temp disable sc_settings_list & make available wrs for all datatypes
zitoa Jan 5, 2025
969d746
add sc parameters list
zitoa Jan 7, 2025
974f975
add sc parameters list
zitoa Jan 7, 2025
847d531
rm celltype deconv method for scRNAseq
zitoa Jan 8, 2025
6b93b2e
add Compute supercells options
zitoa Jan 9, 2025
e1bfe64
add Compute supercells options
zitoa Jan 9, 2025
95a40ae
polishing code
zitoa Jan 9, 2025
736315f
polishing code
zitoa Jan 9, 2025
cb55b74
polish
zitoa Jan 10, 2025
08bd0ca
computesupercells as boolean
zitoa Jan 13, 2025
d038929
polishing
zitoa Jan 13, 2025
ac27523
polishing
zitoa Jan 13, 2025
3fafc53
polishing
zitoa Jan 13, 2025
4a4d137
azimuth-celltypes-always
zitoa Jan 13, 2025
1617478
adjust nFeatureRNA filters
zitoa Jan 14, 2025
8fc1068
remove GSVA
zitoa Jan 14, 2025
b33e983
add option to regress covs
zitoa Jan 16, 2025
fd37a5a
remove ttest.welch as default
zitoa Jan 16, 2025
45582f9
add covariates to sc_compute_settings
zitoa Jan 16, 2025
f5fd997
do.supercells as a boolean
zitoa Jan 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion bin/pgxcreate_op.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ pgx <- playbase::pgx.createPGX(
norm_method = params$norm_method,
samples = params$samples,
contrasts = params$contrasts,
azimuth_ref = params$azimuth_ref, ## NEW AZ
## sc_pheno = params$sc_pheno, ## NEW AZ
name = params$name,
datatype = params$datatype,
probe_type = params$probe_type,
Expand All @@ -47,7 +49,8 @@ pgx <- playbase::pgx.createPGX(
convert.hugo = params$convert.hugo,
custom.geneset = params$custom.geneset,
max.genesets = params$max.genesets,
annot_table = params$annot_table
annot_table = params$annot_table,
sc_compute_settings = params$sc_compute_settings ## NEW AZ
)

message("[create PGX process] : PGX created successfully")
Expand Down
70 changes: 32 additions & 38 deletions components/board.clustering/R/clustering_plot_splitmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,33 @@ clustering_plot_splitmap_server <- function(id,
})

plot_data <- shiny::reactive({
## ComplexHeatmap based splitted heatmap ##########

filt <- getTopMatrix()
shiny::req(filt)

zx <- filt$mat
annot <- filt$annot
zx.idx <- filt$idx

## For large scRNAseq data
if (ncol(zx) > 3000) {
dbg("[clustering_plot_splitmap] More than 3K samples detected in data matrix.")
dbg("[clustering_plot_splitmap] Balanced downsampling of 40 cells per celltype.")
grp <- annot$celltype
sel <- tapply(1:ncol(zx), grp, function(ii) head(sample(ii), 40))
ii <- unname(unlist(sel))
zx <- zx[, ii]
annot <- annot[colnames(zx), , drop = FALSE]
filt$mat <- zx
filt$annot <- annot
filt$samples <- colnames(zx)
}

shiny::validate(shiny::need(
ncol(zx) > 1, "Filtering too restrictive. Please change 'Filter samples' settings."
))

sel <- selected_phenotypes()

return(list(
zx = zx,
annot = annot,
Expand All @@ -124,55 +138,48 @@ clustering_plot_splitmap_server <- function(id,
})

base_splitmap.RENDER <- function() {
## extract from plot data
pd <- plot_data()
zx <- pd[["zx"]]
annot <- pd[["annot"]]
zx.idx <- pd[["zx.idx"]]
filt <- pd[["filt"]]

if (nrow(zx) <= 1) {
return(NULL)
}

if (nrow(zx) <= 1) { return(NULL) }
show_rownames <- TRUE
if (nrow(zx) > 100) show_rownames <- FALSE
if (nrow(zx) > 100) { show_rownames <- FALSE }

cex1 <- ifelse(ncol(zx) > 50, 0.75, 1)
cex1 <- ifelse(ncol(zx) > 100, 0.5, cex1)
cex1 <- ifelse(ncol(zx) > 200, 0, cex1)

scale.mode <- "none"
if (hm_scale() == "relative") scale.mode <- "row.center"
if (hm_scale() == "BMC") scale.mode <- "row.bmc"
if (hm_scale() == "relative") { scale.mode <- "row.center" }
if (hm_scale() == "BMC") { scale.mode <- "row.bmc" }
scale.mode

## split genes dimension in 5 groups
splity <- 5
splity <- 6
if (!is.null(zx.idx)) splity <- zx.idx
if (!is.null(zx.idx)) { splity <- zx.idx }

## split samples
splitx <- NULL
splitx <- filt$grp

show_legend <- show_colnames <- TRUE
show_legend <- input$hm_legend
if (hm_level() == "geneset" || !is.null(splitx)) show_legend <- FALSE
if (hm_level() == "geneset" || !is.null(splitx)) { show_legend <- FALSE }

show_colnames <- (input$hm_cexCol != 0)

rownames(zx) <- sub("HALLMARK:HALLMARK_", "HALLMARK:", rownames(zx))
rownames(zx) <- gsub(playdata::GSET_PREFIX_REGEX, "", rownames(zx))
rownames(zx) <- substring(rownames(zx), 1, 50) ## cut long names...
if (hm_level() == "gene") {
## strip any prefix
rownames(zx) <- sub(".*:", "", rownames(zx))

rownames(zx) <- playbase::probe2symbol(rownames(zx), pgx$genes, labeltype(), fill_na = TRUE)
}

if (hm_level() == "geneset") rownames(zx) <- tolower(rownames(zx))
if (hm_level() == "geneset") { rownames(zx) <- tolower(rownames(zx)) }

cex2 <- ifelse(nrow(zx) > 60, 0.8, 0.9)
cex1 <- as.numeric(input$hm_cexCol) * 0.85
Expand All @@ -183,14 +190,13 @@ clustering_plot_splitmap_server <- function(id,
totnchar <- nchar(paste0(unique(splitx), collapse = ""))
totnchar
nx <- length(unique(splitx))
if (!is.null(splitx) & (totnchar > 44 || nx >= 6)) crot <- 90

if (!is.null(splitx) & (totnchar > 44 || nx >= 6)) { crot <- 90 }
nrownames <- 60
nrownames <- 9999
if (input$hm_cexRow == 0) nrownames <- 0
if (input$hm_cexRow == 0) { nrownames <- 0 }

shiny::showNotification("Rendering heatmap...")

playbase::gx.splitmap(
zx,
split = splity, splitx = splitx,
Expand All @@ -207,25 +213,18 @@ clustering_plot_splitmap_server <- function(id,
)
p <- grDevices::recordPlot()
p

# plt
}

plotly_splitmap.RENDER_get <- function() {
## iHeatmap based splitted heatmap #########

shiny::req(pgx$genes)

## -------------- variable to split samples
scale <- "none"
if (hm_scale() == "relative") scale <- "row.center"
if (hm_scale() == "BMC") scale <- "row.bmc"
if (hm_scale() == "relative") { scale <- "row.center" }
if (hm_scale() == "BMC") { scale <- "row.bmc" }

plt <- NULL

## extract from plot data
pd <- plot_data()

filt <- pd[["filt"]]
X <- pd[["zx"]]
annot <- pd[["annot"]]
Expand Down Expand Up @@ -261,7 +260,6 @@ clustering_plot_splitmap_server <- function(id,
}
tooltips <- sapply(rownames(X), getInfo)
labeled_features <- NULL

rownames(X) <- playbase::probe2symbol(rownames(X), pgx$genes, labeltype(), fill_na = TRUE)
} else {
aa <- gsub("_", " ", rownames(X)) ## just geneset names
Expand Down Expand Up @@ -290,20 +288,16 @@ clustering_plot_splitmap_server <- function(id,
plt <- plotly::as_widget(plt)
}
plt <- plt %>%
plotly::layout(
margin = list(l = 10, r = 5, t = 5, b = 5)
)
plotly::layout(margin = list(l = 10, r = 5, t = 5, b = 5))
return(plt)
}

plot_grid <- list(
list(plotlib = "plotly", func = plotly_splitmap.RENDER, card = 1),
list(plotlib = "base", func = base_splitmap.RENDER, card = 2)
)

plot_data_csv <- function() {
plotly_splitmap.RENDER_get()$X
}

plot_data_csv <- function() { plotly_splitmap.RENDER_get()$X }

lapply(plot_grid, function(x) {
PlotModuleServer(
Expand Down
10 changes: 9 additions & 1 deletion components/board.clustering/R/clustering_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,15 @@ ClusteringBoard <- function(id, pgx, labeltype = shiny::reactive("feature")) {
shiny::updateRadioButtons(session, "hm_splitby", selected = "none")
})

## NEW AZ
shiny::observeEvent(pgx, {
shiny::req(pgx$datatype)
datatype <- pgx$datatype
if (datatype %in% c("scRNA-seq","scRNAseq")) {
shiny::updateRadioButtons(session, "hm_splitby", selected = "phenotype")
}
})

## ===================================================================================
## ============================= REACTIVES ===========================================
## ===================================================================================
Expand Down Expand Up @@ -339,7 +348,6 @@ ClusteringBoard <- function(id, pgx, labeltype = shiny::reactive("feature")) {
input$hm_ntop
)


##' .. content for \description{} (no empty lines) ..
##'
##' .. content for \details{} ..
Expand Down
Loading