You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to integrate several samples with scVI within an R environment, I'm running into an error that I'm pretty stumped about: "Error in py_call_impl(callable, call_args$unnamed, call_args$named) :
TypeError: Cannot cast scalar from dtype('float64') to dtype('int64') according to the rule 'safe'"
# merging together several seurat objects stored as .rds filesmerged_srt<- merge(x=rds_vector[[1]], y=rds_vector[-1], merge.data=TRUE)
# second step of mergemerged_srt[["RNA"]] <- JoinLayers(merged_srt[["RNA"]])
# Identify genes that are expressed in at least 3 cellsgenes_to_keep<- rowSums(merged_srt[["RNA"]]$counts>0) >=3# remove non-expressed genesmerged_srt<- subset(merged_srt, features= names(genes_to_keep)[genes_to_keep])
merged_srt<- NormalizeData(merged_srt)
merged_srt<- FindVariableFeatures(merged_srt, selection.method="vst", nfeatures=2000)
top2k<- head(VariableFeatures(merged_srt), 2000)
merged_srt_2k<-merged_srt[top2k]
merged_srt_2k_new<-merged_srt_2k#convert seurat v5 to v3/v4merged_srt_2k_new[["RNA"]] <- as(object=merged_srt_2k[["RNA"]], Class="Assay")
# convert to adata objectadata<-sceasy::convertFormat(merged_srt_2k_new,
from="seurat",
to="anndata",
main_layer="data",
transfer_layer="counts",
drop_single_values=FALSE)
scvi$model$SCVI$setup_anndata(adata,
layer="counts",
batch_key='study_id')
model=scvi$model$SCVI(adata)
model$train()
Error output
GPU available: True (cuda), used: True
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
HPU available: False, using: 0 HPUs
Error in py_call_impl(callable, call_args$unnamed, call_args$named) :
TypeError: Cannot cast scalar from dtype('float64') to dtype('int64') according to the rule 'safe'
Run `reticulate::py_last_error()` for details.
> reticulate::py_last_error()
── Python Exception Message ──────────────────────────────────────────────────────────────────────────────────────────────────────────
Traceback (most recent call last):
File "_mt19937.pyx", line 180, in numpy.random._mt19937.MT19937._legacy_seedingTypeError: 'float' object cannot be interpreted as an integer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/n/home01/jdownie/.conda/envs/scvi-env/lib/python3.9/site-packages/scvi/model/base/_training_mixin.py", line 143, in trainreturn runner()
File "/n/home01/jdownie/.conda/envs/scvi-env/lib/python3.9/site-packages/scvi/train/_trainrunner.py", line 98, in __call__self.trainer.fit(self.training_plan, self.data_splitter)
File "/n/home01/jdownie/.conda/envs/scvi-env/lib/python3.9/site-packages/scvi/train/_trainer.py", line 219, in fitsuper().fit(*args, **kwargs)
File "/n/home01/jdownie/.conda/envs/scvi-env/lib/python3.9/site-packages/lightning/pytorch/trainer/trainer.py", line 544, in fit
call._call_and_handle_interrupt(
File "/n/home01/jdownie/.conda/envs/scvi-env/lib/python3.9/site-packages/lightning/pytorch/trainer/call.py", line 44, in _call_and_handle_interruptreturn trainer_fn(*args, **kwargs)
File "/n/home01/jdownie/.conda/envs/scvi-env/lib/python3.9/site-packages/lightning/pytorch/trainer/trainer.py", line 580, in _fit_implself._run(model, ckpt_path=ckpt_path)
File "/n/home01/jdownie/.conda/envs/scvi-env/lib/python3.9/site-packages/lightning/pytorch/trainer/trainer.py", line 950, in _run
call._call_setup_hook(self) # allow user to setup lightning_module in accelerator environment
File "/n/home01/jdownie/.conda/envs/scvi-env/lib/python3.9/site-packages/lightning/pytorch/trainer/call.py", line 92, in _call_setup_hook
_call_lightning_datamodule_hook(trainer, "setup", stage=fn)
File "/n/home01/jdownie/.conda/envs/scvi-env/lib/python3.9/site-packages/lightning/pytorch/trainer/call.py", line 179, in _call_lightning_datamodule_hookreturn fn(*args, **kwargs)
File "/n/home01/jdownie/.conda/envs/scvi-env/lib/python3.9/site-packages/scvi/dataloaders/_data_splitting.py", line 132, in setup
random_state = np.random.RandomState(seed=settings.seed)
File "numpy/random/mtrand.pyx", line 185, in numpy.random.mtrand.RandomState.__init__
File "_mt19937.pyx", line 168, in numpy.random._mt19937.MT19937._legacy_seeding
File "_mt19937.pyx", line 188, in numpy.random._mt19937.MT19937._legacy_seedingTypeError: Cannot cast scalar from dtype('float64') to dtype('int64') according to the rule 'safe'
── R Traceback ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
▆
1. └─model$train()
2. └─reticulate:::py_call_impl(callable, call_args$unnamed, call_args$named)
When attempting to integrate several samples with scVI within an R environment, I'm running into an error that I'm pretty stumped about: "Error in py_call_impl(callable, call_args$unnamed, call_args$named) :
TypeError: Cannot cast scalar from dtype('float64') to dtype('int64') according to the rule 'safe'"
Error output
Versions:
The text was updated successfully, but these errors were encountered: