zl程序教程

您现在的位置是:首页 >  其他

当前栏目

单细胞流程 安装conda 下载基因组数据 然后走cellranger 流程得到10x数据 学校服务器集群anaconda安装

2023-09-14 09:09:48 时间

Build Notes for Reference Packages -Software -Single Cell Gene Expression -Official 10x Genomics SupportBuild Notes for Reference Packages -Software -Single Cell Gene Expression -Official 10x Genomics SupportBuild Notes for Reference Packages -Software -Single Cell Gene Expression -Official 10x Genomics Support

Build Notes for Reference Packages -Software -Single Cell Gene Expression -Official 10x Genomics Support

  • Mouse reference, mm10 (includes mouse V(D)J genes)

wget ftp://ftp.ensembl.org/pub/release-93/fasta/mus_musculus/dna/Mus_musculus.GRCm38.dna.primary_assembly.fa.gz
gunzip Mus_musculus.GRCm38.dna.primary_assembly.fa.gz


wget ftp://ftp.ensembl.org/pub/release-93/gtf/mus_musculus/Mus_musculus.GRCm38.93.gtf.gz
gunzip Mus_musculus.GRCm38.93.gtf.gz


cellranger mkgtf Mus_musculus.GRCm38.93.gtf Mus_musculus.GRCm38.93.filtered.gtf \
                 --attribute=gene_biotype:protein_coding \
                 --attribute=gene_biotype:lincRNA \
                 --attribute=gene_biotype:antisense \
                 --attribute=gene_biotype:IG_LV_gene \
                 --attribute=gene_biotype:IG_V_gene \
                 --attribute=gene_biotype:IG_V_pseudogene \
                 --attribute=gene_biotype:IG_D_gene \
                 --attribute=gene_biotype:IG_J_gene \
                 --attribute=gene_biotype:IG_J_pseudogene \
                 --attribute=gene_biotype:IG_C_gene \
                 --attribute=gene_biotype:IG_C_pseudogene \
                 --attribute=gene_biotype:TR_V_gene \
                 --attribute=gene_biotype:TR_V_pseudogene \
                 --attribute=gene_biotype:TR_D_gene \
                 --attribute=gene_biotype:TR_J_gene \
                 --attribute=gene_biotype:TR_J_pseudogene \
                 --attribute=gene_biotype:TR_C_gene


cellranger mkref --genome=mm10 \
                 --fasta=Mus_musculus.GRCm38.dna.primary_assembly.fa \
                 --genes=Mus_musculus.GRCm38.93.filtered.gtf \
                 --ref-version=3.0.0

安装conda

(823条消息) Ubuntu 安装 conda_YoungLeelight的博客-CSDN博客_ubuntu 安装conda

https://zhuanlan.zhihu.com/p/459607806

Ubuntu 20.04(服务器版)安装 Anaconda3 记录,主要参考了链接:CSDN_气泡水、

下载 Anaconda
进入 Ubuntu,自己新建下载路径,输入以下命令开始下载 注意版本和时间

学校服务器中 anaconda安装位置 

wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2021.11-Linux-x86_64.sh

**

2. 安装 Anaconda
**
3.

bash Anaconda3-2021.11-Linux-x86_64.sh
1
回车后查看许可证,按 q 退出许可证,然后输入 yes 表示同意

确认安装的路径,一般直接回车安装在默认的 /home/你的名字/anaconda3

很快就安装完毕。输入 yes 来确认使用 conda init 来启动

**

3. 启动环境变量
**

如果现在输入 conda,会显示找不到命令

需要启动已经修改环境变量,输入以下命令(以后都不用再 source 了,因为启动 Ubuntu 会自动 source)

source ~/.bashrc
这时候会发现出现了 (base)

如果你查看 ~/.bashrc,可以看到已经添加了 conda 的路径

升级 conda
如果当前安装后,不是最新版本,可以通过以下命令升级

conda update -n base -c defaults conda

这样从 4.10.3 升级到了 4.11.0

current version: 4.10.3
latest version: 4.11.0

创建虚拟环境
输入以下命令创建名为 py39 的虚拟环境,python 版本为 3.9

conda create -n py39 python=3.9
1
输入 y 并回车后,开始下载并创建

进入虚拟环境
输入以下命令进入我们创建的虚拟环境 py39
 

source activate py39 

可以看到前缀已经从 base 变成了 py39,你输入 python 后可以看到,python 版本为 3.9.7


你也可以将以下命令行添加到 ~/.bashrc 里面,这样以后只需要输入 py39 就直接进入了

alias py39='source activate py39'
你也可以在 bashrc 最后一行添加以下命令,这样每次登陆服务器时,自动进入 py39

py39
7. 添加 python 模块

可以通过以下命令添加 python module,首先一定要装的是 ipython

conda install ipython
接着比如常用的 pandas、xgboost

conda install pandas
conda install xgboost
8. 其他 conda 命令

#创建虚拟环境
conda create -n your_env_name python=X.X(3.6、3.7等)
 
