tk382 / HIPPO

Heterogeneity Induced Pre-Processing tOol
18 stars 5 forks source link

Segment fault when running running hippo #14

Closed urwahnawaz closed 3 years ago

urwahnawaz commented 4 years ago

Hi guys,

I'm trying to run hippo on my own data but apparently I keep getting this error message:

 *** caught segfault ***
address 0x7f07e2311440, cause 'memory not mapped'

Traceback:
 1: .Call(dgeMatrix_colsums, x, na.rm, FALSE, TRUE)
 2: .local(x, na.rm, dims, ...)
 3: rowMeans(x = x)
 4: rowMeans(x = x)
 5: eval(call, parent.frame())
 6: eval(call, parent.frame())
 7: callGeneric()
 8: .local(x, na.rm, dims, ...)
 9: Matrix::rowMeans(X == 0)
10: Matrix::rowMeans(X == 0)
11: data.frame(gene = rownames(X), gene_mean = Matrix::rowMeans(X),     zero_proportion = Matrix::rowMeans(X == 0))
12: preprocess_heterogeneous(subX)
13: hippo_one_level(subX, feature_method = feature_method, clustering_method = clustering_method,     z_threshold = z_threshold, deviance_threshold = deviance_threshold,     km_num_embeds = km_num_embeds, km_nstart = km_nstart, km_iter.max = km_iter.max,     sc3_n_cores = sc3_n_cores)
14: hippo(sce, feature_method = "zero_inflation", clustering_method = "kmeans",     K = 3, outlier_proportion = 1e-05)
An irrecoverable exception occurred. R is aborting now ...
Segmentation fault (core dumped)

This is the command I'm running:

sce = hippo(sce, 
            feature_method = "zero_inflation",
            clustering_method = "kmeans",
            K = 3, 
            outlier_proportion = 0.00001)

and this is what my sce looks like:


> sce
class: SingleCellExperiment 
dim: 27549 89983 
metadata(0):
assays(1): counts
rownames(27549): RP11-34P13.7 AL627309.1 ... AP001465.5 AP000282.3
rowData names(0):
colnames(89983): AAACCTGAGCGACGTA-1_1_1_1_1_1_1 AAACCTGCACACGCTG-1_1_1_1_1_1_1 ...
  TTTGTTGCAGGCTACC-1_2 TTTGTTGTCACCATGA-1_2
colData names(0):
reducedDimNames(0):
spikeNames(0):
altExpNames(0):

Any help would be greatly appreciated! Thanks in advance

Japrin commented 3 years ago

The matrix is too large, so Matrix::rowMeans(X == 0) give rise the error. Here, X is a large sparse matrix (dgCMatrix). X == 0 will give you a dense logical matrix object (lgeMatrix) while X > 0 will give you a sparse logical matrix object (lgCMatrix). The Matrix cannot process too large dense logical matrix. To fix this problem, you can chang the code:

zero_proportion = Matrix::rowMeans(X == 0)

to: zero_proportion = 1-Matrix::rowSums(X > 0)/ncol(X)

tk382 commented 3 years ago

Implemented the suggested change.