macでインフォマティクス

macでインフォマティクス

HTS (NGS) 関連のインフォマティクス情報についてまとめています。

genome trackを可視化する svist4get

 

 次世代シークエンシングは、生命科学の複数のハイスループットな方法を生み出した。その多くは、既存のゲノムアセンブリへのショートリードのマッピングに基づいている。マッピングされたリードの密度および計算により得られたゲノムシグナルトラックの可視化は,バイオインフォマティクスシーケンシングデータ解析における最も日常的なタスクの1つである。1つのアプローチは、専用のゲノムブラウザの使用である。UCSC Genome Browser [ref.1] やZenbu [ref.2] のような最も一般的な汎用ツールはウェブベースであり,アップロードされたユーザデータと共に既存のゲノムアノテーションインタラクティブな探索を可能にする。しかし、場合によっては、ユーザデータをリモートサーバにアップロードするのは都合が悪く、統合ゲノムビューア [ref.3] や統合ゲノムブラウザ [ref.4] のようなグラフィカルユーザインタフェースを備えたスタンドアロンアプリケーションの助けを借りて、あるいはコンソール環境 [ref.5] で直接、データを可視化し、探索することができる。最後に、ハイブリッドアプローチがあり、例えば、BioUMLバイオインフォマティクスプラットフォーム [ref.6] は、ウェブベース版とスタンドアロン版の両方でゲノムブラウジング機能を提供する。 Webベースのゲノムブラウザは、処理された公開データの探索的なデータ分析には適しているが、カスタムのペーパー品質のグラフィック生成や、進行中または非公開の実験からのデータの探索には、スタンドアロンのツールの方が適している。さらに、ゲノムのいくつかの遺伝子座について複数の画像生成プログラム方法を有することはしばしば便利である。スクリプトコマンドラインインターフェイス(論文表1)を使用してこのタスクを解決することを目的としたツールがいくつか存在する。最も進んだツールの中には、Gviz [ref.7] とggbio [ref.8] がある。これらは、ゲノムトラックとアノテーションのペアーパー品質の図を作成するためのBioconductor Rパッケージである。コマンドラインユーティリティを好むユーザはfluff [ref.9] とngs plot [ref.10] を使うことができる。これらのツールはデータ解析のためのいくつかの高度な機能を提供するが、特定のゲノムにおけるゲノムトラックセグメントの可視化への最小限のアプローチしか可能にしない。 svist4getはPython3で実装されており、複数のpypiパッケージを使用している。

 SVist4getはLinux環境で開発されテストされている。(一部略)入力データとして、svist4getはゲノムシグナル用のbedGraph形式とゲノムアノテーションのgtf形式をサポートしている。出力データとして、svist4getはベクトル・グラフィックをpdfで生成し、ラスターグラフィックをpngでエクスポートできまる。ImageMagickはラスター(ポイント)出力を提供するために使用される。 特定のゲノムウィンドウとゲノムシグナルトラックのセットが与えられると、svist4getは、必要に応じて、画像幅とゲノムウィンドウの可視長を考慮して、シグナルトラックのmoving-average smoothingを自動的に実行する。しかし、svist4getは純粋な視覚化ツールであるため、技術データの変換やリードデプス正規化などの前処理は、deeptools[ref.13]、bedtools[ref.14]、UCSCユーティリティ[ref.15]などの外部ツールを使用して実行する必要がある。 標準的なシナリオやデータ探索でのsvist4getの適用を容易にするために、コマンド行インターフェースでは、トランスクリプトーム研究で発生するいくつかの実用的な使用例を、ユーザー側のスクリプト作成の手間をかけずにカバーしている。さらに、svist4getにはPython APIが用意されており、Pythonプログラム内から追加のカスタマイズやプログラムによる使用が可能である。(以下略)

 

quick start guide

https://bitbucket.org/artegorov/svist4get/src/9a3dbaec1bd19c487d76efb5d02deddaf04b7ef8/docs/QSGUIDE.md?fileviewer=file-view-default

 

 

インストール

Python 3.6.3環境でテストした(docker使用、ホストOS mac10.12)。

依存

本体 Bitbucket

python3 -m pip install svist4get

