rmats2sashimiplot:基于 MISO 的可视化工具项目

可用于可视化 rMATS 输出或基因组坐标的可变剪切事件,通过 SAM/BAM 文件生成 sashimi 图,支持分组样本比较,计算平均包含水平和读深,灵活展示剪切差异。【此简介由AI生成】

Branch6Tags5
This repository is empty

rmats2sashimiplot

最新版本 Bioconda 总安装量 PyPI 安装量 Docker 总拉取量

关于

rmats2sashimiplot 可将 rMATS 的输出结果生成为 sashimi 图。rmats2sashimiplot 也能利用注释文件和基因组坐标生成图表。其绘图后端为 MISO

目录

依赖项

  • Python 2.7(运行 2to3.sh 后可使用 Python 3)
    • numpy
    • scipy
    • matplotlib
    • pysam
  • Samtools
  • bedtools

rmats2sashimiplot 适用于基于 Unix 的环境。

安装

rmats2sasmimiplot 无需安装即可运行:

python ./src/rmats2sashimiplot/rmats2sashimiplot.py

rmats2sashimiplot 可通过以下方式安装:

python ./setup.py install

rmats2sashimiplot 可通过以下方式更新:

pip uninstall rmats2sashimiplot
python ./setup.py install

如果已安装,rmats2sashimiplot 可直接运行:

rmats2sashimiplot

使用方法

可视化/索引前必须对 BAM 文件进行排序。

示例中使用的测试数据可从以下链接获取:https://sourceforge.net/projects/rnaseq-mats/files/rmats2sashimiplot/rmats2sashimiplot_test_data.tar.gz/download

示例

带有 rMATS 事件的 SAM 文件

rmats2sashimiplot --s1 ./rmats2sashimiplot_test_data/sample_1_replicate_1.sam,./rmats2sashimiplot_test_data/sample_1_replicate_2.sam,./rmats2sashimiplot_test_data/sample_1_replicate_3.sam --s2 ./rmats2sashimiplot_test_data/sample_2_replicate_1.sam,./rmats2sashimiplot_test_data/sample_2_replicate_2.sam,./rmats2sashimiplot_test_data/sample_2_replicate_3.sam --event-type SE -e ./rmats2sashimiplot_test_data/SE.MATS.JC.txt --l1 SampleOne --l2 SampleTwo --exon_s 1 --intron_s 5 -o test_events_output

无需直接在命令行上提供 .sam 路径,而是可以提供文本文件,其中第一行为用逗号分隔的路径:--s1 s1.txt--s2 s2.txt。s1.txt 包含:

./rmats2sashimiplot_test_data/sample_1_replicate_1.sam,./rmats2sashimiplot_test_data/sample_1_replicate_2.sam,./rmats2sashimiplot_test_data/sample_1_replicate_3.sam

s2.txt 将包含:

./rmats2sashimiplot_test_data/sample_2_replicate_1.sam,./rmats2sashimiplot_test_data/sample_2_replicate_2.sam,./rmats2sashimiplot_test_data/sample_2_replicate_3.sam

img/plotwithevent.png

包含坐标和注释的 BAM 文件

rmats2sashimiplot --b1 ./rmats2sashimiplot_test_data/sample_1_replicate_1.bam,./rmats2sashimiplot_test_data/sample_1_replicate_2.bam,./rmats2sashimiplot_test_data/sample_1_replicate_3.bam --b2 ./rmats2sashimiplot_test_data/sample_2_replicate_1.bam,./rmats2sashimiplot_test_data/sample_2_replicate_2.bam,./rmats2sashimiplot_test_data/sample_2_replicate_3.bam -c chr16:+:9000:25000:./rmats2sashimiplot_test_data/annotation.gff3 --l1 SampleOne --l2 SampleTwo --exon_s 1 --intron_s 5 -o test_coordinate_output

无需在命令行直接提供.bam路径,而是可以提供文本文件,其中第一行为逗号分隔的路径:--b1 b1.txt--b2 b2.txt

img/plotwithcoor.png

使用分组文件

输入映射文件可以分为不同的组进行绘图。rmats2sashimiplot会计算每组的平均包含水平、平均读长深度和平均跨 junction 读段数量,并在 sashimi 图中显示。这为比较不同样本组提供了灵活性。

