Closed stemangiola closed 1 year ago
I should specify that all backhand functions have been transferred to the functions.R file (so automatically imported by cellsig on loading) rather than the custom file within the dev directory.
So we should fix those functions within the functions.R.
The code in the vignette "bayes" I am trying to run is
# Select only leaves
cell_types = data.tree::as.Node(yaml::read_yaml(here("dev/tree_kamran.yaml")))$leaves %>% purrr::map(~ .x$name) %>% as.character()
# Get data
bayes_quantiles = readRDS(here("dev/modeling_results/counts_bayes.rds")) %>% dplyr::filter(cell_type %in% cell_types) %>% rename(symbol=.feature)
counts = readRDS(here("dev/counts.rds")) %>% dplyr::filter(cell_type %in% cell_types)
library(tidybulk)
library(tidySummarizedExperiment)
feature_selected = counts %>%
# Get markers
markers_from_transcription_abundance_quantiles(
.sample = sample,
.symbol = symbol,
.count= count,
.cell_type = cell_type,
quantile_dataset = bayes_quantiles,
lower_quantile = `10%`,
upper_quantile = `90%`,
contrast_method = pairwise_contrast,
selection_method = "silhouette",
reduction_method = "PCA",
dims=2,
discard_number = 10,
optimisation_method = "penalty",
is_complete = TRUE
)
Hi @stemangiola,
Sorry for the delayed reply.
It's because the Bayes_quantile file requires a sample column. As the direct output of your bayes run doesn't have that sample column. I run by creating a pseudo-sample column.
bayes_quantiles = readRDS(here("dev/modeling_results/counts_bayes.rds")) %>%
dplyr::filter(cell_type %in% cell_types) %>%
rename(symbol=.feature) %>%
mutate(id = "sample", sample = cell_type) %>%
unite(sample, id, sample, sep = "_")
Thanks,
yes I understand. But the user should now have to do this explicitly, but this should be done in the backend.
Hi @stemangiola ,
Sorry, my bad! I wasn't sure if the bayes quantile output will always miss the sample column.
I've implemented the sample column generation in the backend. Please merge Kamran
branch for the updated function.
Now, no need to rename .feature
column header and manual addition of sample column is also not needed anymore.
Just load bayes_quantile file as follows-
bayes_quantiles = readRDS(here("dev/jian_R_files/test_count_bayes.rds"))
So, the Bayes_quantile file should have at least four columns- gene symbol/feature
, cell_type
, lower_quantile
and upper_quantile
Obsolete
Hello @Kamran-Khan96,
I have a Bayes quantiles as such
But I get this error
sample
not found in.data
. quantiles should not be forced to have sample column, could you please solve this in the backend.This is the code that generated the error
I would like this to work