今天又是来学习单细胞数据的时候啦,群里曾老板一下子布置了好多写作任务(其实手里还有超级多老板发的资料,学不完根本学不完55555555555)。话不多说,放上老板发布的信息如下:
【写作任务7】: 文献标题为《A single-cell RNA sequencing dataset of peripheral blood cells in long COVID patients on herbal Therapy 》,文中在对单细胞进行数据过滤的时候,发现QC的指标定的超级高。这么大一群细胞的仅仅是质量值低吗?数据集是 GSE265753 ,为什么要如此高的阈值?
下面就来看看!
细胞主要来自新冠病人的外周血,外周血里面主要都是免疫细胞,免疫细胞有一个特征就是每个细胞中表达的基因数比较低,一般的文献过滤指标范围都在200-3000左右。取样过程如下:
数据下载地址如下:https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE265753,将提供的表达矩阵下载下来,共有20多w的原始细胞:
GSE265753_processed_counts_matrix.csv.gz 505.4 Mb (ftp)(http) CSV
这里读取数据的时候还有一个小技巧,GSE265753_processed_counts_matrix.csv.gz 文件并没有提供每个样本单独的ID,先读取进来看看:
###
### Create: Jianming Zeng
### Date: 2023-12-31
### Email: jmzeng1314@163.com
### Blog: http://www.bio-info-trainee.com/
### Forum: http://www.biotrainee.com/thread-1376-1-1.html
### CAFS/SUSTC/Eli Lilly/University of Macau
### Update Log: 2023-12-31 First version
### Update Log: 2024-12-09 by juan zhang (492482942@qq.com)
###
rm(list=ls())
options(stringsAsFactors = F)
library(ggsci)
library(dplyr)
library(future)
library(Seurat)
library(clustree)
library(cowplot)
library(data.table)
library(ggplot2)
library(patchwork)
library(stringr)
library(qs)
library(Matrix)
# 创建目录
getwd()
gse <- "GSE265753"
dir.create(gse)
###### step1: 导入数据 ######
ct <- data.table::fread("GSE265753/GSE265753_processed_counts_matrix.csv.gz",data.table = F)
ct[1:5, 1:5]
dim(ct)
rownames(ct) <- ct[,1]
ct <- ct[,-1]
ct[1:5, 1:5]
这里可以看出矩阵的barcode中可能有样本ID:
结合文章的table2,样本ID确实是存在矩阵的列名中:
处理一下,注意这里的字符切割技巧:
temp <- sub("(.*)_(.*)", "\\1 \\2", colnames(ct))
temp <- str_split(temp,pattern = " ", n=2,simplify = T)
head(temp)
meta <- data.frame(Sample=temp[,1],ID=temp[,2])
rownames(meta) <- colnames(ct)
head(meta)
tail(meta)
table(meta[,1])
length(table(meta[,1]))
创建Seurat对象:
# 创建对象
sce.all <- CreateSeuratObject(counts = ct, meta.data = meta, min.cells = 3)
sce.all
# 查看特征
as.data.frame(sce.all@assays$RNA$counts[1:10, 1:2])
head(sce.all@meta.data, 10)
tail(sce.all@meta.data, 10)
table(sce.all$orig.ident)
table(sce.all$Sample)
length(table(sce.all$Sample))
library(qs)
qsave(sce.all, file="GSE265753/sce.all.qs")
现在数据处理最难的部分已经给大家做好了,接下来就是对这个数据的查看各种QC指标,除了常见的小提琴图,还有密度曲线分布等,做一下常规的阈值过滤:nFeature_RNA > 200 & nFeature_RNA < 3000,然后降维聚类分群看看,多出来的哪一群是不是可能会有新发现呢?
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有