首页 > 其他分享 >单细胞转录组实战01: CellRanger7定量

单细胞转录组实战01: CellRanger7定量

时间:2023-02-07 19:23:30浏览次数:89  
标签:01 cellranger fastq gz 转录 CellRanger7 https txt com

安装CellRanger

cd ~/APP
wget -O cellranger-7.1.0.tar.xz "https://cf.10xgenomics.com/releases/cell-exp/cellranger-7.1.0.tar.xz?Expires=1674686023&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9jZi4xMHhnZW5vbWljcy5jb20vcmVsZWFzZXMvY2VsbC1leHAvY2VsbHJhbmdlci03LjEuMC50YXIueHoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2NzQ2ODYwMjN9fX1dfQ__&Signature=kBEWDvHNogaTb-bmHzd7kHIBIfs8LQmePXusMXNKYpuqbgNHX5Ai0mhB-wv6ig1X5QFZytrl4gYXd8DyNXVo85hRp6Iw9k1UHtuuictpnyNe-5JNocePNKou89k9AOEGoatr6xa9z1VPkOj33FTpG25OpfQowpBrwvNhFF27qoSqw7EcjSWm53zB4QsYqMR~Bi-5MXTEplAxusXnE5A1HtVOo31lsL7cavd88ez9yFcSDIf65~KJR6KqDzqYS3NAcm3MKBWWSeIVAwOWAuHaQONeAew8X4fMb3ql85CpeaCWrQdB-vlUVkQbM0gJY2S7MQ9SJ0B5qUc7qo9UWLXATw__&Key-Pair-Id=APKAI7S6A5RYOXBWRPDA"
tar -xf cellranger-7.1.0.tar.xz
ln -s ~/APP/cellranger-7.1.0/bin/cellranger ~/APP/bin/cellranger
export PATH=$HOME/APP/bin:$PATH

参考基因组

10X提供人和鼠的基因组参考index,其他物种可以是用cellranger自行构建

#>>>down10Xref.sh
# Human reference (GRCh38)  md5sum: dfd654de39bff23917471e7fcc7a00cd
wget https://cf.10xgenomics.com/supp/cell-exp/refdata-gex-GRCh38-2020-A.tar.gz
md5sum refdata-gex-GRCh38-2020-A.tar.gz
# Mouse reference md5sum: 886eeddde8731ffb58552d0bb81f533d
wget https://cf.10xgenomics.com/supp/cell-exp/refdata-gex-mm10-2020-A.tar.gz
md5sum refdata-gex-mm10-2020-A.tar.gz
#<<<down10Xref.sh

nohup sh down10Xref.sh &> down10Xref.sh.log &

下载原始数据

https://www.ebi.ac.uk/ena/browser/view/PRJNA510251

mkdir -p ~/Project/LC/data/rawdata
cd ~/Project/LC/data/rawdata
cut -f 11 filereport_read_run_PRJNA510251_tsv.txt | tr ';' '\n' | grep '_[12].fastq.gz' > fq.txt
#>>>downloadFQ.sh
cat fq.txt |while read i
do
ascp -QT -l 300m -P33001 \
-i ~/micromamba/envs/RNA/etc/asperaweb_id_dsa.openssh \
era-fasp@$i \
.
done
#<<<downloadFQ.sh
nohup sh downloadFQ.sh &> downloadFQ.log &
#制作了check.md5文件
cut -f 9 filereport_read_run_PRJNA510251_tsv.txt | sed '1d' | awk -F ';' '{print $(NF-1)"\n"$NF}' > md5.txt
cut -f 7 -d '/' fq.txt | paste md5.txt - > check.md5
rm md5.txt

#检查md5值是否一样,文件是否下载完整
md5sum -c check.md5 &> check.md5.res

文件重命名

10X官网给指出来了文件名规则:

[https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/using/fastq-input]

