# loom文件使用记录

随着单细胞数据量的增长，计算要求成指数增长，当数据量大于10万个细胞的时候，seurat包分析就显得非常有压力了，因为在实时内存中储存数据就变得非常困难，HDF5数据格式提供了高效的磁盘存储，而不是在内存中存储数据，这就将分析扩展到大规模数据集，甚至可以达到大于100万细胞的级别 ，Linnarson实验室开发了一种基于hdf5的数据结构，loom，可以方便地存储单细胞基因组数据集和元数据。他们发布了一个名为loompy的Python API来与loom文件交互，而loomR能基于R的与loom交互（Merlin_cd6c）

## 安装补充包

- conda activate seurat

- conda install -c conda-forge r-hdf5r -y

- # conda install -c bioconda r-loom=0.2.0.2 -y

- wget https://github.com/mojaveazure/loomR/archive/refs/heads/develop.zip -O loomR-develop.zip

- devtools::install_local(‘loomR-develop.zip’)

- conda install -c conda-forge binutils_impl_linux-64 -y

- BiocManager::install(“hdf5r”)

- conda create -n loom -c conda-forge loompy=3.0.6 -y

- conda activate loom

## 下载数据

The Human Cell Atlas is an international collaborative consortium that charts the cell types in the healthy body, across time from development to adulthood, and eventually to old age. This enormous undertaking, larger even than the Human Genome Project, will transform our understanding of the 37.2 trillion cells in the human body.

The HCA Data Portal stores and provides single-cell data contributed by labs around the world. Anyone can contribute data, find data, or access community tools and applications.

- `wget 'https://storage.googleapis.com/datarepo-a6e6a252-bucket/8b504553-0300-426e-876c-116772d06c6e/485f373c-f3b3-47a2-8f9b-bbe007a4a75b/ProstateCellAtlas-human-prostate-gland-10xv2.loom?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=datarepo-jade-api%40terra-datarepo-production.iam.gserviceaccount.com%2F20221003%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20221003T121317Z&X-Goog-Expires=900&X-Goog-SignedHeaders=host& ' -O ProstateCellAtlas-human-prostate-gland-10xv2.loom`

类似的网站：CZ CELLxGENE；可以检索需要的数据集，下载rds格式的文件

- `curl -o local.rds "https://corpora-data-prod.s3.amazonaws.com/5484f890-7e6f-4eb4-821f-2fc995d10c47/local.rds?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIATLYQ5N5X7IE7U3FW%2F20221003%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20221003T131441Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEOz%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLXdlc3QtMiJHMEUCIDqVa2igyV9%2BOaaQGXPAxZb%2FrSKXPH0JNBf1zPb5S33wAiEA1zFz8ZKqLcGz9Ip%2FqeJvw0JMTKkptGz%2FInBtdfurxZEq9AMIpf%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FARABGgwyMzE0MjY4NDY1NzUiDOTNFg85zD2F0B0FISrIA0CT3GUFmKR4ScNFtM%2B0FU4nIVrD7lM%2FecCE9SVHJM%2F6QGWPA7E3LWr9KcWMByy3jEQ9FRAjlsr26v2d8Znt2tAkvIcF7xiQaR1qgISi0Xak0EZceNUMTknU85CCPwPC7%2FiwxckmUX%2B0o0V11yh3rQyhHvpdcgO5COGafKwMIHYtldJNuTF0B9TTf1WVJkfZv%2Bl6o7DxHahwkb9oWWBKON9cM37oXDcH7m%2BD6szQamWY6bKNN2QNcBkKFy66ndKeFpdz6annSJKR98c8MmwGdoA9DzwixxiXZhIOR7IGD9N5oIy28sd9ZyPnBwSOEmkHB%2B61TXkwV28Li7NFfe7z6a0kpG3LiRSKPmhtC8cu5LlFUnLKqHeD1tXrVkOixukdPacWLQyAQDSYaUGoZVS7ESW2Y11bSxZLCEZ97RIM5OwOQIfv%2FsQUQLic9qDmlStQCYAVBkdmApA4a3kKbMHcOVOwECwTnUDEr36oevJMqaP688egzOjpfqkshXGLRZ%2BtA9yIn1RGqrwT%2Bl%2BStPc2s2hFBue6q9sd1aVmS3VDfiRHlvMgDS3et0jnWvUVih95U8RaeMBNVYfl4P%2BMMbhgmPFEp%2B%2F03nS%2BbzD9ouuZBjqlAYt4%2FOil7fZYzwhlUd0nHWnBLsP5w0g1EBURMhQHCtKBcNf2deWPQLlnQFQSwZhCOaYtNhZ679%2FDcsiCUCgQJUj4sTm1kbxjQouHVaOnml%2FlYM6VaJo6aLjvB%2F%2Bx9u4G925PZK1CUToWyoVyWw4sPhbGuBYRTPzzNIACi5ZuCB0DZ0cjhD86pv71dJIE%2BfwzGlEzzyVEK5nkSuKbxw4aYBOA3oTaXA%3D%3D&X-Amz-Signature=0e5c2ff76b231c5591672b93de4a77128e5757e50c699636a757e8eefba180aa"`
- mv local.rds cellxgene_Human_prostate.rds

## 使用记录

公共的集群是真难用，一堆包装半天装不上，磁盘IO慢的一批。。。。。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21

    conda activate seurat
    .libPaths('')
    sce <- loomR::connect(filename = "./HumanCellAtlas/ProstateCellAtlas/ProstateCellAtlas-human-prostate-gland-10xv2.loom", mode = "r", skip.validate = T)
    mat <- sce[["matrix"]][,]
    gene <- sce$row.attrs$Gene[]
    # barcode <- sce$col.attrs$CellID[]
    barcode <- sce$col.attrs$cell_names[]
    mat <- t(mat)
    colnames(mat)= barcode
    rownames(mat)= gene
    sce$close_all()
    sce <- Seurat::CreateSeuratObject(counts = mat, project = 'prostate', min.cells = 3, min.features = 200)
    rm(mat)
    gc()
    #             used   (Mb)  gc trigger     (Mb)    max used     (Mb)
    # Ncells   3611333  192.9     6136950    327.8     6136950    327.8
    # Vcells 287451723 2193.1 45703419996 348689.5 57126196661 435838.3
    sce
    # An object of class Seurat
    # 39879 features across 128673 samples within 1 assay
    # Active assay: RNA (39879 features, 0 variable features)

原始数据
loom文件使用记录
https://occdn.limour.top/2387.html
Author
Limour
Posted on
October 3, 2022
Licensed under
构造Pseudo-bulk的表达量矩阵加速SingleR运行 Previous
Jupyter添加Golang内核 Next

#### Search

Keyword