- [2025-02-24]seurat V5对象转adata对象
- [2025-02-25]scenic用到的genome ranking database
- [2025-02-28]reticulate查看已安装包信息
- [2025-05-12]seurat 5.13中SketchData()提示Error in LeverageScore():! too slow
- [2025-05-13]spacexr创建reference后run.RCTD()提示每类至少25个细胞
- [2025-05-16]import spatialdata相关包时NotImplementedError: The legacy implementation is no longer supported
- [2025-05-17]在spatialdata object反卷积结果的子集中聚类
- windows下scanpy使用igraph进行leiden聚类时不停抛出ValueError: high is out of bounds for int32
[2025-02-24]seurat V5对象转adata对象
据说对于V4和之前的版本,SeuratDisk可以用,V5则要转回V3的assay。
还有另一个包SCP,里面的srt_to_adata()中,特征元信息用的变量名是meta.features,但根据这个issue,Assay5对象的特征元信息变量名也改成了meta.data,需要改一下源码里的变量名。
还有另一个问题,目前这里面转出来的adata对象的write_loom()方法有些问题,特征名样本名都没了,但write_h5ad()方法可以用。
[2025-02-25]scenic用到的genome ranking database
在这里面找就好了。
还有,先装个docker或者singularity再跑pySCENIC都比arboreto_with_multiprocessing.py要快。另外他们文档里singularity的部分写错了,按格式写就好。
[2025-02-28]reticulate查看已安装包信息
才发现也才意识到以前的不对劲,py_config()可能不会列出所有包,要用py_list_packages()。
[2025-05-12]seurat 5.13中SketchData()提示Error
in LeverageScore():! too slow
按照issue/9857,加入features = VariableFeatures(object)参数即可。
[2025-05-13]spacexr创建reference后run.RCTD()提示每类至少25个细胞
又不想再重新生成一遍,直接改reference 1
2
3
4
5
6
7
8
9
10
11type_count <- table(reference@cell_types)
filter_type <- type_count[type_count<25]
for (type in names(filter_type)) {
  filter_barcode <- names(reference@cell_types)[reference@cell_types==type]
  
  reference@cell_types <- reference@cell_types[!names(reference@cell_types) %in% filter_barcode]
  reference@counts <- reference@counts[, !colnames(reference@counts) %in% filter_barcode]
  reference@nUMI <- reference@nUMI[!names(reference@nUMI) %in% filter_barcode]
}
[2025-05-16]import
spatialdata相关包时NotImplementedError: The legacy
implementation is no longer supported
这是因为Dask的更新,根据issue/835,可以通过降级到2024.12.1版本解决。
[2025-05-17]在spatialdata object反卷积结果的子集中聚类
在SpatialData对象
此时使用的是整个
的近邻图 ,而由于反卷积是在单个bin上进行的, 在 上可能不连续,这就造成难以成簇。 
一个可行的做法是在sc.pp.neighbors时使用anndata子集然后指定key_added,并在sc.tl.leiden时指定相应neighbors_key)。
所以使用了直接导出
用GPT改的sd_subset()
这个dataset_id就是spatialdata_io.visium_hd()里的dataset_id
| 1 | def sd_subset(sdata_obj, subset_obs, subset_value_list, table_name='square_008um', shape_name='dataset_id_square_008um', link_key='location_id'): | 
导出
windows下scanpy使用igraph进行leiden聚类时不停抛出ValueError: high is out of bounds for int32
见igraph/issues#796
这似乎和随机数生成器有关,解决方法是自制RandomState然后传入scanpy用到RandomState的地方。
| 1 | import numpy as np |