首页 > 其他分享 >单细胞转录组上游fasta文件处理

单细胞转录组上游fasta文件处理

时间:2024-07-29 18:39:27浏览次数:9  
标签:outs dropseqRunner -- cellranger gz zengchuanj 转录 单细胞 fasta

单细胞分析上游fasta文件处理

——基于cellranger与dropseqRunner

 

###如果测序文件由10X genomics平台产生,则采用cellranger count的基本流程进行fasta文件的上游处理;如果测序文件由dropseq平台产生,则采用dropseqRunner软件进行处理

一、cellranger配置

1、软件安装并查看帮助文档

#安装包下载

wget -O cellranger-7.1.0.tar.gz "https://cf.10xgenomics.com/releases/cell-exp/cellranger-7.1.0.tar.gz?Expires=1694703729&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9jZi4xMHhnZW5vbWljcy5jb20vcmVsZWFzZXMvY2VsbC1leHAvY2VsbHJhbmdlci03LjEuMC50YXIuZ3oiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2OTQ3MDM3Mjl9fX1dfQ__&Signature=YmIZ3TsEI7VxGNIY7SdL~8oH0jr7ktjMZ48HRiLDQfcYLN4YWcs5nk0CZeKkeemvygGK3VryeHnvZpA21r2jN2YKfSeAHC03t-aDKzjctzbPvnv9UbckvrOghyxW7mH14W7uzMJJ1C9PbBo869EDRH04vxfsYGFQONCxvb~iBamTU1ZJ-6etWVioLjzb7o4-Y3v4v46nw67qf2NaPTwNXr4PIA-vFdWe9v9YhQQM6VlHR8a5crTmaM39hGC~2PatW0qlEd-DsMHeeNb34~Gr5N8XNIHv6K1VcuMq8VobqLQKxeoz3obmA23~kWkPNOSZNCVXosd0p6Ok7fUHiVUt-Q__&Key-Pair-Id=APKAI7S6A5RYOXBWRPDA" &

#解压文件

tar -zxvf cellranger-7.0.1.tar.gz

#把cellranger的路径加到$PATH中方便调用

vi ~/.bashrc

export PATH=”/data5/tan/zengchuanj/Software/cellranger-7.1.0/bin:$PATH”

echo 'export PATH=/data5/tan/zengchuanj/Software/cellranger-7.1.0/:$PATH' >> ~/.bashrc

#更新系统配置文件

source  ~/.bashrc

#查看cellranger使用说明

cellranger count --help

 

2、参考基因组下载

#人类参考基因组数据集

wget -o human.log https://cf.10xgenomics.com/supp/cell-exp/refdata-gex-GRCh38-2020-A.tar.gz &

tar -xvf refdata-gex-GRCh38-2020-A.tar.gz

#mouse参考基因组数据集下载

wget -o mouse.log https://cf.10xgenomics.com/supp/cell-exp/refdata-gex-mm10-2020-A.tar.gz &

tar -xvf refdata-gex-mm10-2020-A.tar.gz

#测试数据集下载

wget -o sample.log 'http://cf.10xgenomics.com/samples/cell-exp/2.1.0/neurons_900/neurons_900_fastqs.tar' &

tar -xvf neurons_900_fastqs.tar #解压

cellranger count --id=result --transcriptome=../refdata-gex-mm10-2020-A/ --fastqs=/neurons_900_fastqs --sample=neurons_900 --expect-cells=1000 --nosecondary

 

 Attention:#count函数参数解释

 cellranger count --id=sample \

                   --transcriptome=/opt/refdata-cellranger-GRCh38-1.2.0 \

                   --fastqs=/home/scRNA/runs/HAWT7ADXX/outs/fastq_path \

                   --sample=mysample \

                   --expect-cells=1000 \

                   --nosecondary

# id指定输出文件存放目录名

# transcriptome指定与CellRanger兼容的参考基因组

# fastqs指定mkfastq或者自定义的测序文件

# sample要和fastq文件的前缀中的sample保持一致,作为软件识别的标志

# expect-cells指定复现的细胞数量,这个要和实验设计结合起来

# nosecondary 只获得表达矩阵,不进行后续的降维、聚类和可视化分析(反正后续要走Seurat,为了节省计算资源,建议加上)

 

3、结果解读

 

Ref:https:/zhuanlan.zhihu.com/p/390516422

Outputs:

- Run summary HTML:                      /data5/tan/zengchuanj/pipeline/cellranger/result/outs/web_summary.html

- Run summary CSV:                       /data5/tan/zengchuanj/pipeline/cellranger/result/outs/metrics_summary.csv

- BAM:                                   /data5/tan/zengchuanj/pipeline/cellranger/result/outs/possorted_genome_bam.bam

- BAM index:                             /data5/tan/zengchuanj/pipeline/cellranger/result/outs/possorted_genome_bam.bam.bai

- Filtered feature-barcode matrices MEX:    /data5/tan/zengchuanj/pipeline/cellranger/result/outs/filtered_feature_bc_matrix

- Filtered feature-barcode matrices HDF5:   /data5/tan/zengchuanj/pipeline/cellranger/result/outs/filtered_feature_bc_matrix.h5

- Unfiltered feature-barcode matrices MEX:  /data5/tan/zengchuanj/pipeline/cellranger/result/outs/raw_feature_bc_matrix

- Unfiltered feature-barcode matrices HDF5: /data5/tan/zengchuanj/pipeline/cellranger/result/outs/raw_feature_bc_matrix_h5.h5

- Secondary analysis output CSV:         /data5/tan/zengchuanj/pipeline/cellranger/result/outs/analysis

- Per-molecule read information:         /data5/tan/zengchuanj/pipeline/cellranger/result/outs/molecule_info.h5

- Loupe Browser file:               /data5/tan/zengchuanj/pipeline/cellranger/result/outs/cloupe.cloupe

 

  1. outs/raw_feature_bc_matrix: 这个文件夹包含原始的基因表达矩阵,每一行代表一个基因,每一列代表一个细胞。这个矩阵中的值表示每个细胞中每个基因的表达水平。这个矩阵没有经过任何的标准化或过滤。

 

  1. outs/filtered_feature_bc_matrix: 这个文件夹包含经过过滤后的基因表达矩阵。在这个矩阵中,已经去除了低质量的细胞和低表达的基因。这是进行后续分析的主要输入。此文件夹包含三个文件:barcodes.tsv.gz、features.tsv.gz和matrix.mtx.gz。这些文件包含了每个细胞的条形码、每个特征的名称和每个细胞中每个特征的计数。

 

  1. outs/metrics_summary.csv: 这个CSV文件包含了关于每个细胞和每个样本的一些质量控制指标,例如细胞计数、平均基因表达水平等。

 

  1. outs/web_summary.html: 这个HTML文件提供了一个交互式的可视化界面,用于查看分析的总结结果,包括细胞计数、质量控制指标、细胞类型聚类等。

 

  1. outs/cloupe.cloupe: 这是一个文件,可以用于在10x Genomics的Loupe浏览器中查看和分析单细胞数据。Loupe浏览器提供了丰富的数据可视化和分析功能。

 

二、dropseqRunner的配置

1、conda的安装

dropseqRunner是个依赖conda和python的环境,在安装前确保自己的服务器中有与之兼容的conda与python

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

bash Anaconda3-5.3.1-Linux-x86_64.sh

2、Dropseq的安装

wget https://codeload.github.com/aselewa/dropseqRunner/zip/master

mv master master.zip

unzip master.zip

#创建dropseq运行的conda环境

conda env create -f environment.yaml

#每次运行dropseq前需要进行激活,不激活环境则无法调用snakemake

conda activate dropRunner

#编译,不编译无法出现主脚本

make

 

3、下载参考数据并构建比对索引

#这里以小鼠的为例

wget -o mm.log https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/001/635/GCF_000001635.27_GRCm39/GCF_000001635.27_GRCm39_genomic.fna.gz &

#安装处理gff文件软件

conda install gffread

#将gff文件转换为gtf文件

gffread GCF_000001635.27_GRCm39_genomic.gff -T -o mice.gtf

#建参考数据库

STAR --runThreadN 4 --runMode genomeGenerate --genomeDir reference/ --genomeFastaFiles  GCF_000001635.27_GRCm39_genomic.fna --sjdbGTFfile mice.gtf

 

4、Dropseq使用方法

python /dropseqRunner-master/dropRunner.py  --R1 SRR11799731_R1.fastq.gz --R2 SRR11799731_R2.fastq.gz --indices /dropseqRunner-master/db/reference --sample SRR11799731 --protocol drop

#主程序使用方法

#各个参数:

#R1 R2,分别是你的两个fastq文件

#--indices是刚才构建好的参考数据集

#--sample是样本前缀名

#运行完毕后用于Seurat的数据存在/sample/output/SRR11799731_0_Solo.out/Gene

 

 

三、Error自查

Attention error:主要是下载、安装、配置上的问题

1、 dropseqRunner下载问题

#下载dropseq

git clone [email protected]:aselewa/dropseqRunner.git

cd dropseqRunner

这个问题是关于使用Git克隆dropseqRunner时出现了权限拒绝错误。错误信息是“Permission denied (publickey)”。

这个错误通常是由于缺少SSH密钥或使用了错误的SSH密钥导致的。以下是一些可能的解决方法:

  • 检查SSH密钥

在本地计算机上生成SSH密钥,并将公钥添加到GitHub帐户中。可以使用以下命令检查是否存在SSH密钥:

   ls -al ~/.ssh

 

   如果没有SSH密钥,请使用以下命令生成:

   ssh-keygen -t rsa -b 4096 -C "[email protected]"

   然后将公钥添加到GitHub帐户中。

  • 使用HTTPS URL

使用HTTPS URL而不是SSH URL来克隆dropseqRunner。使用以下命令:

   git clone https://github.com/aselewa/dropseqRunner.git

   这将使用HTTPS URL克隆`dropseqRunner`,而不需要SSH密钥。

  • 检查GitHub帐户权限

确保你的GitHub帐户具有克隆dropseqRunner的权限。如果您没有访问权限,请联系仓库的所有者以获取访问权限。

Ps:如果这些都解决不了,建议开始摆烂

  • wget登场

wget https://codeload.github.com/aselewa/dropseqRunner/zip/master

之前以为Github仓库的master分支基本上应该是提交代码的记录,实际master是个二进制文件,后续发现实际应该是个.zip文件。

2、dropseqRunner配置问题

这一问题主要是因为environment.yaml下载错误,重新下载安装即可。

标签:outs,dropseqRunner,--,cellranger,gz,zengchuanj,转录,单细胞,fasta
From: https://www.cnblogs.com/zcj-0928/p/18330797

相关文章

  • thinkphp: 安装fastadmin
    一,官方地址:1,官方站:https://www.fastadmin.net/2,文档地址:https://doc.fastadmin.net/docs/install.html 二,安装:1,下载:下载地址:https://www.fastadmin.net/download.html如图2,解压fastadmin安装包到服务器,并解压:liuhongdi@lhdpc:/data/site/admin/fast$u......
  • 如何在 FastAPI 中手动创建 UploadFile?
    背景我正在尝试为我的FastAPI应用程序编写测试。我有一个对象ImageRecord,它将图像上传到S3。方法签名如下:asyncdefupload_image(file:UploadFile,s3_client=None)->'ImageRecord':API逻辑(即实际的@app.post函数)调用此方法来上传对象。我想......
  • 使用 Axios HTTP 客户端通过 GET 请求调用 FastAPI 后端时收到 422 错误响应
    我正在尝试从我的Vue3客户端(使用GETJavaScriptHTTP客户端)向FastAPI服务器发出axios请求,但我收到422unprocessableentity错误响应。据我了解,这种错误消息与错误的输入有关。这是vue3代码:import{authToken}from"../main.js"expo......
  • 如何在 FastAPI 中间件中以不同方式捕获或处理 RequestValidationError 异常?
    如何正确组合RequestValidationError异常处理程序,如:@app.exception_handler(RequestValidationError)asyncdefvalidation_exception_handler(request,exc):response=prepare_response({},g_ERROR__INCORRECT_PARAMS)returnJSONResponse(content=re......
  • 在 FastAPI + JWT 身份验证中如何最好地实现 is_active ?
    我的用户模型有一个字段is_active。如果为假,则说明该用户的账户被封锁。在这种情况下如何实施访问限制?我应该拒绝用户访问某些端点吗?执行此检查的最佳地点在哪里?如果is_active=False,它是否应该在get_current_user依赖项中?我的依赖项函数get_current_userasyncdefg......
  • 在 FastAPI 中更改来自 MySQL 的数据类型输入
    我的这一行有“serialize_response”错误:@app.get("/get-sensors/",response_model=List[Data])和这个:return{"status":"success","list":data}我该如何解决这个问题!我想获取字典类型的数据为了解决在FastAPI中更改来自MySQL的数据类型输入时遇到的......
  • 如何使用aioprometheus和FastAPI向外部服务添加指标?
    我正在尝试在使用aioprometheus构建的应用程序中使用FastAPI向外部服务添加指标。这是我想要实现的目标的简化示例。假设我有一个这样的包装器App类:fromaioprometheusimportRegistry,Counter,HistogramfromfastapiimportFastAPIclassApp:......
  • fastadmin 共用函数
    //XML转数组if(!function_exists('xmlToArray')){/***XML转数组*@paramxmlXML数组*@returnstring返回图片地址*/functionxmlToArray(string$xml,$oldStr=[],$newStr=[]){//过滤特殊xml格式if......
  • 一个 put 端点是否有可能在 fastapi、pydantic 上拥有超过 1 种类型的参数
    因此,首先,这个问题的目标是获得更多有关是否可能以及害虫做法的知识。有3种类型的用户7、6为普通用户5,4是出版商3,2是经理1是admin我使用此函数来专用user_role这是第一个问题我会经常使用这个函数,我想了一下,我可以将user_role添加到JWT令牌,但我认......
  • FastAPI - 如何处理 websocket 端点中的通用异常
    我想了解在FastAPI应用程序中处理websocket端点异常的推荐方法是什么。我尝试过:app.add_exception_handler(Exception,handle_generic_exception)它捕获Exception,但它没有捕获,例如ValueError|||我也尝试过使用但它似乎不适用于web......