
paplot documentation¶
Contents:
はじめに¶
作成できるグラフ¶
- QC (Quality Control) グラフ
bamファイルの品質をグラフに表示します。

- CA (Chromosomal Aberration) グラフ
Structural Variation (SV) 等、Chromosome間の変異を円形のplotで可視化し、棒グラフでその分布を表示します。

- mutation-matrix グラフ
検出したmutation について縦軸を遺伝子(Gene), 横軸をサンプル(Sample) として、変異タイプ別に表示します。

quick start¶
- paplotをインストール
- testサンプルでコマンドを実行
- 結果ファイルを表示
1. paplotをインストール¶
qlogin
してください。git clone -b master https://github.com/Genomon-Project/paplot.git
cd paplot
python setup.py build install --user
installの確認
pa_plot conf
**********************
hello paplot !!!
**********************
config file:/usr/lib/python2.7/site-packages/{paplot-versoion}-py2.7.egg/config/paplot.cfg
(このあとにデフォルト設定の内容が表示されます)
2. testサンプルでコマンドを実行¶
テストサンプルを用意していますので実行します。
cd {paplotをインストールしたディレクトリ}
# create bar graphs of qc
pa_plot qc "example/qc/*.csv" ./tmp DUMMY --config_file example/example.cfg
# create bundle graphs of Structural Variation (SV)
pa_plot sv "example/sv/*.txt" ./tmp DUMMY --config_file example/example.cfg
# create bundle graphs of Structural Variation (mutation-matrix)
pa_plot mutation example/mutation/sample_merge.csv ./tmp DUMMY --config_file example/example.cfg
3. 結果ファイルを表示¶
HTMLファイルができていますか?
{paplot をインストールしたディレクトリ}
└ tmp
├ DUMMY
│ ├ graph_mut.html <--- mutation-matrix グラフ
│ ├ graph_qc.html <--- qc グラフ
│ └ graph_ca.html <--- ca グラフ
│
├ js <--- この4つのディレクトリはHTMLファイルを表示するために必要です。消さないでください。
├ layout
├ lib
├ style
|
└ index.html <--- このファイルを web ブラウザで開いてください。
tmp
ディレクトリを丸ごとコピーしてください。


QC グラフ¶
CA グラフ¶
- 棒グラフでは全サンプルでbreakpointを集計した数を表示します。
- 円形のplotでは、サンプルごとにbreakpoint1と2を線でつないで表示します。
mutation-matrix グラフ¶
mutation-matrix グラフでは検出したmutation について縦軸を遺伝子(Gene), 横軸をサンプル(Sample) として、変異タイプ別に表示します。
横長の棒グラフ(Sample): | |
---|---|
サンプルごとに検出されたmutationの数を表示します。 |
|
縦長の棒グラフ(Gene): | 遺伝子ごとのmutation数をサンプル数における割合(%)で表示します。
|
functions: | 変異タイプ(func)別に色分けして表示します。表示したくない変異タイプがある場合、functions のチェックボックスからチェックを外すことで除外できます。 |
sub plot: | mutationとは別にサンプルに対するデータがある場合、subplotとして表示することができます。このファイルは |
操作方法
1. axis-X sort¶
横軸の並び順を変更します。
- none ソートしない
- ASC 昇順
- DESC 降順
以下の要素でソートでき、複数ソート可能です。
SampleID: | サンプルの名前順 |
---|---|
Mutation num.: | サンプルごとのmutation数 |
Genes: | 遺伝子ごとの変異数。ASC/DESCどちらかを選択したのち、横のリストボックスからGene名を選択し、[add sort key] ボタンをクリックしてください。 |
automatic Gantt-chart: | |
自動的にGantt-chartを作成します。 と、いっても技術者におなじみのガントチャートではありません。次で説明します。 使用する遺伝子の数を横のエディットボックスに入力したのち、[Gantt-chart] ボタンをクリックしてください。 |
Gantt-chart
2. axis-Y sort¶
縦軸の並び順を変更します。
- none ソートしない
- ASC 昇順
- DESC 降順
以下の要素でソートでき、複数ソート可能です。
Mutation num.: | 遺伝子ごとのmutation数 |
---|---|
Gene name: | 遺伝子の名前順 |
3. sample filter¶
フィルター適用前と適用後
4. genes filter¶
縦軸に表示する遺伝子に対してフィルタを設定します。
Rate: | 検出された遺伝子のサンプル数における割合(%)。初期値は0%(フィルタリングなし) |
---|---|
Display maximum: | |
表示する遺伝子の最大数。 |
いずれも横のエディットボックスに入力したのち、[update filter] ボタンをクリックしてください。
install¶
- Linux系サーバ (HGCスパコン含), Linux ディストリビューション
- MacOS X
- Windows
Linux系の場合 (HGCスパコン, cygwin含)¶
1. paplot のインストール¶
cd {install したいディレクトリ}
git clone -b master https://github.com/Genomon-Project/paplot.git
cd paplot
python setup.py build install
# 上のコマンドでエラーが出る場合
export PATH=~/.local/bin/:$PATH
export LD_LIBRARY_PATH=~/.local/lib/:$LD_LIBRARY_PATH
python setup.py build install --user
pa_plot conf
**********************
hello paplot !!!
**********************
(デフォルト設定値が表示される)
注釈
PATH設定を忘れないようにする
~/.bashrc
もしくは ~/.bash_profile
ファイルに次の2行を記入してください。export PATH=~/.local/bin/:$PATH
export LD_LIBRARY_PATH=~/.local/lib/:$LD_LIBRARY_PATH
MacOS Xの場合¶
1. ソースファイルのダウンロード¶
Source code (zip)
をダウンロードします。https://github.com/Genomon-Project/paplot/releases/
git
コマンドが使える方は git clone -b master https://github.com/Genomon-Project/paplot.git
でもよいです。2. paplot のインストール¶
whoami
コマンドで確認できます。cd {downloadしたディレクトリ}
# 大抵は以下でOKです。
# cd /Users/<user name>/Downloads/paplot-devel
python setup.py build install --user
3. PATHの設定¶
pa_plot
がどこにあるかわからないので、インストールされているところにPATHを通します。/Users/<user name>/Library/Python/2.7/bin
注釈
find / -name pa_plot
とコマンドを入力してインストールされているところを探します。{installしたディレクトリ}/bin/pa_plot <--- ココです
{installしたディレクトリ}/lib/python2.7/site-packages/paplot-0.2.6devel-py2.7.egg/EGG-INFO/scripts/pa_plot
{downloadディレクトリ}/paplot-devel/pa_plot
{downloadディレクトリ}/paplot-devel/build/scripts-2.7/pa_plot
export PATH={installしたディレクトリ}/bin:$PATH
export LD_LIBRARY_PATH={installしたディレクトリ}/lib:$LD_LIBRARY_PATH
# 大抵は以下でOKです。
# <user name>は自分のユーザ名に置き換えてください。
# export PATH=/Users/<user name>/Library/Python/2.7/bin:$PATH
# export LD_LIBRARY_PATH=/Users/<user name>/Library/Python/2.7/lib:$LD_LIBRARY_PATH
pa_plot conf
**********************
hello paplot !!!
**********************
(デフォルト設定値が表示される)
注釈
PATH設定を忘れないようにする
export PATH=...
コマンドを入力する必要があります。vi ~/.bash_profile
i
と入力して編集モードにします。↓
キーで最後の行に移動します。export PATH=/Users/<user name>/Library/Python/2.7/bin:$PATH
export LD_LIBRARY_PATH=/Users/<user name>/Library/Python/2.7/lib:$LD_LIBRARY_PATH
ESC
キーを押して、編集モードから抜けます。その後、:wq
と入力して保存して終了します。Windows系の場合¶
1. Pythonのインストール¶
- winPython http://winpython.github.io/
- Python(x,y) http://python-xy.github.io/
2. paplot のインストール¶
Source code (zip)
をダウンロードします。https://github.com/Genomon-Project/paplot/releases/
C:\\Program Files\\\WinPython-64bit-2.7.10.2\\WinPython Command Prompt.exe
cd {zipを解凍したフォルダ}
python setup.py build install
pa_plot
コマンドにパスが通っていないのでバッチファイルを使用します。pa_plot.cmd
がありますので、ノートパッド等テキストエディタで開いて編集します。set pa_plot="C:\Program Files\WinPython-64bit-2.7.10.2\python-2.7.10.amd64\Scripts\pa_plot"
>pa_plot.cmd conf
**********************
hello paplot !!!
**********************
(デフォルト設定値が表示される)
pa_plot
コマンドは pa_plot.cmd
と読み替えてください。Genomon データを使用する¶
Genomo-pipeline に関しては、各バージョンの設定ファイルを用意しています。
※カスタマイズする場合は 自分のデータを使用する を参照して変更してください。
{paplotをインストールしたディレクトリ}/config_template
file name | version |
---|---|
genomon_v2_0_0.cfg | Genomon 2.0.0 ~ 2.0.3 |
genomon_v2_0_5_v2_0_4.cfg | Genomon 2.0.4 ~ 2.0.5 |
genomon_v2_2_0_merge.cfg | Genomon 2.2.0 |
genomon_v2_3_0_merge.cfg | Genomon 2.3.0 |
genomon_v2_4_0_dna_merge.cfg | Genomon 2.4.0 (dna) |
genomon_v2_4_0_rna_merge.cfg | Genomon 2.4.0 (rna) |
※ Genomon 2.4.0 よりrna結果のpaplot出力に対応しました。
Genomon-pipeline の結果ファイルをもとにしたバージョンの見分け方
version | mutation | sv | qc | post-analysis |
---|---|---|---|---|
Genomon 2.0.0 ~ 2.0.3 | ヘッダなし | ヘッダなし | 結果なし | 結果なし |
Genomon 2.0.4 ~ 2.0.5 | ヘッダあり | ヘッダなし | 結果あり | 結果なし |
Genomon 2.2.0 | ヘッダあり | ヘッダあり | 結果あり | 結果あり |
※genomon 2.3.0 以降はpaplot/{サンプルファイル名}/index.html にGenomon-pipeline のバージョン名を出力しています。
実行例
genomon_root={Genomonを実行したディレクトリ}
sample={Genomon実行時のサンプルファイル名のディレクトリ}
output_dir={paplotの出力ディレクトリ}
project_name={プロジェクト名}
paplot_install_dir={paplotをインストールしたディレクトリ}
# for Genomon 2.4.0
## dna
pa_plot qc ${genomon_root}/post_analysis/${sample}/merge_qc.txt ${output_dir} ${project_name} --config_file ${paplot_install_dir}/config_template/genomon_v2_4_0_dna_merge.cfg
pa_plot sv ${genomon_root}/post_analysis/${sample}/merge_sv_filt_pair_controlpanel.txt ${output_dir} ${project_name} --config_file ./config_template/genomon_v2_4_0_dna_merge.cfg
pa_plot mutation ${genomon_root}/post_analysis/${sample}/merge_mutation_filt_pair_controlpanel.txt ${output_dir} ${project_name} --config_file ./config_template/genomon_v2_4_0_dna_merge.cfg
## rna
pa_plot qc ${genomon_root}/post_analysis/${sample}/merge_starqc.txt ${output_dir} ${project_name} --config_file ${paplot_install_dir}/config_template/genomon_v2_4_0_rna_merge.cfg
pa_plot sv ${genomon_root}/post_analysis/${sample}/merge_fusionfusion_filt.txt ${output_dir} ${project_name} --config_file ./config_template/genomon_v2_4_0_rna_merge.cfg
# for Genomon 2.3.0
pa_plot qc ${genomon_root}/post_analysis/${sample}/merge_qc.txt ${output_dir} ${project_name} --config_file ${paplot_install_dir}/config_template/genomon_v2_3_0_merge.cfg
pa_plot sv ${genomon_root}/post_analysis/${sample}/merge_sv_filt_pair_controlpanel.txt ${output_dir} ${project_name} --config_file ./config_template/genomon_v2_3_0_merge.cfg
pa_plot mutation ${genomon_root}/post_analysis/${sample}/merge_mutation_filt_pair_controlpanel.txt ${output_dir} ${project_name} --config_file ./config_template/genomon_v2_3_0_merge.cfg
# for Genomon 2.2.0
pa_plot qc ${genomon_root}/post_analysis/${sample}/merge_qc.txt ${output_dir} ${project_name} --config_file ${paplot_install_dir}/config_template/genomon_v2_2_0_merge.cfg
pa_plot sv ${genomon_root}/post_analysis/${sample}/merge_sv_filt_pair_controlpanel.txt ${output_dir} ${project_name} --config_file ${paplot_install_dir}/config_template/genomon_v2_2_0_merge.cfg
pa_plot mutation ${genomon_root}/post_analysis/${sample}/merge_mutation_filt_pair_controlpanel.txt ${output_dir} ${project_name} --config_file ${paplot_install_dir}/config_template/genomon_v2_2_0_merge.cfg
# for Genomon 2.0.4 or Genomon 2.0.5
pa_plot qc "${genomon_root}/summary/*/*.tsv" ${output_dir} ${project_name} --config_file ${paplot_install_dir}/config_template/genomon_v2_0_5_v2_0_4.cfg
pa_plot sv "${genomon_root}/sv/*/*.genomonSV.result.txt" ${output_dir} ${project_name} --config_file ${paplot_install_dir}/config_template/genomon_v2_0_5_v2_0_4.cfg
pa_plot mutation "${genomon_root}/mutation/*/*_genomon_mutations.result.txt" ${output_dir} ${project_name} --config_file ${paplot_install_dir}/config_template/genomon_v2_0_5_v2_0_4.cfg
# for Genomon 2.0.0 ~ 2.0.3
pa_plot sv "${genomon_root}/sv/*/*.genomonSV.result.txt" ${output_dir} ${project_name} --config_file ${paplot_install_dir}/config_template/genomon_v2_0_0.cfg
pa_plot mutation "${genomon_root}/mutation/*/*_genomon_mutations.result.txt" ${output_dir} ${project_name} --config_file ${paplot_install_dir}/config_template/genomon_v2_0_0.cfg
自分のデータを使用する¶
Genomon以外のデータを使用するにはconfigファイルを編集して自分のファイルフォーマットを指定します。
configファイルのサンプルは以下にあります。
{paplotをインストールしたディレクトリ}/example/example.cfg
Genomonデータを使用する場合は各バージョンの設定ファイルを用意していますので、 Genomon データを使用する 参照してください。
警告
作成したconfigファイルは pa_plot
コマンドの --config_file
オプションで指定します。
実行例
pa_plot qc "example/qc/*.csv" ./tmp DUMMY --config_file example/example.cfg
1. 全般¶
1 2 3 4 5 6 7 8 | ###################### general
[style]
# グラフのレイアウトファイル
# ~/tmp/paplot/style/rainbow.js
path =
# index.html の備考欄に出力するテキスト(HTMLタブ使用可, 半角英数字のみ)
remarks =
|
2. QC¶
QCグラフ固有の設定記載方法について、詳細は Config 記述方法(QC) に記載しています。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | ###################### qc
[qc]
# (none)
# 入力フォーマット (自分のデータに合わせて変更する)
# 項目は欄外「ファイルフォーマット」参照
[result_format_qc]
suffix = .qc.csv
sept = ,
header = True
comment = #
# column index (required)
# (none)
# column index (option)
col_opt_duplicate_reads = duplicate_reads
col_opt_mapped_reads = mapped_reads
col_opt_total_reads = total_reads
col_opt_average_depth = average_depth
col_opt_mean_insert_size = mean_insert_size
col_opt_ratio_2x = 2x_rt
col_opt_ratio_10x = 10x_rt
col_opt_ratio_20x = 20x_rt
col_opt_ratio_30x = 30x_rt
col_opt_read_length_r1 = read_length_r1
col_opt_read_length_r2 = read_length_r2
col_opt_id = file_name
# 出力フォーマット (data_qc.csv)
# 項目は欄外「ファイルフォーマット」参照
[merge_format_qc]
lack_column_complement = NA
sept = ,
# 領域選択用のグラフ設定
[qc_chart_brush]
title =
title_y =
stack = {average_depth}
name_set = average:#E3E5E9
tooltip_format =
# グラフ設定(グラフごとに用意する)
[qc_chart_1]
title = depth coverage
title_y = coverage
stack1 = {ratio_30x}
stack2 = {ratio_20x-ratio_30x}
stack3 = {ratio_10x-ratio_20x}
stack4 = {ratio_2x-ratio_10x}
name_set = ratio_30x:#2478B4, ratio_20x:#FF7F0E, ratio_10x:#2CA02C, ratio_2x:#D62728
tooltip_format1 = ID:{id}
tooltip_format2 = ratio_2x: {ratio_2x:.2}
tooltip_format3 = ratio_10x: {ratio_10x:.2}
tooltip_format4 = ratio_20x: {ratio_20x:.2}
tooltip_format5 = ratio_30x: {ratio_30x:.2}
|
3. CA¶
CAグラフ固有の設定記載方法について、詳細は Config 記述方法(CA) に記載しています。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | ###################### sv
[genome]
# ゲノムサイズのファイル(CSV形式)(デフォルトはhg19, installディレクトリ配下のgenomeディレクトリにあります)
#
# for example.
# (linux)
# path = ~/tmp/genome/hg19.csv
# (windows)
# path = C:\genome\hg19_part.csv
path =
[sv]
# 使用するchromosomes (,で区切る)
use_chrs = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,X,Y
# if setting label-text & color
# use_chrs = 1:Chr1:crimson, 2:Chr2:lightpink, 3:Chr3:mediumvioletred, 4:Chr4:violet, 5:Chr5:darkmagenta, 6:Chr6:mediumpurple
# 積み上げグラフのchromosome分割サイズ (bps)
selector_split_size = 5000000
# 入力されていた場合、そのgroupのみ出力する
# 未入力の場合、検出されたgroupすべて出力する
# , 区切りで複数指定可能
#
limited_group = stopgain,frameshift_deletion,frameshift_insertion
# 入力されていた場合、そのgroupはplot対象から除外する
# , 区切りで複数指定可能
# 空白行を除去する場合、_blank_ と記入する
nouse_group = _blank_,unknown,synonymous_SNV
# groupのplot色を指定する。group名:(RGBもしくはカラー名)
# , 区切りで複数指定可能
# 未入力のgroupはデフォルト色を使用する
group_colors = stopgain:#E85299,frameshift_deletion:#F39600,frameshift_insertion:#E60011
# 入力フォーマット (自分のデータに合わせて変更する)
# 項目は欄外「ファイルフォーマット」参照
[result_format_sv]
suffix = .result.txt
sept = \t
header = False
comment = #
# column index (required)
col_chr1 = Chr_1
col_break1 = Pos_1
col_chr2 = Chr_2
col_break2 = Pos_2
# column index (option)
col_opt_dir1 = Dir_1
col_opt_dir2 = Dir_2
col_opt_type = Variant_Type
col_opt_gene_name1 = Gene_1
col_opt_gene_name2 = Gene_2
col_opt_group =
col_opt_id =
# 出力フォーマット (data_sv.csv)
# 項目は欄外「ファイルフォーマット」参照
[merge_format_sv]
lack_column_complement = NA
sept = ,
|
4. mutation-matrix¶
mutation-matrixグラフ固有の設定記載方法について、詳細は Config 記述方法(mutation-matrix) に記載しています。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | ###################### mutation
[mut]
# geneのサンプルに対する検出比(%)
# 値より小さいgeneはplot対象から除外する
# 0の場合はすべて出力する
use_gene_rate = 0
# 入力されていた場合、そのgeneのみ出力する
# 未入力の場合、検出されたgeneすべて出力する
# , 区切りで複数指定可能
#
# limited_genes = TP,TTN,APC,BRAF,CDH1,FLT3
limited_genes =
# 入力されていた場合、そのgeneはplot対象から除外する
# , 区切りで複数指定可能
#
# nouse_genes = NONE,MUC4
nouse_genes =
# 入力されていた場合、その変異タイプ(func)のみ出力する
# 未入力の場合、検出されたfuncすべて出力する
# , 区切りで複数指定可能
#
# limited_funcs = exome,splicing
limited_funcs =
# 入力されていた場合、そのfuncはplot対象から除外する
# , 区切りで複数指定可能
# 空白行を除去する場合、_blank_ と記入する
nouse_funcs = _blank_,unknown,synonymous_SNV
# funcのplot色を指定する。func名:(RGBもしくはカラー名)
# , 区切りで複数指定可能
# 未入力のfuncはデフォルト色を使用する
func_colors = stopgain:#E85299,frameshift_deletion:#F39600,frameshift_insertion:#E60011,nonframeshift_deletion:#9CAEB7
# ポップアップウィンドウの表示内容
# 詳細は以下
tooltip_format_checker_title1 = ID:{id}, gene:{gene}, {#sum_item_value}
tooltip_format_checker_partial = type[{func}], {chr}:{start}:{end}, [{ref} -----> {alt}]
tooltip_format_gene_title = gene:{gene}, {#sum_item_value}
tooltip_format_gene_partial = func:{func}, {#item_value}
tooltip_format_id_title = ID:{id}, {#sum_item_value}
tooltip_format_id_partial = func:{func}, {#item_value}
# 入力フォーマット (自分のデータに合わせて変更する)
# 項目は欄外「ファイルフォーマット」参照
[result_format_mutation]
suffix =
sept = \t
header = True
comment = #
# funcが1セルに複数入力されている場合の区切り文字
sept_func = ";"
# geneが1セルに複数入力されている場合の区切り文字
sept_gene = ";"
# column index (required)
# func列
col_func = Merge_Func
# gene列
col_gene = Gene.refGene
# column index (option)
# chromosome
col_opt_chr = Chr
# 開始位置
col_opt_start = Start
# 終了位置
col_opt_end = End
# リファレンスの塩基配列
col_opt_ref = Ref
# 対象の塩基配列
col_opt_alt = Alt
# id (sample) 列
col_opt_ID = id
# 出力フォーマット (data_mut.csv)
# 項目は欄外「ファイルフォーマット」参照
[merge_format_mutation]
lack_column_complement = NA
sept = ,
|
5. 共通項目¶
suffixとID¶
paplotではサンプル名が必要です。ファイル入力では、以下のことに注意してください。
case1: マージされたファイルを入力する
複数サンプルの結果が、1ファイルにすべてまとめられていると想定しています。サンプル名となる列を
col_opt_ID
で必ず指定してください。case2: サンプルごとに分かれた複数のファイルを入力し、データ中にサンプル名となるものはない。
ファイル名の一部をサンプル名として使用します。
suffix
を必ず指定してください。case3: サンプルごとに分かれた複数のファイルを入力し、データ中にサンプル名となるデータがある。
サンプル名となる列を
col_opt_ID
で必ず指定してください。
複数ファイル入力する場合のコマンドの実行方法は pa_plot コマンド を参照してください。
入力ファイルフォーマット¶
configファイル中、[result_format_*] というセクションでは入力ファイルのフォーマットを指定します。
suffix: | suffixとID を参照してください。 |
---|---|
sept: | データ区切り。 |
# タブ区切りの場合
sept = \t
# ,区切りの場合
sept = ,
# スペース区切りの場合
sept = " "
header: | 先頭1行がヘッダかどうか。先頭行がヘッダの場合はTrue。ヘッダなしの場合はFalse |
---|---|
comment: | 先頭に指定文字がある行は飛ばす |
出力ファイルフォーマット¶
configファイル中、[merge_format_*] というセクションでは出力ファイル(data_*.csv) のフォーマットを指定します。
通常、変更する必要はありません。
sept: | データ区切り。(入力ファイルフォーマットと同) |
---|---|
lack_column_complement: | |
カラムがない場合、何で埋めるか |
列の指定方法¶
ヘッダの有り無しに合わせて、カラム名もしくはカラムインデックスを入力します。
記入例
# ヘッダ行がある場合、カラム名 (テキスト) を入力する
header = True
col_chr1 = Chr_1
col_break1 = Pos_1
col_chr2 = Chr_2
col_break2 = Pos_2
# ヘッダ行がない場合、カラムインデックス (数値) を入力する
header = False
col_chr1 = 0
col_break1 = 1
col_chr2 = 3
col_break2 = 4
ユーザ定義フォーマット¶
設定例
tooltip_format_checker_partial = type[{func}], {chr}:{start}:{end}, [{ref} -----> {alt}]
表示例:
type[exome], chr1:2000:2001, [A -----> T]
col_
もしくは col_opt_
を除いた名前です。`col_opt_{任意の名前}`
として追加し、実際のデータの列名を指定してください。col_opt_new_option = column_name
** mutation **
option名 | キーワード |
---|---|
col_func | {func} |
col_gene | {gene} |
col_opt_chr | {chr} |
col_opt_start | {start} |
col_opt_end | {end} |
col_opt_ref | {ref} |
col_opt_alt | {alt} |
col_opt_id | {id} |
** ca **
option名 | キーワード |
---|---|
col_chr1 | {chr1} |
col_break1 | {break1} |
col_chr2 | {chr2} |
col_break2 | {break2} |
col_opt_id | {id} |
col_opt_dir1 | {dir1} |
col_opt_dir2 | {dir2} |
col_opt_type | {type} |
col_opt_gene_name1 | {gene_name1} |
col_opt_gene_name2 | {gene_name2} |
** qc **
option名 | キーワード |
---|---|
col_opt_duplicate_reads | {duplicate_reads} |
col_opt_mapped_reads | {mapped_reads} |
col_opt_total_reads | {total_reads} |
col_opt_average_depth | {average_depth} |
col_opt_mean_insert_size | {mean_insert_size} |
col_opt_ratio_2x | {ratio_2x} |
col_opt_ratio_10x | {ratio_10x} |
col_opt_ratio_20x | {ratio_20x} |
col_opt_ratio_30x | {ratio_30x} |
col_opt_read_length_r1 | {read_length_r1} |
col_opt_read_length_r2 | {read_length_r2} |
col_opt_id | {id} |
数値計算させることもできます。その場合、計算式を{}で囲います。
{#number_mutaion_gene/#number_id*100}%
表示例:
3.33333333333333%
表示桁数を指定したい場合は計算式の後に ":.2" と書きます。小数点以下3桁の場合は ":.3" と書きます。
{#number_mutaion_gene/#number_id*100:.2}%
表示例:
3.33%
pa_plot コマンド¶
1. コマンドオプション¶
pa_plot {qc, sv, mutation} [-h] [--version] [--config_file CONFIG_FILE] [--remarks REMARKS] input output_dir project_name
必須
{qc, sv, mutation}: | |
---|---|
paplotのサブコマンドです。いづれかを選択します。(svはCAグラフを出力します) | |
input: | 入力ファイルです。ワイルドカード (* , ? ) を使用して複数指定することができます。その場合、最初と最後に " をつけてください。 |
# 1ファイルだけ入力する場合
pa_plot qc example/qc/SAMPLE1.qc ./test multi1 --config_file example/example.cfg
# 複数ファイルを入力する場合 (, で区切る)
pa_plot qc "example/qc/SAMPLE1.qc.csv,example/qc/SAMPLE2.qc.csv" ./test multi1 --config_file example/example.cfg
# 複数ファイルを入力する場合 (* 使用)
pa_plot qc "example/qc/*.csv" ./multi multi1 --config_file example/example.cfg
output_dir: | 出力ディレクトリを指定します。ディレクトリ構成は 2. 出力ディレクトリ を参照してください。 |
---|---|
project_name: | プロジェクト名です。出力ファイルのタイトルに使用します。 |
任意
--config_file | 設定ファイルです。未指定の場合、デフォルトを使用します。 |
--remarks | index.htmlの備考欄に出力するテキストです。未指定の場合、設定ファイルの値を使用します。 |
-h | ヘルプを表示します。 |
--version | バージョンを表示します。 |
2. 出力ディレクトリ¶
output_dir
オプションで指定した場所に次の構成でファイルを出力します。
{output_dir}
├ {project_name}
│ ├ graph_mut.html <--- mutation-matrix グラフ
│ ├ graph_qc.html <--- qc グラフ
│ └ graph_ca.html <--- ca グラフ
│
├ js <--- この4つのディレクトリはHTMLファイルを表示するために必要です。消さないでください。
├ layout
├ lib
├ style
|
└ index.html <--- このファイルを web ブラウザで開いてください。
出力ファイルを移動する場合は {output_dir}
ごと移動してください。
出力ファイルの操作方法は how to use graphs を参照してください。
Config 記述方法(QC)¶
全設定項目は こちら
列と設定の対応¶
name | input type | required | description |
---|---|---|---|
col_opt_duplicate_reads | numeric | × | number of total reads |
col_opt_mapped_reads | numeric | × | number of mapped reads |
col_opt_total_reads | numeric | × | number of duplicate reads |
col_opt_average_depth | numeric | × | mean of insert size |
col_opt_mean_insert_size | numeric | × | average of depth |
col_opt_ratio_2x | numeric | × | number of read_length_r1 |
col_opt_ratio_10x | numeric | × | number of read_length_r2 |
col_opt_ratio_20x | 0.0~1.0 | × | coverage (depth=2) |
col_opt_ratio_30x | 0.0~1.0 | × | coverage (depth=10) |
col_opt_read_length_r1 | 0.0~1.0 | × | coverage (depth=20) |
col_opt_read_length_r2 | 0.0~1.0 | × | coverage (depth=30) |
col_opt_id | text | x | サンプルを識別できる名称 |
ユーザ定義グラフ¶
[qc_chart_*]
というセクションに必要事項を記入します。** [qc_chart_*] 各セクションの設定内容 **
title: | グラフのタイトル |
---|---|
title_y: | y軸のタイトル |
stack: | 積み上げ要素。複数ある場合は積み上げる順にstack1, stack2, ... と連番に指定します。{ } 内にキーワードを設定します。キーワードについては ユーザ定義フォーマット を参照してください。 |
name_set: | 積み上げ要素の凡例名と色。色は省略可能。省略した場合、デフォルト値を上から順番に使用します。 |
tooltip_format: | mouse over で表示されるポップアップウィンドウのフォーマット。複数行の場合は上から順にtooltip_format1, tooltip_format2, ... と連番に指定します。記載方法は ユーザ定義フォーマット を参照してください。 |
name_set(色指定あり)
name_set(色指定なし)
** デフォルト色 **
Config 記述方法(CA)¶
全設定項目は こちら
列と設定の対応¶
name | input type | required | description |
---|---|---|---|
col_chr1 | text | o | chromosome of break point 1 |
col_break1 | numeric | o | position of break point 1 |
col_chr2 | text | o | chromosome of break point 2 |
col_break2 | numeric | o | position of break point 2 |
col_opt_ID | text | x | サンプルを識別できる名称 |
col_opt_dir1 | text | x | direction of break point 1 |
col_opt_dir2 | text | x | direction of break point 2 |
col_opt_type | text | x | type of variation |
col_opt_gene_name1 | text | x | gene name of break point 1 |
col_opt_gene_name2 | text | x | gene name of break point 2 |
col_opt_group | text | × | grouping of mutaions |
注釈
col_opt_groupはstackのグルーピングに使用します。
未指定の場合、intra/inter chromosomeでグルーピングします。
列を指定した場合、以下オプションによりさらに表示内容を設定することができます。
- limited_group 使用するgroupを限定する
- nouse_group 使用しないgroupを指定する
- group_colors groupの色を指定する
設定例
limited_group = stopgain,frameshift_deletion,frameshift_insertion
nouse_group = _blank_,unknown,synonymous_SNV
group_colors = stopgain:#E85299,frameshift_deletion:#F39600,frameshift_insertion:#E60011
注釈
任意設定の5項目はポップアップでの詳細表示にのみ使用されます。
表示するchromosomeを限定する¶
configファイルで次の項目を編集してください。
[sv]
# 使用するchromosomes (,で区切る)
# default
# use_chrs = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,X,Y
# chromosome 1,5,7を使用する場合
use_chrs = 1,5,7
編集したconfigファイルは次のようにしてコマンドから指定します。
pa_plot {input files} {output directory} {title} --config_file {config file}
ヒト以外のゲノムを使用する¶
genomeサイズが入力されたファイルが必要です。
先頭列にchromosome名、2列目にサイズをカンマ ,
もしくはタブ区切りで入力してください。
1,249250621
2,243199373
3,198022430
7,159138663
8,146364022
X,141213431
Y,135534747
9_gl000201_random,36148
11_gl000202_random,40103
17_gl000204_random,81310
17_gl000205_random,174588
Un_gl000214,137718
chromosome名は分析したいファイルのChr1, Chr2で使用されている名称と同じでなければなりません。
configファイルで用意したゲノムサイズのファイルを指定してください。
[genome]
# ゲノムサイズのファイル(CSV形式)(デフォルトはhg19, installディレクトリ配下のgenomeディレクトリにあります)
#
# for example.
# (linux)
# path = ~/tmp/genome/hg19.csv
# (windows)
# path = C:\genome\hg19_part.csv
path = {ここにゲノムサイズのファイルのパスを指定する}
ポップアップウィンドウの表示内容¶
Config 記述方法(mutation-matrix)¶
全設定項目は こちら
列と設定の対応¶
name | input type | required | description |
---|---|---|---|
col_func | text | o | mutation type |
col_gene | text | o | gene name |
col_opt_chr | text | × | chromosome |
col_opt_start | numeric | × | 開始位置 |
col_opt_end | numeric | × | 終了位置 |
col_opt_ref | text | × | リファレンスの塩基配列 |
col_opt_alt | text | × | 対象の塩基配列 |
col_opt_id | text | x | サンプルを識別できる名称 |
ポップアップウィンドウの表示内容¶
{#number_id}: | サンプル数 |
---|---|
{#number_gene}: | 遺伝子数 |
{#number_mutaion}: | |
mutation数(同一サンプルが同一遺伝子で複数回検出されても1としてカウントする) | |
{#sum_mutaion}: | mutation総検出数 |
{#item_value}: | 積み上げグラフの1項目の値 |
{#sum_item_value}: | |
積み上げグラフの合計値 |
デフォルトでの設定内容と表示との対応
# グリッド - タイトル
tooltip_format_checker_title1 = ID:{ID}, gene:{gene}, {#sum_item_value}
# グリッド - funcごと
tooltip_format_checker_partial = type[{func}], {chr}:{start}:{end}, [{ref} -----> {alt}]
# 遺伝子グラフ - タイトル
tooltip_format_gene_title = gene:{gene}, {#sum_item_value}
# 遺伝子グラフ - funcごと
tooltip_format_gene_partial = func:{func}, {#item_value}
# サンプルグラフ - funcごと
tooltip_format_id_title = ID:{id}, {#sum_item_value}
# サンプルグラフfuncごと
tooltip_format_id_partial = func:{func}, {#item_value}
サブプロットについて¶
*
には1から始まる連番を入れてください。1から順に表示します。1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | # mut_subplot_type1_1
[mut_subplot_type1_1]
# ファイルのパス
path = /path/to/file1
###########################
# ファイルフォーマット
# ファイルのデータ区切り
sept = ,
# 先頭1行がヘッダかどうか
header = True
# コメント行
comment = #
# 表示データの列
col_value = average_depth
# id 列(main plotと紐づけられること)
col_ID = id
###########################
# サブプロットのフォーマット
# サブプロットのタイトル
title = bam's average depth
# 表示形式
# fix, range, gradientから選択
mode = gradient
# 凡例のフォーマット
# 値:表示文字列:セルの色を各値ごとに記入する。セルの色は省略可能
#
# mode=fixの場合
# name_set = 0:Male:blue, 1:Female:red, 2:Unknown:gray
#
# mode=fixの場合、値には範囲開始の値を入れる
# name_set = 0:0-19, 20:20-39, 40:40-59, 60:60over
#
# mode = gradientの場合、最初と最後の値を入れる。MIN/MAXを使用すると、データから自動的に設定する
# 自動設定の場合
# name_set = MIN:min, MAX:max
# 手動設定の場合
# name_set = 0:min (0), 40:max (40)
name_set = MIN:min, MAX:max
# mut_subplot_type2_1
[mut_subplot_type2_1]
title = Clinical Gender
path = /path/to/file2
sept = ,
header = True
comment =
col_value = gender
col_ID = barcode
mode = fix
name_set = 0:Male:blue, 1:Female:red, 2:Unknown:gray
#mut_subplot_type2_2
[mut_subplot_type2_2]
title = Clinical Age
path = /path/to/file3
sept = ,
header = True
comment =
col_value = age
col_ID = barcode
mode = range
name_set = 0:0-19, 20:20-39, 40:40-59, 60:60over
|
titleとnameset¶
表示モードの違い¶
グラフをカスタマイズする¶
1. 変更方法¶
1-1. styleファイルを編集する¶
{paplotをインストールしたディレクトリ}/example/default.js
このファイルをコピーして {paplotをインストールしたディレクトリ}/example/mystyle.js
というファイルを作成します。
※ファイル名は任意ですが、拡張子は .js
にしてください。
作成したファイルを開いて変更します。
注釈
色の指定はRGBもしくは色名で指定することができます。
// RGBで指定する場合
bar_select_color: "#1F77B4",
// color nameで指定する場合
bar_select_color: "red",
RGBで指定する場合
00~FF
まで、6桁の16進表記で指定し、先頭に #
をつけてください。色名(カラーネーム)について
1-2. 設定ファイルを編集する¶
{paplotをインストールしたディレクトリ}/example/example.cfg
このファイルを開いて次の箇所を変更します。
スタイルファイルを今回作成したものを使用するように変更します。
[style]
path = {paplotをインストールしたディレクトリ}/example/mystyle.js
# ~/tmpにインストールした場合はこのようになる
# ~/tmp/paplot/example/mystyle.js
1-3. 出力する¶
cd {paplotをインストールしたディレクトリ}
pa_plot qc "example/qc/*.csv" ./tmp style_test --config_file example/example.cfg
1-4. 出力されたファイルを変更する¶
上で作成したファイルは次のディレクトリにコピーされています。
すでにpaplotで出力したHTMLファイルを変更する場合、スタイルファイル (mystyle.js) を編集し、再読み込み(ブラウザで F5
)すれば反映されます。
./tmp
├ style_test
│ └ graph_qc.html
│
├ js
├ layout
├ lib
└ style
├ default.js <--- デフォルト
└ mystyle.js <--- 今回作成したファイル
2. 設定項目¶
(function(){
style_general = {
font_family: "'Helvetica Neue', Helvetica, Arial, sans-serif",
}
// style of quality check graphs
style_qc = {
brush_border_y_color: "#DDDDCC",
brush_border_y_opacity: 0.5,
plot_border_y_color: "#DDDDCC",
plot_border_y_opacity: 0.2,
};
// style of genome-wide bar plot
style_sv_bar = {
// title's text options
title_top: "Genome-wide CAs identify",
title_y: "samples with CA breakp.",
title_x: "Chromosome",
border_x_main_color: "#E0E0E0",
border_x_main_width: "1px",
border_x_sub_color: "#A6A6A6",
border_x_sub_width: "1px",
border_y_color: "#DDDDCC",
border_y_opacity: 0.5,
};
// style of thumbnails
style_sv_thumb = {
// circular sector's color options
arc_fill_opacity: 1.0,
arc_stroke_opacity: 1.0,
// link options
link_width: "1px",
link_opacity: 1.0,
};
// style of detail image (on click)
style_sv_detail = {
// windows header
win_header_text_color: "#000000",
win_header_background_color: "#CFCFCF",
win_border_color: "#D3D3D3",
win_border_width: "1px",
win_background_color: "white",
// circular sector's color options
arc_fill_opacity: 1.0,
arc_stroke_opacity: 1.0,
// circular sector's label options
arc_label_fontsize: "10px",
arc_label_color: "#333333",
// link options
link_width: "2px",
link_opacity: 1.0,
// link(on mouse) options
link_select_color: "#d62728",
link_select_width: "3px",
link_select_opacity: 1.0,
};
// style of mutaion-matrix
style_mut = {
// title's text options
title_sample: "Sample",
title_sample_y: "Number of mutation",
virtical_border_x_color: "#CCCCEE",
virtical_border_x_width: "1px",
virtical_border_y_color: "#DDDDCC",
virtical_border_y_opacity: 0.5,
title_gene: "Genes",
title_gene_y1: "% Samples",
title_gene_y2: "with mutation",
horizon_border_x_color: "#CCCCEE",
horizon_border_x_width: "1px",
horizon_border_y_color: "#DDDDCC",
horizon_border_y_opacity: 0.5,
func_title: "functions",
sub_border_color: "#FFFFFF",
sub_border_width: "1px",
};
})();
about install¶
pa_plot conf
でエラー¶
$ pa_plot conf
-bash: /usr/bin/pa_plot: No such file or directory
LD_LIBRARY_PATH
の設定が正しくありません。$ pa_plot conf
Traceback (most recent call last):
File "/usr/bin/pa_plot", line 4, in <module>
__import__('pkg_resources').run_script('paplot===0.2.7devel', 'pa_plot')
(省略)
pkg_resources.DistributionNotFound: The 'paplot===0.2.7devel' distribution was not found and is required by the application
pa_plot
ファイルがない場合はインストールが成功していない可能性があります。$ python setup.py build install
(最後の3行)
Installed /usr/lib/python2.7/site-packages/paplot-0.2.7devel-py2.7.egg
Processing dependencies for paplot===0.2.7devel
Finished processing dependencies for paplot===0.2.7devel
about graphs¶
グラフを画像で保存したい¶
- SVG ... タグで記載されたテキストファイルです。SVG対応の画像編集ソフトウェアのほか、各種ブラウザでも表示できます。
- PNG ... 画像ファイルです。背景透過処理を施しています。
注釈
この機能は以下のブラウザで確認しています。うまく動かない場合は、最新のバージョンにアップデートするか、別のブラウザをお試しください。
- Windows
- Firefox (47.0)
- Chrome (51.0)
- Internet Explorer11 (11.0)
- Mac
- Firefox (45.2)
- Chrome (52.0)
- Safari (9.1.2)
Chromeの場合¶
フォーマット選択後、自動的にダウンロードされます。
IEの場合¶
- SVG ... フォーマット選択後、ダウンロード画面が表示されますので、任意の場所に保存してください。
- PNG ... 画像が新しいタブで表示されますので、右クリックして「名前を付けて画像を保存…」を選択してください。
Safariの場合¶
- SVG ... 画像が新しいタブで表示されますので、右クリックして「ページを別名で保存…」を選択してください。
各項目は次のように指定してください。書き出し名「{任意の名前}.svg」フォーマット「ページのソース」
- PNG ... 画像が新しいタブで表示されますので、右クリックして「イメージを別名で保存…」を選択してください。