rmats2sashimiplot --b1 ./rmats2sashimiplot_test_data/sample_1_replicate_1.bam,./rmats2sashimiplot_test_data/sample_1_replicate_2.bam,./rmats2sashimiplot_test_data/sample_1_replicate_3.bam --b2 ./rmats2sashimiplot_test_data/sample_2_replicate_1.bam,./rmats2sashimiplot_test_data/sample_2_replicate_2.bam,./rmats2sashimiplot_test_data/sample_2_replicate_3.bam --event-type SE -e ./rmats2sashimiplot_test_data/SE.MATS.JC.txt --l1 SampleOne --l2 SampleTwo --exon_s 1 --intron_s 5 -o test_grouped_output --group-info grouping.gf

img/plotwitheventgf.png

其中grouping.gf包含:

group1name: 1-2
group2name: 3-6

分组

与 --group-info 一起使用的 *.gf 文件中的每一行定义一个组。每行的格式如下:

groupname: indices of mapping files

索引可以是用逗号(,)分隔的列表,包含:

  • 单个数字
  • 用短横线(-)指定的范围

重要提示:使用的是从 1 开始的索引。映射文件的顺序与(--b1 --b2)或(--s1 --s2)中的顺序相对应。索引 i 对应于(--b1 和 --b2)或(--s1 和 --s2)拼接后的第 i 个(从 1 开始计数)索引。

例如:--b1 a.bam,b.bam,c.bam --b2 d.bam,e.bam,f.bam 以及此分组文件

firstGroup: 1,4
secondGroup: 1-3,5,6

定义 firstGroup=a.bam,d.bam 和 secondGroup=a.bam,b.bam,c.bam,e.bam,f.bam

常见问题

问:y轴代表什么?

答:MISO 是 rmats2sashimiplot 实际的绘图后端,因此它们的绘图机制几乎相同。y轴代表经过修正的 RPKM 值。

img/RPKM.png

在 rmats2sashimiplot 中,每个读段会将其读段计数均匀分配到它所映射的坐标上。如果读段长度为 50,那么每个单独的坐标会增加 1/50 的值。每个坐标的值是所有读段的总和。然后,该值会通过总读段数以及两个常数(1000 和 1000000)进行标准化。

问:在分组模式下,rmats2sashimiplot 如何计算 junction 计数、读段密度(修正的 RPKM)和包含水平?

答:rmats2sashimiplot 使用 SplicePlot(Wu, Nance, & Montgomery, 2014)提出的改良型 Sashimi 图。简单来说,rmats2sashimiplot 计算各组的平均读段深度和平均跨 junction 读段数。

问:我可以使用 GTF 文件吗?

答:不可以,需要 GFF3 文件。您可以使用 gffread 将 GTF 转换为 GFF3:gffread --keep-genes ./some_file.gtf -o ./some_file.gff3

问:为什么 sashimiplot 中显示的 junction 计数可能与 rMATS 输出中的计数不同?

答:rmats2sashimiplot 和 rMATS 的计数流程存在一些差异。更多详情请参考 issue 33

问:如何减少 rmats2sashimiplot 的运行时间?

答:rmats2sashimiplot 是单线程的,但您可以在不同的输入上同时运行多个 rmats2sashimiplot 实例。对于单个 rmats2sashimiplot 实例,如果通过 -e 给定事件文件作为输入,它将绘制该文件中的所有事件。您可以不直接使用 rMATS 输出文件(如 SE.MATS.JC.txt),而是复制该文件并进行筛选,使其只包含您想要绘制的事件。

所有参数

python src/rmats2sashimiplot/rmats2sashimiplot.py -h

usage: rmats2sashimiplot [-h] -o OUT_DIR [--l1 L1] [--l2 L2]
                         [--event-type {SE,A5SS,A3SS,MXE,RI}] [-e EVENTS_FILE]
                         [-c COORDINATE] [--s1 S1] [--s2 S2] [--b1 B1]
                         [--b2 B2] [--exon_s EXON_S] [--intron_s INTRON_S]
                         [--group-info GROUP_INFO] [--min-counts MIN_COUNTS]
                         [--color COLOR] [--font-size FONT_SIZE]
                         [--fig-height FIG_HEIGHT] [--fig-width FIG_WIDTH]
                         [--hide-number] [--no-text-background]
                         [--keep-event-chr-prefix] [--remove-event-chr-prefix]

optional arguments:
  -h, --help            show this help message and exit

Required:
  -o OUT_DIR            The output directory.

Labels:
  --l1 L1               The label for the first sample.
  --l2 L2               The label for the second sample.

rMATS event input:
  Use either (rMATS event input) or (Coordinate and annotation input)

  --event-type {SE,A5SS,A3SS,MXE,RI}
                        Type of event from rMATS result used in the analysis.
                        'SE': skipped exon, 'A5SS': alternative 5' splice
                        site, 'A3SS' alternative 3' splice site, 'MXE':
                        mutually exclusive exons, 'RI': retained intron. (Only
                        if using rMATS event input)
  -e EVENTS_FILE        The rMATS output event file (Only if using rMATS event
                        input)

