当前位置:网站首页>Build a bioinformatics r environment from 0 (step on the pit record)
Build a bioinformatics r environment from 0 (step on the pit record)
2022-06-10 09:25:00 【qq_ forty-five million seven hundred and fifty-nine thousand tw】
















# test Seurat package
rm(list=ls())
suppressMessages(require(Seurat))
suppressMessages(require(ggplot2))
suppressMessages(require(cowplot))
#suppressMessages(require(scater))
#suppressMessages(require(scran))
#suppressMessages(require(BiocParallel))
#suppressMessages(require(BiocNeighbors))
setwd("/data/wangdongxue/yxk/R Learning tests /Seurat3")
pancreas.data <- readRDS(file = "./data/pancreas_v3_file/pancreas_expression_matrix.rds")
metadata <- readRDS(file = "./data/pancreas_v3_file/pancreas_metadata.rds")
pancreas <- CreateSeuratObject(pancreas.data, meta.data = metadata)
# Note that this is different from other situations , There is only metadata Of annotation information
# The previous data set was just passed in count matrix, But not at the same time meta.data
# Standardized data (Filter cells omitted , This has little effect )
# Normalize and find variable features
pancreas <- NormalizeData(pancreas, verbose = FALSE)
pancreas <- FindVariableFeatures(pancreas, selection.method = "vst", nfeatures = 2000, verbose = FALSE)
# Run the standard workflow for visualization and clustering
pancreas <- ScaleData(pancreas, verbose = FALSE)
pancreas <- RunPCA(pancreas, npcs = 30, verbose = FALSE)
pancreas <- RunUMAP(pancreas, reduction = "pca", dims = 1:30)
p1 <- DimPlot(pancreas, reduction = "umap", group.by = "tech")# draw batch chart
p2 <- DimPlot(pancreas, reduction = "umap", group.by = "celltype", label = TRUE, repel = TRUE) +
NoLegend() # draw celltype Graph
print(p1+p2)
ggsave("vis_pancras.png",plot=p1+p2)
give the result as follows 


rm(list=ls())
suppressMessages(library(splatter))
suppressMessages(library(Seurat))
suppressMessages(library(ggplot2))
params <- newSplatParams()
params <- setParam(params, "nGenes", 5000)
params <- setParam(params, "batchCells", c(500,500,500))
params <- setParam(params, "batch.facLoc", 0.5)
params <- setParam(params, "batch.facScale", 0.5)
params <- setParam(params, "group.prob", c(1/3,1/3,1/3))
sim <- splatSimulate(params, method="groups", verbose=FALSE)
## create Seurat object
data <- CreateSeuratObject(counts(sim),meta.data = data.frame(colData(sim)))
#
# Note that this is different from other situations , There is only metadata Of annotation information
# The previous data set was just passed in count matrix, But not at the same time meta.data
data <- NormalizeData(data, verbose = FALSE)
data <- FindVariableFeatures(data, selection.method = "vst", nfeatures = 2000, verbose = FALSE)
# Run the standard workflow for visualization and clustering
data <- ScaleData(data, verbose = FALSE)
data <- RunPCA(data, npcs = 30, verbose = FALSE)
data <- RunUMAP(data, reduction = "pca", dims = 1:30)
p1 <- DimPlot(data, reduction = "umap", group.by = "Batch")# draw batch chart
p2 <- DimPlot(data, reduction = "umap", group.by = "Group")
print(p1+p2)
ggsave("vis_splatter.png",plot=p1+p2)
give the result as follows 







The end , And the flower
Add questions 1
Find the problem
When using library(reticulate) when , Unable to import scipy package , There are the following problems
terms of settlement :
https://blog.csdn.net/weixin_44121197/article/details/123018363
#
sudo apt-get install software-properties-common
sudo apt-get update
#
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9
sudo apt-get upgrade libstdc++6
Then the problem is solved
Add questions 2
In fact, this is the end of the installation R Not perfect , I hope to install another one jupyter Of R kernel, But what I installed above is the main environment R, There is no way to use jupyter kernel Of , So it can be conda Create your own in the environment R4 Version environment , And then add kernel That's all right. ,
The operation steps are as follows 
But I found out in R4 There will be problems in packaging in the environment , I remember there was no such problem in the main environment , But still record it ,
Notice now that I am R4 Of conda Packaging in the environment , Not the main environment R, Dangzhuang devtools Packet time , Found the following error
terms of settlement : At present R4 Input... In the environment
conda install libgit2
One more question 
terms of settlement
https://github.com/r-lib/systemfonts/issues/35
Administrator input
sudo apt -y install libfontconfig1-dev
No problem
Add stringi Installation problems
I'm in today mac Try installing one yourself on conda R4.0.3 Environment , Because my computer has Seurat2, and Seurat4, Only No Seruat3, I thought I'd try , Found or encountered stringi The problem of
I first created a conda Environmental Science
conda create -n Seurat3 -c conda-forge r-base==4.0.3
After successful installation ,
When the input
install.packages("stringi")
There is always a mistake , The following package failed to download
But I found out in conda Environmental R In bag , Not like that stringi package ,conda The environment has its own stringi package
https://github.com/conda-forge/r-stringi-feedstock
Enter... In the current environment 

Must be entered in advance conda config That sentence , Otherwise, the installation will still fail , I don't know why , It's a strange feeling , I'll try it on the server later
install Seurat3
If you want to conda Installation in the environment Seurat3, So in R Input in
remotes::install_version("Seurat", version = "3.1.5")
Do not install seurat3.2.3. This one is wrong once it is installed , It's disgusting
And then there's the setup kernel It's something
I was on the server anaconda The environment created is R4, Now in R4 Successfully installed in Seurat3, Now I'm going to be in jupyter Put this in the R4 Environmental kernel Fall out
Steps are as follows
install.packages("BiocManager")
install.packages('IRkernel')
conda install -c conda-forge r-seurat
IRkernel::installspec(name = 'Seurat3', displayname = 'Seurat3')
Pay attention to my kernel Name and conda The names created are different , But this doesn't affect
The final results are as follows 
边栏推荐
- Understanding of pointer forced rotation in C language
- makefile中$$的使用
- Texstudio how to compile and run tex files based on markdown macro package
- Task06: Autumn move script a
- College entrance examination --- a turning point in life
- Task05:sql advanced processing
- Alignment HR_ MySQL storage engine, so it is
- Deploy MySQL based on statefulset in kubernetes (Part 1)
- 请问手机办理股票开户安全吗?
- 网页免费 字体库
猜你喜欢

分享|数字孪生交通应用(附PDF)

本地浏览器访问远程服务器jupyter配置

Zotero beta 6.0版本安装后,无法使用内置pdf阅读器的问题解决

Simple creation of database views, indexes, stored procedures and triggers

Printk learning part 1: basic principles

Deploy MySQL based on statefulset in kubernetes (Part 1)

No module named ‘pyautogui‘

Thinking about function declaration

C语言define变参__VA_ARGS__及##__VA_ARGS__的使用

在 Kubernetes 中基于 StatefulSet 部署 MySQL(下)
随机推荐
QQ微信实现连续发送消息【代码实现】
How to Spot-Check Classification Algorithms
Sharing digital twin traffic applications (PDF attached)
Leetcode Langya list level 20 - binary sum
36氪首发 | 新一代iPOCT产品持续发展,「伊鸿健康 」完成新一轮数千万元融资
QQ wechat enables continuous message sending [code implementation]
vscode-markdown all in one-keyboard shortcut
How to open an account for your own stock trading? Is it safe?
matlab报错问题汇总
从0开始搭建生物信息学R环境(踩坑记录)
本地浏览器访问远程服务器jupyter配置
scanpy下载数据慢或者失败问题解决
How to Spot-Check Classification Algorithms
阿裏巴巴數字化轉型的啟示
LeetCode琅琊榜第十九层-有效的括号
ES6新特性class类
JS obtient l'heure actuelle
C language define variable parameter__ VA_ ARGS__ And__ VA_ ARGS__ Use of
谈谈2022年数字化转型的趋势
pycocotools在线安装--【可用】