单细胞集合
FileNames
基类:str
, Enum
在 SingleCellCollection 中生成的文件名。
源代码在 bionemo/scdl/io/single_cell_collection.py
中
57 58 59 60 61 62 |
|
SingleCellCollection
基类:SingleCellRowDatasetCore
一个或多个 SingleCellMemMapDataset 的集合。
SingleCellCollection 支持 SingleCellDataSet API 的大多数功能。 SingleCellCollection 可以转换为单个 SingleCellMemMapDataset。 SingleCellCollection 支持使用异构数据集,例如由多个 AnnData 文件组成的数据集。
属性
名称 | 类型 | 描述 |
---|---|---|
_version |
str
|
数据集的版本 |
data_path |
str
|
存储数据集集合的目录。 |
_feature_index |
RowFeatureIndex
|
对应的 RowFeatureIndex,特征位于其中 |
fname_to_mmap |
Dict[str, SingleCellMemMapDataset]
|
用于保存每个 SingleCellMemMapDataset 对象的字典。 |
False |
Dict[str, SingleCellMemMapDataset]
|
非参差不齐;所有 SingleCellMemMapDataset 都具有相同的列维度 |
True |
Dict[str, SingleCellMemMapDataset]
|
参差不齐;scmmap 列维度各不相同 |
源代码在 bionemo/scdl/io/single_cell_collection.py
中
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
__init__(data_path)
实例化类。
参数
名称 | 类型 | 描述 | 默认 |
---|---|---|---|
data_path
|
str
|
类的存储位置。 |
必需 |
源代码在 bionemo/scdl/io/single_cell_collection.py
中
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
flatten(output_path, destroy_on_copy=False)
将集合展平为单个 SingleCellMemMapDataset。
参数
名称 | 类型 | 描述 | 默认 |
---|---|---|---|
output_path
|
str
|
存储新数据集的位置 |
必需 |
destroy_on_copy
|
bool
|
是否删除当前 data_path |
False
|
源代码在 bionemo/scdl/io/single_cell_collection.py
中
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
load_h5ad(h5ad_path)
从现有的 AnnData 存档加载数据。
这将创建并保存新的后备数据结构。然后,存储位置以及数据和数据集。
参数
名称 | 类型 | 描述 | 默认 |
---|---|---|---|
h5ad_path
|
str
|
AnnData 存档的路径 |
必需 |
源代码在 bionemo/scdl/io/single_cell_collection.py
中
113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
load_h5ad_multi(directory_path, max_workers=5, use_processes=False)
加载一个或多个 AnnData 文件,并将它们添加到集合中。
参数
名称 | 类型 | 描述 | 默认 |
---|---|---|---|
directory_path
|
str
|
包含 AnnData 文件的目录路径 |
必需 |
max_workers
|
int
|
要使用的最大工作线程数 |
5
|
use_processes
|
bool
|
如果为 True,则使用 ProcessPoolExecutor;否则,使用 ThreadPoolExecutor |
False
|
Raises: FileNotFoundError: 如果在目录中找不到 h5ad 文件。 RuntimeError: 如果在加载任何 h5ad 文件时发生错误。
源代码在 bionemo/scdl/io/single_cell_collection.py
中
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
|
number_nonzero_values()
每个数据集中非零条目数的总和。
源代码在 bionemo/scdl/io/single_cell_collection.py
中
162 163 164 |
|
number_of_rows()
数据集中的行数。
返回
类型 | 描述 |
---|---|
int
|
数据集中的行数 |
Raises: ValueError 如果特征索引中行数的长度与存储的行数不符。
源代码在 bionemo/scdl/io/single_cell_collection.py
中
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|
number_of_values()
每个数据集中值的数量的总和。
源代码在 bionemo/scdl/io/single_cell_collection.py
中
166 167 168 |
|
number_of_variables()
如果参差不齐,则返回变量长度列表。
如果非参差不齐,则返回包含一个条目的列表。 参差不齐的集合是指数据集具有不同长度的集合。
源代码在 bionemo/scdl/io/single_cell_collection.py
中
190 191 192 193 194 195 196 197 198 199 200 |
|
shape()
获取数据集的形状。
这是条目数乘以与该变量对应的特征索引的长度。
返回
类型 | 描述 |
---|---|
int
|
跨数据集的元素总数 |
List[int]
|
一个列表,其中包含 RowFeatureIndex 中每个条目的变量数。 |
源代码在 bionemo/scdl/io/single_cell_collection.py
中
202 203 204 205 206 207 208 209 210 211 212 213 |
|
version()
返回版本号。
(遵循
源代码在 bionemo/scdl/io/single_cell_collection.py
中
106 107 108 109 110 111 |
|