Coordinate and annotation input:
  Use either (Coordinate and annotation input) or (rMATS event input)

  -c COORDINATE         The genome region coordinates and a GFF3 (not GTF)
                        annotation file of genes and transcripts. The format
                        is -c
                        {chromosome}:{strand}:{start}:{end}:{/path/to/gff3}
                        (Only if using Coordinate and annotation input)

SAM Files:
  Mapping results for sample_1 & sample_2 in SAM format. Replicates must be
  in a comma separated list. A path to a file containing the comma separated
  list can also be given. (Only if using SAM)

  --s1 S1               sample_1 sam files: s1_rep1.sam[,s1_rep2.sam]
  --s2 S2               sample_2 sam files: s2_rep1.sam[,s2_rep2.sam]

BAM Files:
  Mapping results for sample_1 & sample_2 in BAM format. Replicates must be
  in a comma separated list. A path to a file containing the comma separated
  list can also be given. (Only if using BAM)

  --b1 B1               sample_1 bam files: s1_rep1.bam[,s1_rep2.bam]
  --b2 B2               sample_2 bam files: s2_rep1.bam[,s2_rep2.bam]

Optional:
  --exon_s EXON_S       How much to scale down exons. Default: 1
  --intron_s INTRON_S   How much to scale down introns. For example,
                        --intron_s 5 results in an intron with real length of
                        100 being plotted as 100/5 = 20. Default: 1
  --group-info GROUP_INFO
                        The path to a *.gf file which groups the replicates.
                        One sashimi plot will be generated for each group
                        instead of the default behavior of one plot per
                        replicate
  --min-counts MIN_COUNTS
                        Individual junctions with read count below --min-
                        counts will be omitted from the plot. Default: 0
  --color COLOR         Specify a list of colors with one color per plot.
                        Without grouping there is one plot per replicate. With
                        grouping there is one plot per group: --color
                        '#CC0011[,#FF8800]'
  --font-size FONT_SIZE
                        Set the font size. Default: 8
  --fig-height FIG_HEIGHT
                        Set the output figure height (in inches). Default is 7
                        if sample size < 5 and 14 if sample size is 5 or more
  --fig-width FIG_WIDTH
                        Set the output figure width (in inches). Default: 8
  --hide-number         Do not display the read count on the junctions
  --no-text-background  Do not put a white box behind the junction read count
  --keep-event-chr-prefix
                        force the contig name in the provided events file to
                        be used
  --remove-event-chr-prefix
                        remove any leading "chr" from contig names in the
                        provided events file

输出结果

所有输出均写入-o参数指定的目录。该目录下包含:

  • Sashimi_index/:存放用于生成图表的中间文件
  • Sashimi_index_{Gene}_{event_id}/:与Sashimi_index/类似,但为每个绘制的rMATS事件单独创建一个目录
  • Sashimi_plot/:存放生成的.sashimi格式图表(PDF格式)

联系方式与错误报告

Yi Xing yxing@ucla.edu

Zhijie Xie shiehshiehzhijie@gmail.com

如果您在本项目中发现任何错误或问题,欢迎告知我们。但在发送错误报告前,请先检查以下事项:

  1. 您是否使用的是最新版本?您发现的错误可能已在最新版本中修复。
  2. 请确认您的输入格式正确,并且已选择正确的选项。
  3. 请将您的输入精简到仍能复现该错误的最小规模;我们需要您的输入数据来重现问题,数据规模越小,问题排查就越容易。

版权与许可信息

版权所有 (C) 2015 加利福尼亚大学洛杉矶分校 (UCLA) Zhijie Xie、Yu-Ting Tseng、Yi Xing

Zhijie Xie、Yu-Ting Tseng、Yi Xing

本程序为自由软件:您可以根据自由软件基金会发布的GNU通用公共许可证(第三版或更高版本)的条款,重新分发和/或修改本程序。

本程序的发布旨在希望它能有所用处,但不提供任何明示或暗示的担保,包括但不限于适销性和特定用途适用性的担保。有关更多详细信息,请参阅GNU通用公共许可证。

您应该已随本程序收到GNU通用公共许可证的副本。如果没有,请访问 http://www.gnu.org/licenses/。

Introduction

可用于可视化 rMATS 输出或基因组坐标的可变剪切事件,通过 SAM/BAM 文件生成 sashimi 图,支持分组样本比较,计算平均包含水平和读深,灵活展示剪切差异。【此简介由AI生成】

Customize your domain