svist4get -h

# svist4get -h 

 

svist4get (version 1.2.10): a simple visualization tool for genomic tracks from sequencing experiments. 

 

COMMAND-LINE PARAMETERS

_____________________________

[POST-INSTALL EXAMPLE DATA]

 

--sampledata

Creates the 'svist4get' folder in the current working directory.

The folder will contain sample data sets and adjustable

configuration file templates.

_____________________________

[MANDATORY ARGUMENTS]

-t <id>

Visualization of the genomic window of a particular

transcript (using GTF transcript_id)

  OR

-g <id>

Visualization of the genomic window of a particular

gene (using GTF gene_id)

  OR

-t <id> -w tss|tis <upstream> <downstream>

Visualization of the genomic window centered on a transcription start

site|translation initiation site of a particular transcript

        (using GFF transcript_id) with a fixed offsets upstream and downstream

  OR 

-w <contig> <start> <end>

Visualization an arbitrary genomic window using genomic coordinates

 

-fa <file.fa>

Path to the genome assembly multifasta for the sequence track

NOTE: the multifasta file must contain all contigs in a single file.

 

-gtf <file.gtf>

Path to the gtf file with the transcript annotation

_____________________________

[OPTIONAL ARGUMENTS]

-bg <file1.bedGraph> [<file2.bedGraph>...]

Paths to bedGraph files for genomic signal tracks

 

-pbg <file1A.bedGraph file1A.bedGraph> [ -pbg <file2A.bedGraph file2B.bedGrap>...]

Paths to 2 bedGraph files to be used for the paired genomic signal track

        (e.g. to plot signals for + and - DNA strands together). Positive and negative range

of the Y-axis will be used for the first and second file, respectively

(or vice versa if the reverse complementary transformation using -rc parameter is requested)

The track will use absolute values from each bedGraph.

Multiple paired tracks can be generated by using multiple '-pbg' parameters.

For this track, the signs of values in each bedGraph will be ignored

 

-c <path> |A4_p1|A4_p2|A4_l 

Path to a configuration file or name of the premade config file

(can be A4_p1, A4_p2, A4_l)

 

-o <name> 

Output file name. Generates a pdf (vector) or png (raster) file based on

the provided extension. Both png and pdf will be generated if the extension is not specified.

 

-hi

Hide intronic segments (default: false)

 

-rc

Reverse-complement transformation of the genomic window (default: off)

 

-bgb mean|median|max|min|none

This parameter sets the function to aggregate bedGraph signal values for a single bar of the bedGraph tracks.

  Default: 'mean'. Alternatives: 'median', 'max', 'min'. 'none' forces plotting the raw signal at 1nt resolution.

 

-bg_log 

Logarithmic (log2) scale for the each bedGraph (Y-axis).

 

-nts

Show reference genomic sequence with single-nucleotide resolution

(default: hide)

 

-aas auto|tics|codons

Style of the aminoacid sequence track: tics (suitable for long regions e.g. > 160 nts,

  shows only start and stop codons with colored tics) or codons (show each aminoacid as labeled block)

(default: auto)

 

-it <text>

Image title

 

-xs <N>

X axis tics step (nt) (default: auto)

 

-lb <N1> [<N2>..]

Y axis tics levels for a bedGraph track, a space-separated list

of values, a separate value for each bedGraph track (default: auto)

 

-ys <N1> [<N2>...]

Step between axis tics a the bedgraph track Y-axis, a space-separated

list of values, a separate value for each bedGraph track (default: auto)

 

-bul <N1> <N2>... | max

  Upper limit for a bedGraph track Y-axis, can be:

1. a space-separated list of values: a separate axis limit for each

  bedGraph track;

2. max: a maximum reachable value across all visible tracks.

Default: reachable maximum for each track separately.

 

-bll <N1> <N2>... | min

  Lower limit for a bedGraph track Y-axis, can be:

1. a space-separated list of values: a separate axis limit for each

  bedGraph track;

2. min: a minimum reachable value across all visible tracks.

Paired bedGraph uses absolute values for both signal tracks,

since the negative Y-axis range is used to display the 2nd track.

 

-bl <tex1t> <text2> 

