作用:二代數(shù)據(jù)用rmats-turbo跑完之后得到各exon的五種可變剪切事件和count數(shù),用ramts2sashimiplot可視化。
github網(wǎng)址:https://github.com/Xinglab/rmats2sashimiplot
參考:https://cloud.tencent.com/developer/article/1366294
安裝
方法一:conda
# 建議創(chuàng)個(gè)新環(huán)境使用,因?yàn)閏onda安裝的該軟件適配python解釋器是2.7的,可能會(huì)和其他軟件沖突
conda create -n rmats2plot
conda activate rmats2plot
conda install -c bioconda rmats2sashimiplot
conda 安裝完的包使用起來可能會(huì)報(bào)縮進(jìn)的錯(cuò)誤“SyntaxError: invalid syntax”,這是因?yàn)橛?個(gè).py文件的縮進(jìn)格式不對(duì),1個(gè)tab和4個(gè)空格混用了。解決辦法是用pycharm打開該文件,用ctrl+alt+L格式化修正縮進(jìn)。然后再用改好的文件替換掉原始文件,名字要一樣哈。

方法二:下載包后解壓安裝
tar zxvf rmats2sashimiplot-3.0.0.tar.gz
cd rmats2sashimiplot-3.0.0
# 注意你要用python2來安裝
python ./setup.py install
rmats2sashimiplot can be updated with:
pip uninstall rmats2sashimiplot
python ./setup.py install
# 安裝完之后可以直接使用
rmats2sashimiplot
方法三:不安裝,直接使用
在github下載完包后解壓,直接使用
# 注意,python2版本使用
python ./src/rmats2sashimiplot/rmats2sashimiplot.py
注意:后兩種方法需要自行配置dependencies
pip install numpy scipy matplotlib pysam
conda install -c bioconda samtools bedtools
大家覺得python2不好用,想用python3跑,也可以。
2to3
跑以下命令會(huì)自動(dòng)將python2的格式轉(zhuǎn)為python3可執(zhí)行的格式。
bash 2to3.sh # 軟件目錄下自帶的
# 如果你實(shí)在找不到這個(gè)文件,你可以嘗試
2to3 -w -n /path/to/src
如果你是conda/解壓安裝的途徑使用的,我感覺沒必要換python3了。因?yàn)閏onda是配置好python2,你解壓安裝時(shí)也配置好python2。只有你直接使用.py腳本不安裝時(shí),用的可能是python3,這樣不動(dòng)python版本,動(dòng)軟件文件格式是優(yōu)選。但是你都配置好了python2,就沒必要了。
使用
方法一:使用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
# 你感覺太長(zhǎng)了,好難檢查哪里錯(cuò)了,那就將sample1和2的樣本放在2個(gè)文件里
# s1.txt內(nèi)容:樣本1路徑/重復(fù)樣本1名,樣本1路徑/重復(fù)樣本2名
./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內(nèi)容:樣本2路徑/重復(fù)樣本1名,樣本2路徑/重復(fù)樣本2名
./rmats2sashimiplot_test_data/sample_2_replicate_1.sam,./rmats2sashimiplot_test_data/sample_2_replicate_2.sam,./rmats2sashimiplot_test_data/sample_2_replicate_3.sam
# 改后
rmats2sashimiplot --s1 s1.txt--s2 s2.txt --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
方法二:使用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
# 如果覺得太長(zhǎng)了,可以和方法一一樣,把樣本名放在文件里
方法三:分組畫
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
解釋各參數(shù)含義:
#如果你是用conda安裝的
-t {SE,A5SS,A3SS,MXE,RI} 可變剪切類型
-e EVENTS_FILE 輸入rMATS輸出的可變剪切事件的文件,如SE.MATS.JC.txt
--l1 L1 第一個(gè)樣本的標(biāo)簽名
--l2 L2 第二個(gè)樣本的標(biāo)簽名
-o OUT_DIR 輸出文件路徑
--s1 S1 樣本1的sam文件路徑
--s2 S2 樣本2的sam文件路徑
--b1 B1 樣本1的bam文件路徑
--b2 B2 樣本2的bam文件路徑
--exon_s EXON_S 畫外顯子的時(shí)候比例要縮小多少
--intron_s INTRON_S 畫內(nèi)含子的時(shí)候比例要縮小多少。如果設(shè)為5,說明實(shí)際長(zhǎng)度為100的內(nèi)含子繪制為100/5 = 20
--group-info GROUP_INFO .gf文件路徑
# 方法3中使用。如--b1 a.bam,b.bam,c.bam --b2 d.bam,e.bam,f.bam
# 一共6個(gè)case,a和d為一組,a,b,c,e.f為一組,那么.gf文件內(nèi)容為
## firstGroup: 1,4
## secondGroup: 1-3,5,6
--min-counts MIN_COUNTS 如果junction count小于這個(gè)數(shù),那么這個(gè)junction count在圖中會(huì)省去
--color COLOR 設(shè)置圖的顏色,顏色數(shù)量等于不同樣本中bam文件的總數(shù)
# 如果你是下載包安裝的
--event-type {SE,A5SS,A3SS,MXE,RI} 可變剪切類型
tips
- 可以提前對(duì)bam文件建index,節(jié)省時(shí)間
samtools index *.bam
- 有些朋友反映bam文件和rmats輸出文件里的“chr11”不匹配,可以嘗試將rmats輸出文件中的“chr”刪去,只剩“11”,但我沒遇到這樣的,反而刪了“chr”會(huì)報(bào)錯(cuò)
- 盡量不要把所有SE.MATS.JC.txt的內(nèi)容都畫完,選擇你想畫的gene、有顯著性p值的基因,另做一個(gè)文件,表頭和SE.MATS.JC.txt一樣。要不然速度會(huì)很慢。
-
默認(rèn)輸出.pdf文件
可視化例子
縱軸為RPKM表達(dá)值,連線為splice junction,連線上為支持此SJ的reads數(shù),IncLevel是指psi值,橫軸為exon的位置
計(jì)算

