Skip to content
Snippets Groups Projects
Commit 26000796 authored by Jeffrey Pullin's avatar Jeffrey Pullin
Browse files

Add code to run smash method

parent 686c7b24
Branches
Tags
No related merge requests found
......@@ -14,3 +14,5 @@ weights
NSForest/*.csv
benchmarks
figures
smash-fork/*
......@@ -142,7 +142,7 @@ method_pars_data <- list(
random_pars,
logfc_pars,
glmgampoi_pars,
#smash_pars,
smash_pars,
nsforest_pars,
cepo_pars,
cosg_pars
......
......@@ -13,9 +13,15 @@ run_smash <- function(sce, pars) {
Sys.setenv(RETICULATE_PYTHON = "/home/jpullin/.conda/envs/mage/bin/python")
library(reticulate)
old_wd <- getwd()
# Needed for the import statement below to work
smashpy_path <- here::here("smash-fork")
setwd(smashpy_path)
# IPython and cuda errors seem spurious.
sm <- import("smashpy")
sm <- sm$smashpy()
smashpy <- py_run_string("from smashpy import *")
sm <- smashpy$smashpy()
# Needed for AnnData conversion.
sc <- import("scanpy")
......@@ -50,8 +56,15 @@ run_smash <- function(sce, pars) {
pct1 = 0.75, pct2 = 0.5)
# Inverse PCA to remove unimportant genes
adata <- sm$scale_filter_features(adata, n_components = NULL,
# Note: For a small number of simulated datasets this function errors,
# likely dues to oddness of the simulated data. Therefore, for those
# datasets we skip this step.
tryCatch({
adata <- sm$scale_filter_features(adata, n_components = NULL,
filter_expression = TRUE)
},
error = function(e) e
)
# Run deep neural network to locate optimal markers for classification of
# cells according to the original user annotations
......@@ -92,5 +105,7 @@ run_smash <- function(sce, pars) {
validate_mgs_result(result)
setwd(old_wd)
list(time = time, result = result, raw_result = raw_cluster_mgs, pars = pars)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment