macでインフォマティクス

macでインフォマティクス

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

染色体の遺伝子密度マップを描く DensityMap

2021 3/14 修正

 

 ゲノムデータを可視化するためのツールはいくつか存在する。GbrowseやJbrowseのようないくつかのツールは、小さなゲノム領域に対しては非常に効率的であるが、ゲノム全体には適していない。また、PhenogramやCViTのように、ゲノム全体の可視化に使用できるものもあるが、非常に高密度なゲノムの特徴(例:interspersed repeats)を表示するようには設計されていない。この論文では、染色体に沿っていくつかの特徴(遺伝子、ncRNA、cpgなど)の密度をゲノム全体のスケールで表示することができる軽量のPerlプログラム、DensityMapを開発した。DensityMapの最大の特徴は、GFFアノテーションファイルを直接使用して、ユーザーからの追加情報を必要とせずに特徴の密度を計算できることである。結果として得られる画像は容易に設定可能であり、使用するカラースケールはプロットされたデータに最適になるようにカスタマイズできる。
 DensityMap は Linux アーキテクチャ上で動作し、ユーザーはゲノム全体の特徴の分布と密度を簡単かつ迅速に視覚化することができる。入力は、染色体(連鎖またはpseudo molecule)を表すGFF3形式のデータと、密度マップの表現を計算するために使用される特徴のセットである。実際には、DensityMapでは、染色体に沿った1つまたは複数の特徴の密度と、これらの特徴に覆われた塩基の数を計算するために、ティリングウィンドウを使用する。密度はカラースケールで表現され、重要なポイントを強調するようにカスタマイズできる。密度マップは、特徴の分布を比較することができる。1枚の画像の中で、複数の染色体密度マップを計算し、それぞれが異なるゲノムの特徴を表す。また、ゲノムのヌクレオチド配列を利用して、染色体に沿ったGC含有量の密度マップを計算し、プロットすることもできる。
 DensityMapは、ゲノム内のあらゆる種類のゲノム特徴の分布と密度を表示する、コンパクトで使いやすいツールである。また、いくつかのタイプの特徴の密度を一つの表現で視覚化できる柔軟性を持っている。作成された画像は簡単に設定でき、SVG形式であるため出力後に編集もできる。

 

manual

レポジトリにManual DensityMap.pdf (link)が含まれている。

 

インストール

Dockerfileのレシピを書いて( *1)、そのイメージ内でテストした。

Github

git clone https://github.com/sguizard/DensityMap.git
cd DensityMap/
./install.sh # *2

> DensityMap.pl

# DensityMap.pl 

 

!!!!gff, output_img_name, type_to_draw options are MANDATORY !!!!! 

 

 

USAGE: DensityMap.pl -i chromosome.gff3 -ty 'match=all' -o Chromosome

    

Options:

    -i     | input string                Gff file (version gff3 only !)          (Mandatory)

    -re    | region_file string          A bed file describing the regions to plot 

                                         for each sequence to plot. Allow to plot 

                                         sepecific region and not whole sequence.

                                         Exemple:

                                         seq1 100000 200000

                                         seq2 200000 350000

                                         Format: file.gff or "file1.gff;file2.gff"

    -o     | output_img_name string      Name of the output image                (Mandatory)

    -ty    | type_to_draw string         List of type (column 3 of gff)          (Mandatory)

                                         to draw, strand to use and color scale

                                         Type: match, gene, CDS, ...

                                         Strand: - -        -> strand -

                                                 - +        -> strand +

                                                 - both     -> strand - and strand +

                                                 - fused    -> Combination of strand - and strand +

                                                 - all      -> strand - and strand + and fused

                                         Format: "match=all;gene=both;CDS=fused" or

                                                 "match=all=7;gene=both=7;CDS=fused=10"

 

Generic options: 

    -for   | force                       Automaticaly answer yes to picture size validation

    -v     | verbose                     MORE text dude !!!!

    -h     | help                        This help

 

Density options: 

    -c     | colour_scale int            Color scale to use    (Default = 7)

    -sc    | scale_factor int            = window length in bp (Default = 1000)

    -a     | auto_scale_factor int       Max picture height in pixel

    -ro    | rounding_method string      floor or ceil         (Default = floor)

    -gc    | gc integer                  if set, add a density map of the GC%

 

Graphical options: 

    -ti    | title string                Title to print on the picture

    -w     | win_size int                Height of window in pixel       (Default = 1)

    -sh    | show_scale int              Draw scale, the integer indicate the maximum 

                                         tick to print on the scale      (Default = 50)

    -str_w | str_width int               Strand width in pixel           (Default = 50)

    -str_s | str_space int               Space between strands in pixel  (Default = 50)

    -sp    | space_chr int               Space between chromsomes        (Default = 50)

    -lm    | lmargin int                 Left margin in pixel            (Default = 50)

    -rm    | rmargin int                 Rigth margin in pixel           (Default = 50)

    -tm    | tmargin int                 Top margin in pixel             (Default = 50)

    -bm    | bmargin int                 Bottom margin in pixel          (Default = 50)

    -ba    | background color            Fill Background                 (Default = no Background)

    -la    | label_strand_rotation int   Rotation degree of strand label (Default = 0)

    -ft_f  | ft-family string            Font to use for text            (Default = Helvetica)

    -ft_s  | ft-size int                 Size of the font                (Default = 16)

 

 

    This program is free software: you can redistribute it and/or modify

    it under the terms of the GNU General Public License as published by

    the Free Software Foundation, either version 3 of the License, or

    any later version.

 

    This program is distributed in the hope that it will be useful,

    but WITHOUT ANY WARRANTY; without even the implied warranty of

    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

    GNU General Public License for more details.

 

    You should have received a copy of the GNU General Public License

    along with this program.  If not, see <http://www.gnu.org/licenses/>.

 

 

 

 

実行方法

GFF3ファイルを指定する。サイズはmax4000。

DensityMap.pl -i input.gff3 -ty "chr=fused" -o out.svg -a 3000 -for
  • -o    output_img_name string Name of the output image (Mandatory)
  • -ty   type_to_draw string List of type (column 3 of gff) (Mandatory)

    to draw, strand to use and color scale

    Type: match, gene, CDS, ...

    Strand: - ;  strand -

    + ;  strand +

    both ; strand - and strand +

    fused ;  Combination of strand - and strand +

    all ;  strand - and strand + and fused

    Format: "match=all;gene=both;CDS=fused" or

    "match=all=7;gene=both=7;CDS=fused=10"

  •  -a    auto_scale_factor int Max picture height in pixel

  • -for  force Automaticaly answer yes to picture size validation

 

出力(Arabidopsis_thaliana.TAIR10.47.gff3)

f:id:kazumaxneo:20210313161745p:plain

 

短すぎると線が見えない。Mtだけで書いてみる。GFF3を用意して、

f:id:kazumaxneo:20210313165052p:plain

 

実行する。

DensityMap.pl -i Mt.gff3 -ty "gene=fused" -o /data/out.svg -for -sh 100 -title "A.thaliana Mt genome" -ro ceil -lm 100 -gc
  • -o    output_img_name string Name of the output image (Mandatory)

f:id:kazumaxneo:20210313165538p:plain

SVGファイルなので、出力後に編集することもできます。

 

引用

DensityMap: a genome viewer for illustrating the densities of features
Sébastien Guizard, Benoît Piégu & Yves Bigot
BMC Bioinformatics volume 17, Article number: 204 (2016)

 

*1

良い機会なのでperlのツールをテストするためのDocker imageを作っておく。

cd <your>/<working_dir>

 

次のレシピでDockerfileを作成(Dockerfileというファイル名でカレントパスに保存)。cpanmとビルドに必要なパッケージの導入、cpanmのパス指定、shからbashへの変更、GD::SVGの導入を指定している。

#################################################
FROM ubuntu:18.04
MAINTAINER Kazuma Uesaka

LABEL description="Base image for DensityMap"

#################################################

RUN apt update -y && apt install -y \
build-essential \
bzip2 \
wget \
cmake \
git \
gcc \
make \
libgd-dev \
pkg-config \
cpanminus

ENV PERL_PATH=/etc/perl/
ENV PERL5LIB=$PERL_PATH:$PERL_PATH/lib/perl5:$PERL5LIB
#GD::SVGの導入
RUN cpanm -L /etc/perl/ GD::SVG

Shell ["/bin/bash", "-c"]

WORKDIR /home
#################################################

Dockerfileをカレントに保存する。

 

ここではkazumax/densitymapとしてビルド。

docker build -t kazumax/densitymap .

 

イメージのラン、中でDensityMapをpullしてパスを通す(*2)。

docker run --rm -itv $PWD:/data/ kazumax/DensityMap
git clone https://github.com/sguizard/DensityMap.git
cd DensityMap/
./install.sh
DensityMap.pl

 

 

*2

# cat install.sh
#/bin/sh

mkdir /usr/local/share/DensityMap
cp -r ./* /usr/local/share/DensityMap
cd /usr/local/bin
ln -s /usr/local/share/DensityMap/DensityMap.pl