分别在192.168.220.190、192.168.200.191安装计算节点服务,安装过程参照上一章节“计算节点”说明。
本系列是《玩转机器学习教程》一个整理的视频笔记。上一小节介绍了模型复杂度曲线,通过这种直观的曲线,可以比较容易的看到模型欠拟合和过拟合的地方,进而选出最合适的模型复杂度。本小节介绍另外一个观察模型欠拟合和过拟合的曲线~"学习曲线"。
web应用安全的黄金法则是,永远不要相信来自不可信来源的数据。有时通过不可信的媒介来传递数据会非常方便。密码签名后的值可以通过不受信任的途径传递,这样是安全的,因为任何篡改都会检测的到。
pbmc500_assay <- CreateChromatinAssay(pbmc500.counts, fragments = frags.500) pbmc500 <- CreateSeuratObject meta.data=md.500) pbmc1k_assay <- CreateChromatinAssay(pbmc1k.counts, fragments = frags.1k) pbmc1k <- CreateSeuratObject meta.data=md.1k) pbmc5k_assay <- CreateChromatinAssay(pbmc5k.counts, fragments = frags.5k) pbmc5k <- CreateSeuratObject meta.data=md.5k) pbmc10k_assay <- CreateChromatinAssay(pbmc10k.counts, fragments = frags.10k) pbmc10k <- CreateSeuratObject assay <- CreateChromatinAssay(counts = counts.500, sep = c(":", "-"), min.features = 500) pbmc500 <- CreateSeuratObject
1.2 创建seurat对象 依然使用CreateSeuratObject 函数,此处count 为读取的矩阵文件。 sce0 <- CreateSeuratObject(counts = data) sce0 head(sce0@meta.data) An object of class Seurat 19790 1,CreateSeuratObject中的meta.data参数 CreateSeuratObject函数除了简单的过滤条件外 ,还有一个重要的meta.data参数,可以输入提供的meta信息。 检索之后https://github.com/satijalab/seurat/issues/2715 发现 ,是因为CreateSeuratObject要求meta文件中rownames是count文件的 CreateSeuratObject函数的帮助文档中也很明确的提到了该点要求。 发现问题后,只需要将meta文件的cellid列转为rownames即可。
Read10X(data.dir = paste(dataset_loc, ids[1],"filtered_feature_bc_matrix", sep="/")) seurat_obj <- CreateSeuratObject Read10X_h5(file.path(dataset_loc, ids[1], "filtered_feature_bc_matrix.h5"), use.names = T) seurat_obj <- CreateSeuratObject row names as the gene IDs rownames(counts) <- gene_ids colnames(counts) <- cell_ids seurat_obj <- CreateSeuratObject 1L),sep="_") d10x }) seurat_merge <- do.call("cbind", d10x.data) # for "dgCMatrix" seurat_data <- CreateSeuratObject Read10X(data.dir = paste(dataset_loc, file,"filtered_feature_bc_matrix", sep="/")) seurat_obj <- CreateSeuratObject
习题8-5 使用函数实现字符串部分复制 本题要求编写函数,将输入字符串t中从第m个字符开始的全部字符复制到字符串s中。
dgCMatrix" # attr(,"package") # [1] "Matrix" # 构建 Seurat 对象 # 初步过滤一般不需要修改参数,除非数据实在太难看 Seurat_object <- CreateSeuratObject ScRNAdata <- Read10X_h5(filename = "GSM3489182_Donor_01_raw_gene_bc_matrices_h5.h5") Seurat_object <- CreateSeuratObject read.table( "data/GSM2829942/GSM2829942_HE6W_LA.TPM.txt", row.names = 1, header = T) Seurat_object <- CreateSeuratObject CreateSeuratObject( counts, project = "CreateSeuratObject", assay = "RNA", names.field = 1,
这两天分析一个单细胞数据发现一个奇怪的问题,就是创建 seurat 对象的时候,我明明设置了参数 CreateSeuratObject 函数的project 参数,但是最后merge 不同的样本后发现 > gsub(".txt","", pro) [1] "IRI1d_1" CreateSeuratObject 这个函数做了什么? 赶紧查看 CreateSeuratObject 的帮助文档: Create a Seurat object Description Create a Seurat object from raw data = NULL, project = "CreateSeuratObject", ... ) Arguments counts Either a matrix-like object with # 创建Seurat对象 sce <- CreateSeuratObject(counts = counts, min.cells=3, project = gsub(".txt","", pro),
MACS <- CreateSeuratObject(counts = MACS, project = "H14_MACS", min.cells = 3, min.features = 100) MACS H21 <- CreateSeuratObject(counts = H21, project = "H21", min.cells = 3, min.features = 100) H21 H23 <- CreateSeuratObject(counts = H23, project = "H23", min.cells = 3, min.features = 100) H23 H24 <- CreateSeuratObject = H32, project = "H32", min.cells = 3, min.features = 100) H32 H33 <- CreateSeuratObject(counts = H33 = 3, min.features = 100) H36 H38 <- CreateSeuratObject(counts = H38, project = "H38", min.cells = 3,
答题 这道题不难,但如果直接去实现查询f(x)的话,算法效率会非常低 我们直接观察样例,15=(5-2)*1+(8-5)*2+(10-8)*3 所以我们可以写出下面程序 #include<iostream
如果是单个样品,直接读取进来然后创建seurat对象即可:初试Seurat的V5版本 主要区别在于,V4版本中一般是循环读取样品,使用CreateSeuratObject创建seurat对象,然后使用merge 那我们可以先把多个样品合并成为了一个超级大的表达量矩阵,并使其行名为基因名,列名为barcodes信息,后面直接针对它来使用CreateSeuratObject函数去构建Seurat对象,就是完美的下游分析的输入数据啦 GSE212975/',samples) names(dir) <- samples #读取数据创建Seurat对象 counts <- Read10X(data.dir = dir) sce.all = CreateSeuratObject sceList[[i]])<-paste0(samples[i],"_",col) } #数据整合后创建seurat对象 merge <- do.call(cbind,sceList) sce =CreateSeuratObject F,data.table = F ) head(rl) #整合矩阵信息 colnames(mtx)=cl$V1 rownames(mtx)=rl$V1 #创建seurat对象 sce.all=CreateSeuratObject
,tsv/txt,h5ad格式10x格式的读取展开代码语言:TXTAI代码解释library(Seurat)ct=Read10X(data.dir="GSE145154_RAW/")seu.obj<-CreateSeuratObject install.packages("hdf5r")ct<-Read10X_h5("GSE200874_RAW/GSM6045826_wt_filtered_gene_bc_matrices_h5_2.h5")seu.obj<-CreateSeuratObject row.names=1#是将第一列设置为行名的意思ct<-read.csv("GSE130148_raw_counts.csv.gz",row.names=1)class(ct)seu.obj<-CreateSeuratObject
library("Seurat") scrna_data_ctrl <- Read10X("data/GSE96583/ctrl/") ctrl <- CreateSeuratObject( counts , min.cells = 3, min.features = 200) scrna_data_stim <- Read10X("data/GSE96583/stim/") stim <- CreateSeuratObject sample_list){ filedir = str_c("data/GSE96583/",sample) scrna_data <- Read10X(filedir) Seurat_object <- CreateSeuratObject str_c("data/GSE96583/",sample) # 数据的读取 scrna_data <- Read10X(filedir) # 对象的构建 Seurat_object <- CreateSeuratObject
实验8-5 编写一个能将任意两个文件的内容合并的程序,程序界面由读者由自由设计。
使用CreateSeuratObject生成Seurat对象,后续分析都是在该对象上进行操作。 rownames(x = raw.data), value = FALSE) raw.data <- raw.data[-ercc.index,] dim(raw.data) 有了表达矩阵,直接使用 CreateSeuratObject 然后慢慢添加这个表达矩阵的一些其它外部属性,全部代码如下: # Create the Seurat object with all the data (unfiltered) main_tiss <- CreateSeuratObject # lapply是对列表或向量进行循环,而apply是对数据框或矩阵操作) library(Seurat) sceList <- lapply(folders,function(folder){ CreateSeuratObject ##### # 读取单个 sce <- Read10X_h5(filename = "GSM4107899_LH16.3814_raw_gene_bc_matrices_h5.h5") sce <- CreateSeuratObject
读取h5格式的文件(使用Read10X_h5函数读取h5格式的单细胞数据文件) seurat_data <- Read10X_h5(file = h5_file) # 创建Seurat对象(使用CreateSeuratObject /data/GSE130148/GSE130148_raw_counts.csv.gz"), row.names = 1) # 使用CreateSeuratObject()函数创建Seurat对象,并在此处指定项目名称 seurat_obj <- CreateSeuratObject(counts = seurat_data, min.features /data/GSE130xxx/xxxx.txt.gz"), row.names = 1, header = TRUE, sep = "\t") # 使用CreateSeuratObject()函数创建 Seurat对象,并在此处指定项目名称 seurat_obj <- CreateSeuratObject(counts = seurat_data,
tmp = Read10X(file.path(dir,pro )) if(length(tmp)==2){ ct = tmp[[1]] }else{ct = tmp} sce =CreateSeuratObject sce.all_int.rds') GSE152938$study = 'GSE152938' table(GSE152938$orig.ident) sceList = list( GSE131685 = CreateSeuratObject ( counts = GSE131685@assays$RNA$counts ), GSE152938 = CreateSeuratObject( counts = GSE152938
included # min.features = 200, only cells with at least 200 genes detected will be included pfc2 <- CreateSeuratObject (counts = pfc2.data, project = "pfc-demo", min.cells = 3, min.features = 200) pfc3 <- CreateSeuratObject (counts = pfc3.data, project = "pfc-demo", min.cells = 3, min.features = 200) pfc5 <- CreateSeuratObject (counts = pfc5.data, project = "pfc-demo", min.cells = 3, min.features = 200) pfc7 <- CreateSeuratObject ~ 3 .不死心的话,我们不使用SCTtransform,也不去除批次效应,只使用seurat标准流程试试 3#3 标准流程----- head(subset_data@meta.data) All=CreateSeuratObject
mode:分割模式标志,该参数值可选择范围以及含义在表8-5给出。