華為云計(jì)算 云知識(shí) bedtools如何配置
bedtools如何配置

簡(jiǎn)介

bedtools實(shí)用程序是用于處理基因組信息分析的強(qiáng)大工具集合。例如,bedtools允許人們以廣泛使用的基因組文件格式( 例如BAM,BED,GFF/ GTF,VCF)與多個(gè)文件中的基因組間隔相交,合并,計(jì)數(shù),互補(bǔ)和混洗。雖然每個(gè)工具都設(shè)計(jì)為執(zhí)行相對(duì)簡(jiǎn)單的任務(wù)(例如,將兩個(gè)間隔文件相交),但可以通過(guò)在UNIX命令行上組合多個(gè)bedtools操作來(lái)進(jìn)行相當(dāng)復(fù)雜的分析。

配置流程

1.    配置編譯環(huán)境

安裝相關(guān)依賴。

yum install zlib-devel bzip2-devel xz-devel -y

2.     獲取源碼

獲取“bedtools-2.28.0”源碼包。

cd /usr/local

wget https://github.com/arq5x/bedtools2/releases/download/v2.28.0/bedtools-2.28.0.tar.gz

3.     編譯和安裝

1)解壓并進(jìn)入源碼目錄。

tar -zxvf bedtools-2.28.0.tar.gz

cd bedtools2

2)編譯。

make -j4

3)建立軟鏈接。

ln -s /usr/local/bedtools2/bin/bedtools /usr/bin/bedtools

4.    運(yùn)行和驗(yàn)證

1)獲取測(cè)試數(shù)據(jù)。

mkdir ~/lec28

cd ~/lec28

curl -O https://s3.amazonaws.com/bedtools-tutorials/web/maurano.dnaseI.tgz

curl -O https://s3.amazonaws.com/bedtools-tutorials/web/cpg.bed

curl -O https://s3.amazonaws.com/bedtools-tutorials/web/exons.bed

curl -O https://s3.amazonaws.com/bedtools-tutorials/web/gwas.bed

curl -O https://s3.amazonaws.com/bedtools-tutorials/web/genome.txt

curl -O https://s3.amazonaws.com/bedtools-tutorials/web/hesc.chromHmm.bed

tar -zxvf maurano.dnaseI.tgz

rm -f maurano.dnaseI.tgz

數(shù)據(jù)顯示如下:

[root@ecs lec28]# ls

cpg.bed                                                                fLung_L-DS17154.hg19.hotspot.twopass.fdr0.05.merge.bed

exons.bed                                                              fLung_L-DS18421.hg19.hotspot.twopass.fdr0.05.merge.bed

fBrain-DS14718.hotspot.twopass.fdr0.05.merge.bed                       fLung_R-DS15632.hotspot.twopass.fdr0.05.merge.bed

fBrain-DS16302.hotspot.twopass.fdr0.05.merge.bed                       fMuscle_arm-DS19053.hg19.hotspot.twopass.fdr0.05.merge.bed

fHeart-DS15643.hotspot.twopass.fdr0.05.merge.bed                       fMuscle_back-DS18454.hg19.hotspot.twopass.fdr0.05.merge.bed

fHeart-DS15839.hotspot.twopass.fdr0.05.merge.bed                       fMuscle_leg-DS19115.hg19.hotspot.twopass.fdr0.05.merge.bed

fHeart-DS16621.hotspot.twopass.fdr0.05.merge.bed                       fMuscle_leg-DS19158.hg19.hotspot.twopass.fdr0.05.merge.bed

fIntestine_Sm-DS16559.hotspot.twopass.fdr0.05.merge.bed                fSkin_fibro_bicep_R-DS19745.hg19.hotspot.twopass.fdr0.05.merge.bed

fIntestine_Sm-DS16712.hg19.hotspot.twopass.fdr0.05.merge.bed           fStomach-DS17659.hg19.hotspot.twopass.fdr0.05.merge.bed

fIntestine_Sm-DS16822.hotspot.twopass.fdr0.05.merge.bed                genome.txt

fIntestine_Sm-DS17808.hg19.hotspot.twopass.fdr0.05.merge.bed           gwas.bed

fIntestine_Sm-DS18495.hg19.hotspot.twopass.fdr0.05.merge.bed           hesc.chromHmm.bed

fKidney_renal_cortex_L-DS17550.hg19.hotspot.twopass.fdr0.05.merge.bed

這些文件內(nèi)容是胎兒的組織樣式,包括腦、心臟、腸道、腎臟、肺、肌肉、皮膚以及胃,其中:

a. cpg.bed:人類基因組中的CpG島。

b. exons.bed:人類基因的RefSeq外顯子。

c. gwas.bed:在全基因組關(guān)聯(lián)研究(GWAS)中鑒定的與人類疾病相關(guān)的SNP。

2)獲取交集信息。

比如,找到A和B文件中重疊的部分。

bedtools intersect -a cpg.bed -b exons.bed | head -5

[root@ecs lec28]# bedtools intersect -a cpg.bed -b exons.bed | head -5

chr1    29320    29370    CpG:_116

chr1    135124   135563   CpG:_30

chr1    327790   328229   CpG:_29

chr1    327790   328229   CpG:_29

chr1    327790   328229   CpG:_29

3)從注釋文件中,選取啟動(dòng)子。

cat hesc.chromHmm.bed | grep Promoter > promoters.bed

cat promoters.bed |head -5

[root@ecs lec28]# cat hesc.chromHmm.bed | grep Promoter > promoters.bed

[root@ecs lec28]# cat promoters.bed |head -5

chr1    27737    28537    2_Weak_Promoter

chr1    28537    30137    1_Active_Promoter

chr1    30137    30337    2_Weak_Promoter

chr1    30537    30737    3_Poised_Promoter

chr1    713137   713337   2_Weak_Promoter

4)找到跟每個(gè)exon最近的啟動(dòng)子。

bedtools closest -a exons.bed -b promoters.bed -d | head -5

[root@ecs lec28]# bedtools closest -a exons.bed -b promoters.bed -d | head -5

chr1    11873    12227    NR_046018_exon_0_0_chr1_11874_f 0        +        chr1    27737    28537    2_Weak_Promoter  15511

chr1    12612    12721    NR_046018_exon_1_0_chr1_12613_f 0        +        chr1    27737    28537    2_Weak_Promoter  15017

chr1    13220    14409    NR_046018_exon_2_0_chr1_13221_f 0        +        chr1    27737    28537    2_Weak_Promoter  13329

chr1    14361    14829    NR_024540_exon_0_0_chr1_14362_f 0        -        chr1    27737    28537    2_Weak_Promoter  12909

chr1    14969    15038    NR_024540_exon_1_0_chr1_14970_f 0        -        chr1    27737    28537    2_Weak_Promoter  12700