cfDNAPro|cfDNA片段数据生物学表征及可视化的R包

简介: cfDNA是指存在于血液中的游离DNA片段,来源于正常和异常细胞的死亡。这些片段长度通常为160-180碱基对,研究cfDNA在非侵入性诊断、疾病监测、早期检测和理解生理及病理状态方面有重要意义。cfDNAPro是一个工具,用于分析cfDNA的片段长度分布,提供数据表征和可视化。它能展示片段长度的整体、中位数和众数,以及峰和谷的分布,还有振荡周期性。通过上图和下图的对比,可以观察到不同队列中cfDNA片段长度的差异。此外,cfDNAPro还能展示DNA片段的模态长度,分析10bp周期性振荡模式,帮助科学家深入了解cfDNA的特征。

[toc]

前言

cfDNA(无细胞DNA,游离DNA,Circulating free DNA or Cell free DNA)是指在血液循环中存在的DNA片段。这些DNA片段不属于任何细胞,因此被称为“无细胞”或“游离”的。cfDNA来源广泛,可以来自正常细胞和病变细胞(如肿瘤细胞)的死亡和分解过程。cfDNA的长度通常在160-180碱基对左右,这与核小体保护的DNA片段长度相符。

cfDNA的研究对于非侵入性诊断、疾病监测、早期检测以及了解生理和病理状态具有重要意义。特别是在肿瘤学领域,通过分析循环肿瘤DNA(ctDNA),即来源于肿瘤细胞的cfDNA,可以获取肿瘤的遗传信息,从而指导癌症的诊断、治疗选择和治疗效果监测。

cfDNAPro

主要功能:

  • 数据表征: 计算片段大小分布的整体、中位数和众数,以及片段大小轮廓中的峰和谷,还有振荡周期性。
  • 数据可视化: 提供了多种函数来可视化这些数据,包括整体到单个片段的可视化、度量可视化、模式和摘要可视化等。

demo

1.片段长度可视化

  • 上图:横轴表示片段长度,范围为30bp至500bp。纵轴表示具有特定读取长度的读取比例。这里的线并不是平滑曲线,而是连接不同数据点的直线。
  • 下图:首先统计长度小于或等于30bp的读取数量(例如N),然后将其归一化为比例。重复这一过程,直至处理完所有片段长度(即30bp, 31bp, …, 500bp),然后以线图的形式呈现。与非累积图一样,这里的线也是连接各个数据点,而不是平滑曲线。
library(scales)
library(ggpubr)
library(ggplot2)
library(dplyr)
# Define a list for the groups/cohorts.
grp_list<-list("cohort_1"="cohort_1",
               "cohort_2"="cohort_2",
               "cohort_3"="cohort_3",
               "cohort_4"="cohort_4")
# Generating the plots and store them in a list.
result<-sapply(grp_list, function(x){
  result <-callSize(path = data_path) %>% 
    dplyr::filter(group==as.character(x)) %>% 
    plotSingleGroup()
}, simplify = FALSE)
#> setting default outfmt to df.
#> setting default input_type to picard.
#> setting default outfmt to df.
#> setting default input_type to picard.
#> setting default outfmt to df.
#> setting default input_type to picard.
#> setting default outfmt to df.
#> setting default input_type to picard.
# Multiplexing the plots in one figure
suppressWarnings(
  multiplex <-
    ggarrange(result$cohort_1$prop_plot + 
              theme(axis.title.x = element_blank()),
            result$cohort_4$prop_plot + 
              theme(axis.title = element_blank()),
            result$cohort_1$cdf_plot,
            result$cohort_4$cdf_plot + 
              theme(axis.title.y = element_blank()),
            labels = c("Cohort 1 (n=5)", "Cohort 4 (n=4)"),
            label.x = 0.2,
            ncol = 2,
            nrow = 2))
multiplex

image.png

2.片段长度分布比较

  • callMetrics:计算了每个组的中位片段大小分布
  • 上图:每个队列中位数片段大小分布的比例。y轴显示读取比例,x轴显示片段大小。图中显示的线不是平滑的曲线,而是连接不同数据点的线
  • 下图:中位数累积分布函数(CDF)的图形。y轴显示累积比例,x轴仍然显示片段大小。这是一个逐步上升的图形,反映了不同片段大小下读取的累积分布情况。
