macでインフォマティクス

macでインフォマティクス

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

FASTQ、BED、BAMを操作するNGSUtilsその2 bedutils

2回目はbedを操作するbedutilsを紹介する。

 

インストール

公式ページ

NGSUtils - bedutils

git clone git://github.com/ngsutils/ngsutils.git
cd ngsutils/
make #依存がインストールされる(詳細はwebマニュアル参照)

$ ./bedutils

Usage: bedutils COMMAND

 

Commands

  General

    clean        - Cleans a BED file (score should be integers)

    extend       - Extends BED regions (3')

    overlap      - Find overlapping BED regions from a query and target file

    reduce       - Merges overlapping BED regions

    refcount     - Given a number of BED files, calculate the number of samples that overlap regions in a reference BED file

    sizes        - Extract the sizes of BED regions

    sort         - Sorts a BED file (in place)

    stats        - Calculates simple stats for a BED file

    subtract     - Subtracts one set of BED regions from another

 

  Conversion

    annotate     - Annotate BED files by adding / altering columns

    frombasecall - Converts a file in basecall format to BED3 format

    fromprimers  - Converts a list of PCR primer pairs to BED regions

    fromvcf      - Converts a file in VCF format to BED6

    tobed3       - Removes extra columns from a BED (or BED compatible) file

    tobed6       - Removes extra columns from a BED (or BED compatible) file

    tobedgraph   - BED to BedGraph

    tofasta      - Extract BED regions from a reference FASTA file

 

  Misc

    cleanbg      - Cleans up a bedgraph file

 

Run 'bedutils help CMD' for more information about a specific command

ngsutils 0.5.9-a7f08f5

パスを通しておく。

 

ラン

 

clean(リンクポジションを整数に修復する。

bamutils clean input.bed > output.bed

 

extend(リンクポジションを指定数変更する。

#5'側を100bp、3'側を100bp伸ばす
bamutils extend -5 100 -3 100 input.bed > output.bed

 

nearest(リンクリファレンスの最も近い位置のアノテーションを取ってくる

 bamutils nearest input.bed reference.bed
  • -max     The maximal distance to look for a nearest region (default: 100K)   

  • -match   Only use regions in the reference that contain the name  from the query file.

             

sizes(リンク領域のサイズを調べる。

 bamutils sizes input.bed > output

 

sort(リンクポジションソートする。

 bamutils sort input.bed output.bed

 

stats(リンクstatistics

 bamutils stats input.bed

 

tobed3(リンク3カラム形式のbedに変換。

 bamutils tobed3 input.bed > output.bed

 

tobed6(リンク6カラム形式のbedに変換。

 bamutils tobed6 input.bed > output.bed

 

tofasta(リンクbedの領域をfastaで出力。

 bamutils tofasta input.bed ref.fasta > output.fasta

 

 

overlap(リンクオーバーラップする領域を探す

reduce(リンクオーバーラップする領域を減らす。

refcount(リンクオーバーラップする領域数を数える。

subtract(リンク2つのbedを比較してオーバーラップする領域を消す。

annotate(リンクアノテーションをつけてBED3からBED6に変換。

frombasecall(リンクbasecallフォーマットからBED3に変換。

fromprimers(リンクprimerペアからBEDで領域を作成。

tobedgraph(リンクオーバーラップがあるbedからbedgraphを作成。

cleanbg(リンクbedgraphを修復。

 

bedのオーバーラップを抽出したりするならbedtoolsを使ってください。

 

引用

NGSUtils: a software suite for analyzing and manipulating next-generation sequencing datasets

Marcus R. Breese and Yunlong Liu

Bioinformatics. 2013 Feb 15; 29(4): 494–496.