Skip to content
Snippets Groups Projects
Commit fe46d1d6 authored by Anthony Sonrel's avatar Anthony Sonrel
Browse files

ascend .5

parent fac1f70c
No related branches found
No related tags found
No related merge requests found
......@@ -336,3 +336,4 @@ tags
.renku.lock
.renku/tmp
.renku/cache
.Rproj.user
......@@ -7,6 +7,10 @@
Ascend clustering method from https://academic.oup.com/gigascience/article/8/8/giz087/5554286
Problem with newest version fom https://github.com/powellgenomicslab/ascend
runPCA doesn't work, even on their own example dataset: `unable to find an inherited method for function ‘int_colData’ for signature ‘"NULL"’`
## Method template
This template will help you to add a method to an omnibenchmark project. For each method that you have, **one dedicated repository** has to be created from this template to upload the method on the renku system.
......
......@@ -18,6 +18,6 @@ bioconductor_packages <- c("BiocParallel", "BiocGenerics",
"GenomeInfoDbData")
BiocManager::install(bioconductor_packages)
devtools::install_github("powellgenomicslab/ascend")
# devtools::install_github("powellgenomicslab/ascend") #final version
devtools::install_github("IMB-Computational-Genomics-Lab/ascend", ref = "b415c0918f10306829b64bfad37f5d08da049ef7") #v0.5 as in Duo et al.
......@@ -2,7 +2,16 @@
## ------------------------------ Ascend clustering ------------------------------------------ ##
### ------------------------------------------------------------------------------------------ ###
# filtered_rawcounts = "data/filter_expression/filter_expression_koh_filtered_counts.mtx.gz"
#
# meta_file = "data/filter_expression/koh_ttc_meta.json"
#
# cluster_res = "data/ascend-clustering/ascend-clustering_filter_expression_1d45b_koh__k_2__seed_12876_cluster_res.json"
#
# seed = 12876
#
# k = 2
### ------------------------------------------------------------------------------------------ ###
## -------------------------------------- Libraries ------------------------------------------ ##
......@@ -18,6 +27,7 @@ suppressPackageStartupMessages({
library(ascend)
library(BiocParallel)
library(class)
library(dplyr)
})
### ------------------------------------------------------------------------------------------ ###
......@@ -73,18 +83,33 @@ colnames(dat) <- meta$cell_id
## -------------------------------------- Method --------------------------------------------- ##
### ------------------------------------------------------------------------------------------ ###
rowdat <- data.frame("gene_names" = rownames(dat))
a <- SingleCellExperiment(list(counts = dat))
em_set <- EMSet(a,
colInfo = meta,
rowInfo = rowdat)
normset <- normaliseByRLE(em_set)
pcaset <- runPCA(normset) ##
pcaset <- ReduceDimensions(pcaset, n = params$nPC)
library(ascend)
data(raw_set)
EMSet <- raw_set
set.seed(seed)
sce <- SingleCellExperiment(assays = list(counts = as.matrix(dat)))
dat <- counts(sce)
emset <- NewEMSet(ExpressionMatrix = dat)
normset <- NormaliseByRLE(emset)
pcaset <- RunPCA(normset)
colnames(dat) <- meta$cell_id
rownames(dat) <- paste0("gene", 1:nrow(dat))
meta$cell_barcode <- paste0("cell:", 1:ncol(dat))
meta <- meta %>%
select(cell_barcode, everything())
emset <- EMSet(x = dat)
normset <- normaliseByRLE(emset)
pcaset <- runPCA(normset) ##
pcaset <- ReduceDimensions(pcaset, n = params$nPC)
## Try to cluster all cells. If it fails (if there are outliers), cluster
## the ones that can be clustered and assign the remaining ones to a
## cluster with kNN on the extracted PCs.
resset <- RunCORE(pcaset, conservative = TRUE, nres = 40,
resset <- runCORE(pcaset, conservative = TRUE, nres = 40,
remove_outlier = TRUE)
## Select the height to use
ks <- resset@Clusters$KeyStats
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment