叶绿体基因组覆盖深度绘图

本文介绍了叶绿体基因组深度绘图分析的全过程,包括数据准备(如组装fasta文件和测序原始文件处理)、序列调整、使用Bowtie2进行比对、深度文件的获取和处理,以及最后利用ggplot2进行图形化展示。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

叶绿体基因组深度绘图分析总流程

##B站视频讲解链接

准备数据

1 叶绿体基因组组装fasta文件

2 测序原始文件(fastq, fastq.gz)

本次测试数据来自于https://blog.csdn.net/salty_fish_xu/article/details/127469392?spm=1001.2014.3001.5502

序列调整

将序列调整至大单拷贝区第一个碱基作为序列的起始,该功能可以使用CPStools中的IR.py实现

经鉴定其四分体结构为

LSC:1-84846 IRb:84847-110900 SSC:110901-129191 IRa:129192-155245

获取深度文件

# 构建索引
bowtie2-build test.fasta ref  # test.fasta 为组装结果
# 数据mapping
bowtie2 --very-sensitive-local -x ref -1 1.fq  -2 2.fq  -p 60  > map2ref.sam &
# 提取可以比对上的序列
samtools view -h -F 4 map2ref.sam -@ 20 > mapped.bam
# bam文件排序
samtools sort -o mapped_sort.bam -@ 20 mapped.bam
# 构建bam 文件索引
samtools index mapped_sort.bam -@ 20 mapped_sort.bam.bai
# 统计深度
samtools depth mapped_sort.bam  > depth.txt

步长合并

import os
# 脚本只需要修改file_path 和 output_file
# file_path是上一步生成的深度文件depth.txt
# output_file是2000步长的合并文件
file_path = open(r'/Users/xuwenbo/Desktop/testttttt/depth2/depth.txt', 'r') # input file
output_file = r'/Users/xuwenbo/Desktop/testttttt/depth2/depth_2000.txt'

cont = file_path.readlines()

with open(output_file, 'w') as ff: # output file
    for i in range(len(cont)):
        if i % 2000 == 0:
            start = i
            end = min(i + 2000, len(cont))  # 确保不超过列表的长度
            middle = start + (end - start) // 2  # 计算实际区间中点
            all_sum = 0
            for j in range(start, end):
                all_sum += int(cont[j].split('\t')[2])
            average_depth = round(all_sum / (end - start), 0)
            ff.write(f"{middle}\t{average_depth}\n"

深度绘图

library(ggplot2)
library(data.table)
data <- read.table('/Users/xuwenbo/Desktop/testttttt/depth2/depth_2000.txt', sep = '\t')

data2 <- fread('/Users/xuwenbo/Desktop/testttttt/depth2/depth.txt', sep = '\t', drop = 1)

## 步长2000绘图
# geom_rect中四个xmin=1000, xmax=84846,需要根据自己的四分体长度进行修改
p1 <- ggplot(data, aes(V1, V2)) + 
  geom_bar(stat = 'identity', width = 800, fill = "lightblue") + 
  ylim(0,1200) + theme_classic() + xlab("Sequence length") + 
  ylab("Mean base depth")+
  geom_rect(aes(xmin=1000, xmax=84846, ymin=0, ymax=0.5), 
            fill="lightblue", colour="blue", size=1.5) +
  geom_rect(aes(xmin=84847, xmax=110900, ymin=0, ymax=0.5), 
            fill="lightgreen", colour="green", size=1.5) +
  geom_rect(aes(xmin=110901, xmax=129191, ymin=0, ymax=0.5), 
            fill="lightpink", colour="red", size=1.5) +
  geom_rect(aes(xmin=129192, xmax=154622, ymin=0, ymax=0.5), 
            fill="lightgray", colour="black", size=1.5)

p1

## 所有位点绘图
p2 <- ggplot(data2, aes(V2, V3)) + 
  geom_bar(stat = 'identity', fill = "lightblue") + 
  ylim(0,1200) + theme_classic() + xlab("Sequence length") + 
  ylab("Mean base depth")+
  geom_rect(aes(xmin=1, xmax=84846, ymin=0, ymax=0.5), 
            fill="lightblue", colour="blue", size=1.5) +
  geom_rect(aes(xmin=84847, xmax=110900, ymin=0, ymax=0.5), 
            fill="lightgreen", colour="green", size=1.5) +
  geom_rect(aes(xmin=110901, xmax=129191, ymin=0, ymax=0.5), 
            fill="lightpink", colour="red", size=1.5) +
  geom_rect(aes(xmin=129192, xmax=155245, ymin=0, ymax=0.5), 
            fill="lightgray", colour="black", size=1.5)

p2

# 合并两张图
library(cowplot)
combined_plot <- plot_grid(p1, p2, nrow = 2, align = "v", labels = c("A", "B"))
combined_plot

图片展示

深度绘图

### 叶绿体基因组组装工具及流程 #### 工具介绍 GetOrganelle 是一种高效的叶绿体基因组组装工具,广泛用于从高通量测序数据中提取并组装完整的叶绿体基因组[^2]。该工具不仅支持叶绿体基因组的组装,还具备高性能、易用性和自动化的特点,适合大多数被子植物样本的研究需求。 #### 安装方法 可以通过 Conda 轻松安装 GetOrganelle,具体命令如下: ```bash conda install -c bioconda getorganelle ``` #### 数据准备 在进行叶绿体基因组组装之前,通常需要对原始测序数据进行预处理,以去除低质量读段和其他干扰因素。这一步骤可能涉及去除适配器序列、过滤短片段以及修正碱基错误等操作[^4]。 #### 组装流程 以下是基于 GetOrganelle 的典型叶绿体基因组组装流程: 1. **构建图谱** 使用 `get_organelle_from_reads.py` 命令来生成初步的 de Bruijn 图,并从中识别潜在的叶绿体相关路径。 ```bash python get_organelle_from_reads.py -1 reads_1.fq.gz -2 reads_2.fq.gz -o output_directory --threads 8 ``` 2. **参数优化** GetOrganelle 自动估算 word size 和其他关键参数,减少手动干预的需求。如果需要自定义设置,可通过 `-k` 参数指定 k-mer 大小。 3. **路径扩展与验证** 在初始图的基础上进一步延伸路径,并利用内置算法检测环状结构的可能性。此过程有助于确认最终的叶绿体基因组图谱是否闭合。 4. **结果导出** 将组装完成后的 contig 或 scaffold 导出为 FASTA 文件形式以便后续分析。 ```bash cat output_directory/contigs.fa > chloroplast_genome.fasta ``` 5. **可视化与校正** 利用第三方软件(如 Bandage)加载生成的 GFA 文件,直观展示装配效果;必要时可借助 PCR 实验或其他独立证据补充缺失区域或纠正错误连接点[^3]。 #### 技术优势 相比传统方法,GetOrganelle 提供了更快的速度和更高的准确性,在模拟及实际测试案例中的表现均优于同类竞争者[^1]。 ---
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值