Text labels for the bedGraph tracks, space-separated list of values,

a separate value required for each bedGraph track

(default: names of the bedGraph files)

 

-bgc <color1>[color2>..]

Space-separated list of colors for bedGraph tracks. The colors should be specified

  by names listed in the palette file (default: internal palette or palettes/palette.txt).

  The list will be cycled through if shorter than the number of bedGraph tracks.

  Paired and basic bedGraph tracks use joint color list.

 

-gi <s-e> [<s1-e1>...]

Additional track showing selected genomic intervals as segments,

space-separated list of start-end pairs

 

-gil <tex1t> <text2>...

Labels for genomic intervals, space-separated list of strings,

a separate value required for each gemomic intervals track

 

-gic <color1>[<color2>..]

Space-separated list of colors for genomic intervals tracks, uses the same logic as -bgc parameter

 

-st <transcript_id1> <transcript_id2>...

A complete list of transcript IDs to show (others will be hidden,

applicable to -w and -g modes) 

 

-tl <transcript_id> <label>

Allows to replace the default <transcript_id> label with an arbitrary text <label>.

For re-labeling several transcripts, several '-tl' keys can be used.

 

-hrf <N> 

Highlight a particular reading frame (+0, +1 or +2) 

_____________________________

[MISCELLANEOUS ARGUMENTS]

-h, --help

Show this help message and exit

 

-v, --version

Show program version

 

-hf <x1> <x2> <label>

Highlight and label a given segment of the genomic window

(global coordinates on the selected contig)

 

-hc <NtNtNt>

  Highlight selected codon on the aminoacid sequence track, e.g. -hc TGA

 

dockerイメージも置いておきます。

docker pull kazumax/svist4get 
#カレントと/dataをシェアしてラン
docker run -itv $PWD:/data/ kazumax/svist4get
> source ~/.profile
> svist4get -h #help

 

テストラン

テストデータ生成

svist4get --sampledata

ls -alh svist4get_data/

# ls -alh svist4get_data/

total 22M

drwxr-xr-x 4 root root 4.0K Apr 29 13:12 .

drwxr-xr-x 1 root root 4.0K Apr 29 13:25 ..

-rw-r--r-- 1 root root 2.7K Apr 29 13:11 A4_l.cfg

-rw-r--r-- 1 root root 2.8K Apr 29 13:11 A4_p1.cfg

-rw-r--r-- 1 root root 2.7K Apr 29 13:11 A4_p2.cfg

-rw-r--r-- 1 root root 2.6K Apr 29 13:11 MATa.fasta

-rw-r--r-- 1 root root   24 Apr 29 13:11 MATa.fasta.fai

-rw-r--r-- 1 root root 1.4K Apr 29 13:11 MATa.gtf

-rw-r--r-- 1 root root 183K Apr 29 13:11 RiboCov_cut.bedGraph

-rw-r--r-- 1 root root 114K Apr 29 13:11 RiboProElong_cut.bedGraph

-rw-r--r-- 1 root root  12M Apr 29 13:11 S.cerevisiae.dna.fa

-rw-r--r-- 1 root root  415 Apr 29 13:11 S.cerevisiae.dna.fa.fai

-rw-r--r-- 1 root root 9.1M Apr 29 13:11 S.cerevisiae.gtf

-rw-r--r-- 1 root root 2.8K Apr 29 13:11 alt_A4_p1.cfg

-rw-r--r-- 1 root root  260 Apr 29 13:11 alt_palette.txt

drwxr-xr-x 2 root root 4.0K Apr 29 13:12 fonts

drwxr-xr-x 2 root root 4.0K Apr 29 13:12 help

-rw-r--r-- 1 root root 216K Apr 29 13:11 mRNACov_cut.bedGraph

-rw-r--r-- 1 root root 4.5K Apr 29 13:11 mata_ribo1_minus.bedGraph

-rw-r--r-- 1 root root 5.3K Apr 29 13:11 mata_ribo1_plus.bedGraph

-rw-r--r-- 1 root root 3.2K Apr 29 13:11 mata_ribo2_minus.bedGraph

-rw-r--r-- 1 root root 4.7K Apr 29 13:11 mata_ribo2_plus.bedGraph

-rw-r--r-- 1 root root  15K Apr 29 13:11 mata_rna1_minus.bedGraph

-rw-r--r-- 1 root root  16K Apr 29 13:11 mata_rna1_plus.bedGraph

-rw-r--r-- 1 root root  13K Apr 29 13:11 mata_rna2_minus.bedGraph

-rw-r--r-- 1 root root  13K Apr 29 13:11 mata_rna2_plus.bedGraph

-rw-r--r-- 1 root root  217 Apr 29 13:11 palette.txt

-rw-r--r-- 1 root root  404 Apr 29 13:11 triplet_code.txt

 

sampleディレクトリができたらsvist4getを実行する。ゲノムのfasta、gtf、シーケンシングデータのbedgraphファイルを指定する。

視覚化する遺伝子はYFL031Wとする。このYFL031Wはgtfのtranscript IDから指定している。

svist4get \
-gtf svist4get_data/S.cerevisiae.gtf \
-fa svist4get_data/S.cerevisiae.dna.fa \
-bg svist4get_data/RiboCov_cut.bedGraph \
-t YFL031W
  • -gtf   Path to the gtf file with the transcript annotation
  • -fa    Path to the genome assembly multifasta for the sequence track
    NOTE: the multifasta file must contain all contigs in a single file.
  • -bg   Paths to bedGraph files for genomic signal tracks

     [MANDATORY ARGUMENTS]

  • -t <id>    Visualization of the genomic window of a particular transcript (using GTF transcript_id)   OR
  • -g <id>     Visualization of the genomic window of a particular gene (using GTF gene_id)     OR
  • -t <id> -w tss|tis <upstream> <downstream>    Visualization of the genomic window centered on a transcription start site|translation initiation site of a particular transcript (using GFF transcript_id) with a fixed offsets upstream and downstream  OR
  • -w <contig> <start> <end>   Visualization an arbitrary genomic window using genomic coordinates

出力。赤い波部分が指定したデータ; RiboCov_cut.bedGraph。

f:id:kazumaxneo:20190429134946j:plain


データのbedgraphは複数指定できる。下では3つ指定している。イントロンは非表示とする(-hi)。

svist4get \
-gtf svist4get_data/S.cerevisiae.gtf \
-fa svist4get_data/S.cerevisiae.dna.fa \
-bg svist4get_data/RiboProElong_cut.bedGraph svist4get_data/RiboCov_cut.bedGraph svist4get_data/mRNACov_cut.bedGraph \
-t YFL031W \
-it 'Gene HAC1' \
-bl 'A-Site Ribo-Seq' 'Coverage Ribo-Seq' 'RNA-Seq' \
-hi \
-hrf 0 \
-c A4_p1
  • -bl <tex1> <text2>    Text labels for the bedGraph tracks, space-separated list of values, a separate value required for each bedGraph track (default: names of the bedGraph files).
  • -hi     Hide intronic segments (default: false).
  • -hrf    Highlight a particular reading frame (+0, +1 or +2).
  • -it      Image title.
  • -c      Path to a configuration file or name of the premade config file (can be A4_p1, A4_p2, A4_l).

3つのtarackが視覚化された。タイトルは-it 'Gene HAC1'で指定し、それぞれのtrack名は-bl 'A-Site Ribo-Seq' 'Coverage Ribo-Seq' 'RNA-Seq'で指定している。

f:id:kazumaxneo:20190429135728j:plain


領域を指定して転写開始点付近を視覚化する(translation initiation site (tis)の-100から+30まで)。

