R 读取单细胞H5ad数据

2023-04-21  本文已影响0人  火卫控

R 读取单细胞H5ad数据, 转换为Seurat能直接读取的对象

# 自己安装  mojaveazure/seurat-disk 这个GitHub包:
remotes::install_github("mojaveazure/seurat-disk", force = TRUE)
library(SeuratDisk)
library(patchwork)

library(dplyr)
library(Seurat)
#~~~~~开始读数据~~~~~
##h5ad是python的Scanpy读取文件格式,需要转换
#~~~~读取adipose~~~~
# "D:\big_data\scRNAs\bairong\HLCA_emb_and_metadata.h5ad"
#  "D:\big_data\scRNAs\bairong\HLCA_emb_and_metadata.h5seurat"
Convert('D:/big_data/scRNAs/bairong/FastGenomics/expression Data Files/Hv1.h5ad', "h5seurat",overwrite = TRUE,assay = "RNA")
Hv1 <- LoadH5Seurat("D:/big_data/scRNAs/bairong/FastGenomics/expression Data Files/Hv1.h5seurat")
Hv1

运行情况

> Convert('D:/big_data/scRNAs/bairong/FastGenomics/expression Data Files/Hv1.h5ad', "h5seurat",overwrite = TRUE,assay = "RNA")
Warning: Unknown file type: h5ad
Creating h5Seurat file for version 3.1.5.9900
Adding X as data
Adding X as counts
Adding meta.features from var
Adding X_scanvi_emb as cell embeddings for scanvi_emb
Adding X_umap as cell embeddings for umap
Adding miscellaneous information for umap
Adding ann_coarse_for_GWAS_and_modeling_colors to miscellaneous data
Adding ann_finest_level_colors to miscellaneous data
Adding ann_level_1_colors to miscellaneous data
Adding ann_level_2_colors to miscellaneous data
Adding ann_level_3_colors to miscellaneous data
Adding ann_level_4_colors to miscellaneous data
Adding ann_level_5_colors to miscellaneous data
Adding dataset_colors to miscellaneous data
Adding reannotation_type_colors to miscellaneous data
Adding scanvi_label_colors to miscellaneous data
Adding study_colors to miscellaneous data
> Hv1 <- LoadH5Seurat("D:/big_data/scRNAs/bairong/FastGenomics/expression Data Files/Hv1.h5seurat")
Validating h5Seurat file
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')
Initializing RNA with data
Adding counts for RNA
Adding feature-level metadata for RNA
Adding reduction scanvi_emb
Adding cell embeddings for scanvi_emb
Warning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from scanvi_emb_ to scanviemb_
Warning: All keys should be one or more alphanumeric characters followed by an underscore '_', setting key to scanviemb_
Adding miscellaneous information for scanvi_emb
Adding reduction umap
Adding cell embeddings for umap
Adding miscellaneous information for umap
Adding command information
Adding cell-level metadata
Warning: Invalid name supplied, making object name syntactically valid. New object name is samplestudy_longstudylast_author_PIsubject_IDsexethnicitymixed_ethnicitysmoking_statusBMIconditionsubject_typesample_typesingle_cell_platformX3._or_5.sequencing_platformcell_ranger_versionfresh_or_frozendatasetanatomical_region_level_1anatomical_region_level_2anatomical_region_level_3anatomical_region_highest_resageann_highest_resn_geneslog10_total_countsmito_fracribo_fracoriginal_ann_level_1original_ann_level_2original_ann_level_3original_ann_level_4original_ann_level_5scanvi_labelleiden_1leiden_2leiden_3anatomical_region_ccf_scoreentropy_study_leiden_3entropy_dataset_leiden_3entropy_subject_ID_leiden_3entropy_original_ann_level_1_leiden_3entropy_original_ann_level_2_clean_leiden_3entropy_original_ann_level_3_clean_leiden_3entropy_original_ann_level_4_clean_leiden_3entropy_original_ann_level_5_clean_leiden_3leiden_4reannotation_typeleiden_5ann_finest_levelann_level_1ann_level_2ann_level_3ann_level_4ann_l [... truncated]
Adding miscellaneous information
Adding tool-specific results
> Hv1
An object of class Seurat 
28527 features across 584884 samples within 1 assay 
Active assay: RNA (28527 features, 0 variable features)
 2 dimensional reductions calculated: scanvi_emb, umap
>

需要一会儿时间,H5ad源文件大约 10GB 左右

上一篇 下一篇

猜你喜欢

热点阅读