Skip to content

Commit

Permalink
fix spatial metric first sample disappearing
Browse files Browse the repository at this point in the history
  • Loading branch information
ycao6928 committed Nov 23, 2023
1 parent 0478940 commit b2250e4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions R/helper_spatial_metrics.R
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ helper_L_stat_st <- function(alldata, ncores = 1) {
colnames(temp) <- make.names(colnames(temp), unique = TRUE)
}

if (ncol(temp == 2)){
if (ncol(temp ) == 2){
temp <- temp[, -2, drop=FALSE]
}else{
rownames(temp) <- temp$rowname
Expand Down Expand Up @@ -447,7 +447,7 @@ helper_L_stat_sp <- function( alldata, ncores = 1) {



if (ncol(temp == 2)){
if (ncol(temp) == 2){
temp <- temp[, -2, drop=FALSE]
}else{
rownames(temp) <- temp$rowname
Expand Down Expand Up @@ -579,7 +579,7 @@ helper_nncorr_protein <- function(alldata, num_top_gene = NULL, ncores = 1) {
}


if (ncol(temp == 2)){
if (ncol(temp) == 2){
temp <- temp[, -2, drop=FALSE]
}else{
rownames(temp) <- temp$rowname
Expand Down Expand Up @@ -657,13 +657,13 @@ individual_moran_cor <- function(thissample) {
#' @noRd
helper_moran <- function( alldata, num_top_gene = NULL, ncores = 1) {

BPparam <- generateBPParam(ncores)
BPparam <- scFeatures:::generateBPParam(ncores)

if (is.null(num_top_gene)) {
num_top_gene <- min(nrow(alldata$data), 1500)
}

top_gene <- find_var_gene(alldata,
top_gene <- scFeatures:::find_var_gene(alldata,
num_top_gene = num_top_gene,
ncores = ncores, celltype = FALSE
)
Expand Down Expand Up @@ -713,7 +713,7 @@ helper_moran <- function( alldata, num_top_gene = NULL, ncores = 1) {
colnames(temp) <- make.names(colnames(temp), unique = TRUE)
}

if (ncol(temp == 2)){
if (ncol(temp) == 2){
temp <- temp[, -2, drop=FALSE]
}else{
rownames(temp) <- temp$rowname
Expand Down

0 comments on commit b2250e4

Please sign in to comment.