svist4get \
-gtf svist4get_data/S.cerevisiae.gtf \
-fa svist4get_data/S.cerevisiae.dna.fa \
-bg svist4get_data/RiboProElong_cut.bedGraph svist4get_data/RiboCov_cut.bedGraph svist4get_data/mRNACov_cut.bedGraph \
-bl 'A-Site Ribo-Seq' 'Coverage Ribo-Seq' 'RNA-Seq' \
-t YOR030W \
-w tis 100 30 \
-it 'Upstream ORF of DFG16 gene' \
-gi 386730-386772 \
-gi 386824-386999 \
-gil 'Upstream ORF' 'CDS' \
-hf 386730 386772 ' '
  • -w <contig> <start> <end>   Visualization an arbitrary genomic window using genomic coordinates.
  • -gi <start-end>   Additional track showing selected genomic intervals as segments, space-separated list of start-end pairs.
  • -gil <tex1t> <text2>...   Labels for genomic intervals, space-separated list of strings, a separate value required for each gemomic intervals track.
  • -hf <x1> <x2> <label>
    Highlight and label a given segment of the genomic window (global coordinates on the selected contig).

f:id:kazumaxneo:20190429135808j:plain

 

出力名はHAC1とする。

svist4get \
-gtf svist4get_data/S.cerevisiae.gtf \
-fa svist4get_data/S.cerevisiae.dna.fa \
-bg svist4get_data/RiboProElong_cut.bedGraph svist4get_data/RiboCov_cut.bedGraph svist4get_data/mRNACov_cut.bedGraph \
-bl 'A-Site Ribo-Seq' 'Coverage Ribo-Seq' 'RNA-Seq' \
-g YFL031W \
-it 'Gene HAC1' \
-hf 75839 76091 intron \
-c svist4get_data/A4_p1.cfg \
-o HAC1
  • -g    Visualization of the genomic window of a particular gene (using GTF gene_id)

出力のHAC1.pdf

f:id:kazumaxneo:20190429135932j:plain

 

svist4get \
-gtf svist4get_data/S.cerevisiae.gtf \
-fa svist4get_data/S.cerevisiae.dna.fa \
-bg svist4get_data/RiboProElong_cut.bedGraph svist4get_data/RiboCov_cut.bedGraph svist4get_data/mRNACov_cut.bedGraph \
-bl 'A-Site Ribo-Seq' 'Coverage Ribo-Seq' 'RNA-Seq' \
-w I 108842 113506 \
-it 'CCR4 and FUN26 genes' \
-rc \
-c svist4get_data/A4_p1.cfg
  • -rc   Reverse-complement transformation of the genomic window (default: off)

f:id:kazumaxneo:20190429140040j:plain

 

 

svist4get \
-gtf svist4get_data/MATa.gtf \
-fa svist4get_data/MATa.fasta \
-pbg svist4get_data/mata_ribo1_plus.bedGraph svist4get_data/mata_ribo1_minus.bedGraph \
-pbg svist4get_data/mata_ribo2_plus.bedGraph svist4get_data/mata_ribo2_minus.bedGraph \
-pbg svist4get_data/mata_rna1_plus.bedGraph svist4get_data/mata_rna1_minus.bedGraph \
-pbg svist4get_data/mata_rna2_plus.bedGraph svist4get_data/mata_rna2_minus.bedGraph \
-w V01313.1 390 2430 \
-rc -it 'MAT locus of MATa yeast strain' \
-bl 'Ribo-Seq (sample1)' 'Ribo-Seq(sample2)' 'RNA-Seq (sample1)' 'RNA-Seq (sample2)' \
-bgc brightorange brightorange purple purple \
-c svist4get_data/alt_A4_p1.cfg \
-hf 1224 1305 ' ' \
-hf 1533 1638 'Translated open reading frames' \
-hf 1692 1932 ' '

f:id:kazumaxneo:20190429140132j:plain

 

bamからbedgraphの作成はbedtools genomecovなどで行える(*1)。

bedtools genomecovを"-bg"付きで実行する。

bedtools genomecov -ibam input.bam -bg > output.bg
  • -bg     Report depth in BedGraph format. For details, see: genome.ucsc.edu/goldenPath/help/bedgraph.html
  • -ibam    The input file is in BAM format. Note: BAM _must_ be sorted by position.

 

引用

svist4get: a simple visualization tool for genomic tracks from sequencing experiments

Artyom A. Egorov, Ekaterina A. Sakharova, Aleksandra S. Anisimova, Sergey E. Dmitriev, Vadim N. Gladyshev, Ivan V. Kulakovskiy
BMC Bioinformatics 2019 20:113

 

関連

 

*1

from bam to bedgraph

bam file to .bedgraph