#激活虚拟环境
source activate your_env_name(虚拟环境名称)
 
#退出虚拟环境
source deactivate your_env_name(虚拟环境名称)
 
#删除虚拟环境
conda remove -n your_env_name(虚拟环境名称) --all
 
#查看安装了哪些包
conda list
 
#安装包
conda install package_name(包名)
conda install scrapy==1.3 # 安装指定版本的包
conda install -n 环境名 包名 # 在conda指定的某个环境中安装包
 
#查看当前存在哪些虚拟环境
conda env list 
#或 
conda info -e
#或
conda info --envs
 
#检查更新当前conda
conda update conda
 
#更新anaconda
conda update anaconda
 
#更新所有库
conda update --all
 
#更新python
conda update python

创建cellranger环境

cellranger更新到6.0啦(全新使用教程) - 简书 (jianshu.com)

首先创建并激活一个小环境

conda create -n cellranger
conda activate cellranger

下载cellranger并解压

1.cellranger软件下载及安装

网页简单注册后就可以获取wget下载地址

Downloads -Software -Single Cell Gene Expression -Official 10x Genomics Support

cd /opt

wget -O cellranger-6.0.2.tar.gz "https://cf.10xgenomics.com/releases/cell-exp/cellranger-6.0.2.tar.gz?Expires=1624477084&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9jZi4xMHhnZW5vbWljcy5jb20vcmVsZWFzZXMvY2VsbC1leHAvY2VsbHJhbmdlci02LjAuMi50YXIuZ3oiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2MjQ0NzcwODR9fX1dfQ__&Signature=QCESOlCkbmpiDLNQEHVVCZWRUQlK01zJ28z34ezOgcb2dH7yyv0zZvWw816nE7jrOfiuiD2COZ6zf8kaL~7ndl9sfKQ~JLSWYbgZgUXb6fjehKNOJggzd32mS29lZ1cAFZBgwH~pmYEmFIIx1WIuyEKi6XZ4O6Yquc0~fUA80ZkdMoNrDGGXtgn7RgRoK4MWwGgQtsufw9J5wLXe5XQG70cmg14wd-ZGjrboK~LMBDSYfkZr2YG8Sl2ScJIbB9xKfszcyXlq65EQwFuwzmSAxvNh9uIr9YlfSeUM-uNqdc1hYkin4Q1-1nGEfAaudHgzddD45-KxBKfv0KaL-vcLBA__&Key-Pair-Id=APKAI7S6A5RYOXBWRPDA"

tar -xzvf cellranger-6.0.2.tar.gz</pre>

一般来说,软件以及配套的参考基因组都需要下载,下载速度就取决于你自己的网路情况啦,建议nohup到后台,等待即可。
添加到环境变量,方便后续使用

vim ~/.bashrc
export PATH=/opt/cellranger-6.0.2:$PATH
source ~/.bashrc

2.下载参考基因组并解压

wget https://cf.10xgenomics.com/supp/cell-exp/refdata-gex-GRCh38-2020-A.tar.gz
tar -xzvf refdata-gex-GRCh38-2020-A.tar.gz</pre>

3.准备数据

既然你都要学cellranger了,大概率上你已经有了SRA或者fastq数据,有了服务器,linux知识也有所了解,关于数据的下载我就不赘述了。

本次演示我们的数据来自2018年9月的NC文章Acquired cancer resistance to combination immunotherapy from transcriptional loss of class I HLA。为了展示方便,我们只使用其中一个SRR数据。

Build Notes for Reference Packages -Software -Single Cell Gene Expression -Official 10x Genomics Support

cellranger mkgtf Mus_musculus.GRCm38.93.gtf Mus_musculus.GRCm38.93.filtered.gtf \
                 --attribute=gene_biotype:protein_coding \
                 --attribute=gene_biotype:lincRNA \
                 --attribute=gene_biotype:antisense \
                 --attribute=gene_biotype:IG_LV_gene \
                 --attribute=gene_biotype:IG_V_gene \
                 --attribute=gene_biotype:IG_V_pseudogene \
                 --attribute=gene_biotype:IG_D_gene \
                 --attribute=gene_biotype:IG_J_gene \
                 --attribute=gene_biotype:IG_J_pseudogene \
                 --attribute=gene_biotype:IG_C_gene \
                 --attribute=gene_biotype:IG_C_pseudogene \
                 --attribute=gene_biotype:TR_V_gene \
                 --attribute=gene_biotype:TR_V_pseudogene \
                 --attribute=gene_biotype:TR_D_gene \
                 --attribute=gene_biotype:TR_J_gene \
                 --attribute=gene_biotype:TR_J_pseudogene \
                 --attribute=gene_biotype:TR_C_gene


cellranger mkref --genome=mm10 \
                 --fasta=Mus_musculus.GRCm38.dna.primary_assembly.fa \
                 --genes=Mus_musculus.GRCm38.93.filtered.gtf \
                 --ref-version=3.0.0