Nanostring-Biostats / InSituType

An R package for performing cell typing in SMI and other single cell data
Other
26 stars 10 forks source link

bug: insituteType error in match argument #120

Closed lidanwu closed 2 years ago

lidanwu commented 2 years ago

I encountered an error when running insitutype()for supervised cell typing on dataset of single slide.

load("~/hsdata/2021_Data/GeminiAnalysis/Scribe_team/SMI_tertiary/R4614_MN1K_wholeB/results/complete_giotto_object.RData")
supRes <- insitutype(counts = Matrix::t(Giotto:::get_expression_values(gem, 'rna', 'raw')),
                         neg = Matrix::rowMeans(Matrix::t(Giotto:::get_expression_values(gem, 'negprobes', 'raw'))),
                   init_clust = NULL, 
                   n_clusts = 0, 
                   fixed_profiles = refProfiles,
                   anchors = NULL)  

Error message showed up after 10 random starts within phase 1, but It's uncler whether it happens on L203 or L216 of runinstituetype():

automatically selecting anchor cells with the best fits to fixed profiles
The following genes in the count data are missing from fixed_profiles and will be omitted from anchor selection: GRK3,H2-EA,COP1,6330403K07RIK,SELENOW,SEM1,LEP,H2-AB1,CLEC7A,GALR3,FPR3,PRKN,H2-AA,SCN2A,NLGN4L,4930486L24RIK
The following cell types had too few anchors and so are being removed from consideration: SER, OBINH, TLC, PEP, MSND1, MSND2, MSN, OEC, HYPEN
clustering all cells
phase 1: random starts in 5000 cell subsets
12.05 cells per geometric bin.
12.05 cells per geometric bin.
12.05 cells per geometric bin.
12.05 cells per geometric bin.
12.05 cells per geometric bin.
12.05 cells per geometric bin.
12.05 cells per geometric bin.
12.05 cells per geometric bin.
12.05 cells per geometric bin.
12.05 cells per geometric bin.
1.85 cells per geometric bin.
iter 1
iter 2
iter 3
Converged: <= 0.01% of cell type assignments changed in the last iteration.
==========================================================================
.....
==========================================================================
iter 1
iter 2
iter 3
Converged: <= 0.01% of cell type assignments changed in the last iteration.
==========================================================================
Error in match.arg(method) : 'arg' must be of length 1
In addition: Warning messages:
1: In get(object, envir = currentEnv, inherits = TRUE) :
  restarting interrupted promise evaluation
2: In get(object, envir = currentEnv, inherits = TRUE) :
  restarting interrupted promise evaluation
3: In get(object, envir = currentEnv, inherits = TRUE) :
  restarting interrupted promise evaluation
4: In get(object, envir = currentEnv, inherits = TRUE) :
  restarting interrupted promise evaluation
5: In get(object, envir = currentEnv, inherits = TRUE) :
  restarting interrupted promise evaluation
6: In get(object, envir = currentEnv, inherits = TRUE) :
  restarting interrupted promise evaluation
Called from: match.arg(method)
Browse[1]> arg
[1] "auto"  "shell" "radix"
Browse[1]> choices
NULL
patrickjdanaher commented 2 years ago

It's possible this is a one-off server error.

lidanwu commented 2 years ago

@patrickjdanaher, I encountered a different error when running big dataset with insitutype()and there's session error message before the error associated with insitutype(). It seems like the current insitutype() is not working on dataset of 80k cells. The script I ran after finding anchor cells using find_anchor_cells():

semiSupRes <- insitutype(counts = Matrix::t(Giotto:::get_expression_values(gem, 'rna', 'raw')),
                         neg = Matrix::rowMeans(Matrix::t(Giotto:::get_expression_values(gem, 'negprobes', 'raw'))),
                         init_clust = NULL, 
                         n_clusts = config_nbclust$n_clusts, 
                         fixed_profiles = refProfiles,
                         anchors = anchors)  

error message showed up at step: image

log and error message in console:

clustering all cells
phase 1: random starts in 5000 cell subsets
17.7 cells per geometric bin.
17.7 cells per geometric bin.
17.7 cells per geometric bin.
2022-04-05T19:40:18.536393Z [rsession-rstudio] ERROR offlineConnectionMatcher: ignoring connection received in the future; LOGGED FROM: bool rstudio::session::offlineConnectionMatcher(rstudio_boost::shared_ptr<rstudio::session::HttpConnection>, std::chrono::_V2::steady_clock::time_point) src/cpp/session/SessionOfflineService.cpp:130
2022-04-05T19:40:18.536438Z [rsession-rstudio] ERROR offlineConnectionMatcher: ignoring connection received in the future; LOGGED FROM: bool rstudio::session::offlineConnectionMatcher(rstudio_boost::shared_ptr<rstudio::session::HttpConnection>, std::chrono::_V2::steady_clock::time_point) src/cpp/session/SessionOfflineService.cpp:130
2022-04-05T19:40:18.536448Z [rsession-rstudio] ERROR offlineConnectionMatcher: ignoring connection received in the future; LOGGED FROM: bool rstudio::session::offlineConnectionMatcher(rstudio_boost::shared_ptr<rstudio::session::HttpConnection>, std::chrono::_V2::steady_clock::time_point) src/cpp/session/SessionOfflineService.cpp:130
2022-04-05T19:40:20.499245Z [rsession-rstudio] ERROR R.getOption: rstudio.errors.suppressed made from non-main thread; LOGGED FROM: SEXPREC* rstudio::r::options::getOption(const string&) src/cpp/r/ROptions.cpp:83
2022-04-05T19:40:20.499416Z [rsession-rstudio] ERROR evaluateExpression called from thread other than main; LOGGED FROM: rstudio::core::Error rstudio::r::exec::{anonymous}::evaluateExpressionsUnsafe(SEXP, SEXP, SEXPREC**, rstudio::r::sexp::Protect*, rstudio::r::exec::{anonymous}::EvalType) src/cpp/r/RExec.cpp:140
2022-04-05T19:40:20.499524Z [rsession-rstudio] ERROR R.getOption: rstudio.errors.suppressed made from non-main thread; LOGGED FROM: SEXPREC* rstudio::r::options::getOption(const string&) src/cpp/r/ROptions.cpp:83
2022-04-05T19:40:20.499551Z [rsession-rstudio] ERROR evaluateExpression called from thread other than main; LOGGED FROM: rstudio::core::Error rstudio::r::exec::{anonymous}::evaluateExpressionsUnsafe(SEXP, SEXP, SEXPREC**, rstudio::r::sexp::Protect*, rstudio::r::exec::{anonymous}::EvalType) src/cpp/r/RExec.cpp:140
2022-04-05T19:40:20.722376Z [rsession-rstudio] ERROR R.getOption: rstudio.errors.suppressed made from non-main thread; LOGGED FROM: SEXPREC* rstudio::r::options::getOption(const string&) src/cpp/r/ROptions.cpp:83
2022-04-05T19:40:20.722464Z [rsession-rstudio] ERROR evaluateExpression called from thread other than main; LOGGED FROM: rstudio::core::Error rstudio::r::exec::{anonymous}::evaluateExpressionsUnsafe(SEXP, SEXP, SEXPREC**, rstudio::r::sexp::Protect*, rstudio::r::exec::{anonymous}::EvalType) src/cpp/r/RExec.cpp:140
2022-04-05T19:40:20.922611Z [rsession-rstudio] ERROR R.getOption: rstudio.errors.suppressed made from non-main thread; LOGGED FROM: SEXPREC* rstudio::r::options::getOption(const string&) src/cpp/r/ROptions.cpp:83
2022-04-05T19:40:20.922674Z [rsession-rstudio] ERROR evaluateExpression called from thread other than main; LOGGED FROM: rstudio::core::Error rstudio::r::exec::{anonymous}::evaluateExpressionsUnsafe(SEXP, SEXP, SEXPREC**, rstudio::r::sexp::Protect*, rstudio::r::exec::{anonymous}::EvalType) src/cpp/r/RExec.cpp:140
2022-04-05T19:40:21.122876Z [rsession-rstudio] ERROR R.getOption: rstudio.errors.suppressed made from non-main thread; LOGGED FROM: SEXPREC* rstudio::r::options::getOption(const string&) src/cpp/r/ROptions.cpp:83
2022-04-05T19:40:21.122946Z [rsession-rstudio] ERROR evaluateExpression called from thread other than main; LOGGED FROM: rstudio::core::Error rstudio::r::exec::{anonymous}::evaluateExpressionsUnsafe(SEXP, SEXP, SEXPREC**, rstudio::r::sexp::Protect*, rstudio::r::exec::{anonymous}::EvalType) src/cpp/r/RExec.cpp:140
2022-04-05T19:40:21.323157Z [rsession-rstudio] ERROR R.getOption: rstudio.errors.suppressed made from non-main thread; LOGGED FROM: SEXPREC* rstudio::r::options::getOption(const string&) src/cpp/r/ROptions.cpp:83
2022-04-05T19:40:21.323230Z [rsession-rstudio] ERROR evaluateExpression called from thread other than main; LOGGED FROM: rstudio::core::Error rstudio::r::exec::{anonymous}::evaluateExpressionsUnsafe(SEXP, SEXP, SEXPREC**, rstudio::r::sexp::Protect*, rstudio::r::exec::{anonymous}::EvalType) src/cpp/r/RExec.cpp:140
2022-04-05T19:40:21.523435Z [rsession-rstudio] ERROR R.getOption: rstudio.errors.suppressed made from non-main thread; LOGGED FROM: SEXPREC* rstudio::r::options::getOption(const string&) src/cpp/r/ROptions.cpp:83
2022-04-05T19:40:21.523497Z [rsession-rstudio] ERROR evaluateExpression called from thread other than main; LOGGED FROM: rstudio::core::Error rstudio::r::exec::{anonymous}::evaluateExpressionsUnsafe(SEXP, SEXP, SEXPREC**, rstudio::r::sexp::Protect*, rstudio::r::exec::{anonymous}::EvalType) src/cpp/r/RExec.cpp:140
2022-04-05T19:40:21.723708Z [rsession-rstudio] ERROR R.getOption: rstudio.errors.suppressed made from non-main thread; LOGGED FROM: SEXPREC* rstudio::r::options::getOption(const string&) src/cpp/r/ROptions.cpp:83
2022-04-05T19:40:21.723777Z [rsession-rstudio] ERROR evaluateExpression called from thread other than main; LOGGED FROM: rstudio::core::Error rstudio::r::exec::{anonymous}::evaluateExpressionsUnsafe(SEXP, SEXP, SEXPREC**, rstudio::r::sexp::Protect*, rstudio::r::exec::{anonymous}::EvalType) src/cpp/r/RExec.cpp:140
Error in FUN(newX[, i], ...) : '...' used in an incorrect context
2022-04-05T19:40:21.923985Z [rsession-rstudio] ERROR R.getOption: rstudio.errors.suppressed made from non-main thread; LOGGED FROM: SEXPREC* rstudio::r::options::getOption(const string&) src/cpp/r/ROptions.cpp:83
2022-04-05T19:40:21.924042Z [rsession-rstudio] ERROR evaluateExpression called from thread other than main; LOGGED FROM: rstudio::core::Error rstudio::r::exec::{anonymous}::evaluateExpressionsUnsafe(SEXP, SEXP, SEXPREC**, rstudio::r::sexp::Protect*, rstudio::r::exec::{anonymous}::EvalType) src/cpp/r/RExec.cpp:140
Called from: FUN(newX[, i], ...)
patrickjdanaher commented 2 years ago

This might have failed because of a server error, or perhaps because it was sparse matrices, not matrices used.

Takeaway: insitutype should accept diverse matrix types.

patrickjdanaher commented 2 years ago

Under the conclusion that this arose from the matrix type being input, closing this issue and opening a new one asking for the necessary fix.