HaojiaWu / CellScopes.jl

A Julia package for single cell and spatial data analysis
MIT License
24 stars 2 forks source link

"StackOverflowError" happened in "normalize_object" #7

Open Pedro-Pei opened 3 months ago

Pedro-Pei commented 3 months ago

Hello CellScopes team,

There was an issue when I ran the "normalize_object" function. The test data I used is an imaging-based spatial transcriptomic data downloaded from GEO (GSE227044). I'm running Julia v1.10 on MacBook. Here is the code:

genes = count_df.gene cells = string.(names(count_df)[2:end]) count_df = count_df[!, 2:end] count_df = convert(SparseMatrixCSC{Int64, Int64},Matrix(count_df)) raw_count = cs.RawCountObject(count_df, cells, genes) count_molecules.cell = string.(count_molecules.cell) count_cells.cell = string.(count_cells.cell) sham = cs.CartanaObject(count_molecules, count_cells, raw_count; prefix = "sham", min_gene = 0, min_cell = 3) sham = cs.normalize_object(sham)

Here is the traceback:

julia> sham = cs.normalize_object(sham) ERROR: StackOverflowError: Stacktrace: [1] promote_type(::Type, ::Type, ::Type, ::Type, ::Vararg{Type}) (repeats 7394 times) @ Base ./promotion.jl:299 [2] hcat(::SparseVector{…}, ::SparseVector{…}, ::SparseVector{…}, ::Vararg{…}) @ SparseArrays /Applications/Julia1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/SparseArrays/src/sparsevector.jl:1109 [3] #normalize_object#57 @ ~/.julia/packages/CellScopes/oYdMu/src/scrna/processing.jl:5 [inlined] [4] normalize_object(ct_obj::CellScopes.RawCountObject; scale_factor::Int64, norm_method::String, pseudocount::Int64) @ CellScopes ~/.julia/packages/CellScopes/oYdMu/src/scrna/processing.jl:10 [5] normalize_object @ ~/.julia/packages/CellScopes/oYdMu/src/scrna/processing.jl:9 [inlined] [6] normalize_object(sc_obj::CellScopes.CartanaObject; scale_factor::Int64, norm_method::String, pseudocount::Int64) @ CellScopes ~/.julia/packages/CellScopes/oYdMu/src/scrna/processing.jl:16 [7] normalize_object(sc_obj::CellScopes.CartanaObject) @ CellScopes ~/.julia/packages/CellScopes/oYdMu/src/scrna/processing.jl:15 [8] eval @ ./boot.jl:385 [inlined] [9] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String) @ Base ./loading.jl:2076 [10] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::@Kwargs{}) @ Base ./essentials.jl:892 [11] invokelatest(::Any, ::Any, ::Vararg{Any}) @ Base ./essentials.jl:889 [12] inlineeval(m::Module, code::String, code_line::Int64, code_column::Int64, file::String; softscope::Bool) @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.75.2/scripts/packages/VSCodeServer/src/eval.jl:263 [13] (::VSCodeServer.var"#67#72"{…})() @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.75.2/scripts/packages/VSCodeServer/src/eval.jl:181 [14] withpath(f::VSCodeServer.var"#67#72"{…}, path::String) @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.75.2/scripts/packages/VSCodeServer/src/repl.jl:274 [15] (::VSCodeServer.var"#66#71"{…})() @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.75.2/scripts/packages/VSCodeServer/src/eval.jl:179 [16] hideprompt(f::VSCodeServer.var"#66#71"{…}) @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.75.2/scripts/packages/VSCodeServer/src/repl.jl:38 [17] (::VSCodeServer.var"#65#70"{…})() @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.75.2/scripts/packages/VSCodeServer/src/eval.jl:150 [18] with_logstate(f::Function, logstate::Any) @ Base.CoreLogging ./logging.jl:515 [19] with_logger @ ./logging.jl:627 [inlined] [20] (::VSCodeServer.var"#64#69"{VSCodeServer.ReplRunCodeRequestParams})() @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.75.2/scripts/packages/VSCodeServer/src/eval.jl:255 [21] #invokelatest#2 @ ./essentials.jl:892 [inlined] [22] invokelatest(::Any) @ Base ./essentials.jl:889 [23] (::VSCodeServer.var"#62#63")() @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.75.2/scripts/packages/VSCodeServer/src/eval.jl:34 Some type information was truncated. Useshow(err)to see complete types.

I'm a fresh man to Julia and I've tried my best to solve the error which didn't work. Hope you can give me some help.

Best, Pedro

HaojiaWu commented 3 months ago

Hi @Pedro-Pei Thanks for your interest in using CellScopes. Unfortunately we have not tested CellScopes on a personal MacBook since the computing power of a MacBook is usually not enough for most imaging-based spatial data analysis. We suggest to use CellScopes on a linux server with at least 128 GB RAM. We also have not tested the old release version of Julia (such as v1.1). It is strongly advised to use CellScopes on Julia 1.7.3 or above.