# Set an order for those groups (i.e. the levels of factors).
order <- c("cohort_1", "cohort_2", "cohort_3", "cohort_4")
# Generate plots.
compare_grps<-callMetrics(data_path) %>% plotMetrics(order=order)
#> setting default input_type to picard.
# Modify plots.
p1<-compare_grps$median_prop_plot +
  ylim(c(0, 0.028)) +
  theme(axis.title.x = element_blank(),
        axis.title.y = element_text(size=12,face="bold")) +
  theme(legend.position = c(0.7, 0.5),
        legend.text = element_text( size = 11),
        legend.title = element_blank())
p2<-compare_grps$median_cdf_plot +
  scale_y_continuous(labels = scales::number_format(accuracy = 0.001)) +
  theme(axis.title=element_text(size=12,face="bold")) +
  theme(legend.position = c(0.7, 0.5),
        legend.text = element_text( size = 11),
        legend.title = element_blank())
# Finalize plots.
suppressWarnings(
  median_grps<-ggpubr::ggarrange(p1,
                       p2,
                       label.x = 0.3,
                       ncol = 1,
                       nrow = 2
                       ))
median_grps

image.png

3.可视化DNA片段模态长度

  • 柱状图:这里的模态片段大小是指在样本中出现次数最多的DNA片段长度
# Set an order for your groups, it will affect the group order along x axis!
order <- c("cohort_1", "cohort_2", "cohort_3", "cohort_4")
# Generate mode bin chart.
mode_bin <- callMode(data_path) %>% plotMode(order=order,hline = c(167,111,81))
#> setting default mincount as 0.
#> setting default input_type to picard.
# Show the plot.
suppressWarnings(print(mode_bin))

image.png


  • 堆叠柱状图:可以看到每个组中不同长度片段的分布
# Set an order for your groups, it will affect the group order along x axis.
order <- c("cohort_1", "cohort_2", "cohort_3", "cohort_4")
# Generate mode stacked bar chart. You could specify how to stratify the modes
# using 'mode_partition' arguments. If other modes exist other than you 
# specified, an 'other' group will be added to the plot.
mode_stacked <- 
  callMode(data_path) %>% 
  plotModeSummary(order=order,
                  mode_partition = list(c(166,167)))
#> setting default input_type to picard.
# Modify the plot using ggplot syntax.
mode_stacked <- mode_stacked + theme(legend.position = "top")
# Show the plot.
suppressWarnings(print(mode_stacked))

image.png


4.片段化振荡模式比较

  • 间峰距离:通过测量和比较间距距离(峰值之间的距离),比较不同队列中的10bp周期性振荡模式
# Set an order for your groups, it will affect the group order.
order <- c("cohort_1", "cohort_2", "cohort_4", "cohort_3")
# Plot and modify inter-peak distances.
  inter_peak_dist<-callPeakDistance(path = data_path,  limit = c(50, 135)) %>%
  plotPeakDistance(order = order) +
  labs(y="Fraction") +
  theme(axis.title =  element_text(size=12,face="bold"),
        legend.title = element_blank(),
        legend.position = c(0.91, 0.5),
        legend.text = element_text(size = 11))
#> setting the mincount to 0.
#>  setting the xlim to c(7,13). 
#>  setting default outfmt to df.
#> Setting default mincount to 0.
#> setting default input_type to picard.
# Show the plot.
suppressWarnings(print(inter_peak_dist))

  • 间谷距离:与之前介绍的间峰距离可视化相比,间谷距离的可视化重点在于表示读取次数下降的区域,而不是上升的区域。这两个图表的区别在于它们关注的是碎片大小谱的不同特点,一个是峰点(即频率的局部最高点),另一个是谷点(即频率的局部最低点)。
# Set an order for your groups, it will affect the group order.
order <- c("cohort_1", "cohort_2", "cohort_4", "cohort_3")
# Plot and modify inter-peak distances.
inter_valley_dist<-callValleyDistance(path = data_path,  
                                      limit = c(50, 135)) %>%
  plotValleyDistance(order = order) +
  labs(y="Fraction") +
  theme(axis.title =  element_text(size=12,face="bold"),
        legend.title = element_blank(),
        legend.position = c(0.91, 0.5),
        legend.text = element_text(size = 11))
#> setting the mincount to 0. 
#>  setting the xlim to c(7,13). 
#>  setting default outfmt to df.
#> setting the mincount to 0.
#> setting default input_type to picard.
# Show the plot.
suppressWarnings(print(inter_valley_dist))

5. ggplot2美化