[https://support.illumina.com/help/BaseSpace_OLH_009008/Content/Source/Informatics/BS/NamingConvention_FASTQ-files-swBS.htm]

[Sample Name]_S1_L00[Lane Number][Read Type]_001.fastq.gz

Where Read Type is one of:

  • I1: Sample index read (optional)
  • I2: Sample index read (optional)
  • R1: Read 1
  • R2: Read 2

用python制作重命名脚本

from collections import Counter
import numpy as np
import pandas as pd

df=pd.read_csv('filereport_read_run_PRJNA510251_tsv.txt',sep='\t')
# Read Type
r=[1,2] * df.shape[0]

# Sample Name
s=np.repeat(df.experiment_alias.values,2)

# Sample Number; Lane Number
s,l = [],[]
for x,y in enumerate(Counter(sn).values()):
    l += list(range(1,int(y/2)+1))
    s += [x+1] * y
l=np.repeat(l,2)

# new file name
new=[f'{a}_S{b}_L00{c}_R{d}_001.fastq.gz' for a,b,c,d in zip(sn,s,l,r)]

# old file name
fq=[]
for i in df.fastq_aspera:
    fq+=i.split(';')
old=[i.split('/')[-1] for i in fq]

#shell script
df2=pd.DataFrame({1:old,2:new})
df2.insert(0,column=0,value='mv')
df2.to_csv('rename.sh',index=False,header=False,sep=' ')

#sh
bash rename.sh

rename.sh前几行

mv SRR8325947_1.fastq.gz GSM3516662_S1_L001_R1_001.fastq.gz
mv SRR8325947_2.fastq.gz GSM3516662_S1_L001_R2_001.fastq.gz
mv SRR8325948_1.fastq.gz GSM3516662_S1_L002_R1_001.fastq.gz
mv SRR8325948_2.fastq.gz GSM3516662_S1_L002_R2_001.fastq.gz
...

cellranger count

因为资源有限,这里只对GSM3516662和GSM3516663两个样本定量。

cd ~/Project/SC10X/rawdata/
mv GSM3516662* fastqs
mv GSM3516663* fastqs
#>>>quantify.sh
fastqs_dir=~/Project/SC10X/rawdata/fastqs
index_dir=~/DataHub/Genomics/10X/refdata-gex-GRCh38-2020-A
output_dir=~/Project/SC10X/quantify
cd ${output_dir}

ls ${fastqs_dir} | cut -d '_' -f 1 | uniq | while read i
do
cellranger count \
    --id $i \
    --transcriptome ${index_dir} \
    --fastqs ${fastqs_dir} \
    --sample $i \
    --localcores 12 \
    --localmem 128
done
#<<<quantify.sh
nohup sh quantify.sh &> quantify.sh.log &

RuntimeError: ~/Project/SC10X/GSM3516662 is not a pipestance directory

  • GSM3516662目录必须是由cellranger创建,也就是说,在运行cellranger之前GSM3516662目录不存在
  • --id 输出文件目录,每个样本一个输出目录
  • --sample是文件重命名哪一步的[Sample Name]

输出文件

可以参考生信技能树[https://mp.weixin.qq.com/s/VWUmJZnzT7m_7QDjxkbrJw]

需要查看的文件

  • web_summary.html:这个是必须要看的,粗略浏览本次10x样本走cellranger count流程的运行质量
  • filtered_feature_bc_matrix.h5: Python读取表达量矩阵

已经得到表达量矩阵下一步走scanpy分析流程。

Reference

https://mp.weixin.qq.com/s/cu7r7iY2AEKLBdHALzYaCQ

https://mp.weixin.qq.com/s/VWUmJZnzT7m_7QDjxkbrJw

https://mp.weixin.qq.com/s/Fxd9-P79SzvyxwcjUGNL0Q

https://mp.weixin.qq.com/s/6rSMzj8CE-Zw2-EeXyxBYg

https://mp.weixin.qq.com/s/CtQdWfclesbXBVOIPtdzrw

https://blog.csdn.net/herokoking/article/details/103632115

https://www.sci666.com.cn/12239.html

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

标签:01,cellranger,fastq,gz,转录,CellRanger7,https,txt,com
From: https://www.cnblogs.com/BioQuest/p/17099545.html

相关文章

  • 2019年ICPC南昌网络赛 J. Distance on the tree(树链剖分+主席树 查询路径边权第k大)
    DSM(DataStructureMaster)oncelearnedabouttreewhenhewaspreparingforNOIP(NationalOlympiadinInformaticsinProvinces)inSeniorHighSchool.Sowhen......
  • P7585 [COCI2012-2013#1] LJUBOMORA 二分 普及-
    赤裸二分#include<iostream>#include<cmath>usingnamespacestd;constintN=300010;intn,m,rr;intc[N];boolcheck(intmid){intcot=0;for(inti......
  • 训练总结 2018.11.15
    昨天第一次打线上CFdiv2,感觉自己还太嫩了,第一题,从本来读对题意,到读错题意,然后读全题意,但还是读错了,真是,把我弄到上天,比赛结束也没能A,赛后听学长指导,终于明白题意了,A了,自己还......
  • 训练日志 2018.10.11
    昨天晚上打比赛,感觉手好生,题意看了半天,才看懂,然后就是TLE,这回还好一点,马上想到了,修改的算法,但是细节没处理好,WA了,找了好一会才发现代码的错误,第二题就更艰辛了,一开始就跑偏......
  • 训练日记 2018.12.14
        哎,这几天被树形背包搞懵了,一开始感觉没学到啥,做一个题看一个题解,每个题单个来看都能看懂,但是遇到一个新题就不会了,而且你用上一个题的做法做,依旧不对,网上的题解......
  • 树形背包 hdu1011Starship Troopers
    StarshipTroopersTimeLimit:10000/5000MS(Java/Others)    MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):23205    AcceptedSubmission(......
  • 洛谷 P2014 选课 树形依赖背包
    题目描述在大学里每个学生,为了达到一定的学分,必须从很多课程里选择一些课程来学习,在课程里有些课程必须在某些课程之前学习,如高等数学总是在其它课程之前学习。现在有N门功......
  • 树形DP依赖背包 洛谷 P2015 二叉苹果树
    题目描述有一棵苹果树,如果树枝有分叉,一定是分2叉(就是说没有只有1个儿子的结点)这棵树共有N个结点(叶子点或者树枝分叉点),编号为1-N,树根编号一定是1。我们用一根树枝两端连接的......
  • GStreamer基础教程01 - Hello World
    摘要在面对一个新的软件库时,第一步通常实现一个“helloworld”程序,来了解库的用法。对于GStreamer,我们可以实现一个极简的播放器,来了解GStreamer的使用。 环境配置为......
  • [08001][unixODBC]zabbix 6.2 [Microsoft][ODBC Driver 18 for SQL Server]SSL Provid
    环境:Centos9stream 这个问题大致原因是,数据库证书认证失败。先说解决方法:1.首先确保openssl是1.1.1版本的,如果是3.2.0可以尝试卸载该版本或重装系统为linux Centos8str......