library(ggplot2)
library(cfDNAPro)
# Set the path to the example sample.
exam_path <- examplePath("step6")
# Calculate peaks and valleys.
peaks <- callPeakDistance(path = exam_path) 
#> setting default limit to c(35,135).
#> setting default outfmt to df.
#> Setting default mincount to 0.
#> setting default input_type to picard.
valleys <- callValleyDistance(path = exam_path) 
#> setting default limit to c(35,135).
#> setting default outfmt to df.
#> setting the mincount to 0.
#> setting default input_type to picard.
# A line plot showing the fragmentation pattern of the example sample.
exam_plot_all <- callSize(path=exam_path) %>% plotSingleGroup(vline = NULL)
#> setting default outfmt to df.
#> setting default input_type to picard.
# Label peaks and valleys with dashed and solid lines.
exam_plot_prop <- exam_plot_all$prop + 
  coord_cartesian(xlim = c(90,135),ylim = c(0,0.0065)) +
  geom_vline(xintercept=peaks$insert_size, colour="red",linetype="dashed") +
  geom_vline(xintercept = valleys$insert_size,colour="blue")
# Show the plot.
suppressWarnings(print(exam_plot_prop))

# Label peaks and valleys with dots.
exam_plot_prop_dot<- exam_plot_all$prop + 
  coord_cartesian(xlim = c(90,135),ylim = c(0,0.0065)) +
  geom_point(data= peaks, 
             mapping = aes(x= insert_size, y= prop),
             color="blue",alpha=0.5,size=3) +
  geom_point(data= valleys, 
             mapping = aes(x= insert_size, y= prop),
             color="red",alpha=0.5,size=3) 
# Show the plot.
suppressWarnings(print(exam_plot_prop_dot))


想做cfDNA,迈出分析的第一步,数据表征。

目录
相关文章
|
1天前
|
机器学习/深度学习 数据可视化 PyTorch
零基础入门语义分割-地表建筑物识别 Task5 模型训练与验证-学习笔记
零基础入门语义分割-地表建筑物识别 Task5 模型训练与验证-学习笔记
460 2
|
1天前
|
机器学习/深度学习 算法 机器人
【论文速递】TMM2023 - FECANet:用特征增强的上下文感知网络增强小样本语义分割
【论文速递】TMM2023 - FECANet:用特征增强的上下文感知网络增强小样本语义分割
|
1天前
|
机器学习/深度学习
零基础入门语义分割-地表建筑物识别 Task6 模型集成-学习笔记
零基础入门语义分割-地表建筑物识别 Task6 模型集成-学习笔记
40 1
|
1天前
|
机器学习/深度学习 PyTorch 数据处理
零基础入门语义分割-地表建筑物识别 Task2 数据扩增-学习笔记
零基础入门语义分割-地表建筑物识别 Task2 数据扩增-学习笔记
42 1
|
6月前
bert知识库问答 实现建筑领域的问答匹配 文本相似性计算 完整代码数据
bert知识库问答 实现建筑领域的问答匹配 文本相似性计算 完整代码数据
64 0
|
9月前
|
数据可视化 数据挖掘 Linux
转录组下游分析丨利用limma包进行差异表达分析,结果可视化绘制火山图和热图
转录组下游分析丨利用limma包进行差异表达分析,结果可视化绘制火山图和热图
|
9月前
|
JSON 算法 数据格式
优化cv2.findContours()函数提取的目标边界点,使语义分割进行远监督辅助标注
可以看到cv2.findContours()函数可以将目标的所有边界点都进行导出来,但是他的点存在一个问题,太过密集,如果我们想将语义分割的结果重新导出成labelme格式的json文件进行修正时,这就会存在点太密集没有办法进行修改,这里展示一个示例:没有对导出的结果进行修正,在labelme中的效果图。
90 0
|
11月前
|
数据库
3-华大时空组学分析软件 Spateo 细胞分割示例
本分示例了使用 华大时空组学分析软件 Spateo 基于SSDNA和 表达谱进行圈细胞的用法,以供参考
150 0
|
机器学习/深度学习 人工智能 数据库
许锦波团队开发蛋白逆折叠深度学习框架,用更少结构数据训练获得更准确序列预测
许锦波团队开发蛋白逆折叠深度学习框架,用更少结构数据训练获得更准确序列预测
129 0
|
数据采集 机器学习/深度学习 JSON
【Pytorch神经网络实战案例】32 使用Transformers库的管道方式实现:加载指定模型+文本分类+掩码语言建模+摘要生成+特征提取+阅读理解+实体词识别
在Transformers库中pipeline类的源码文件pipelines.py里,可以找到管道方式自动下载的预编译模型地址。可以根据这些地址,使用第三方下载工具将其下载到本地。
518 0