bioMart包是一個(gè)連接bioMart數(shù)據(jù)庫(kù)的R語(yǔ)言接口,能通過(guò)這個(gè)軟件包自由連接到bioMart數(shù)據(jù)庫(kù)
這個(gè)·包可以做以下幾個(gè)工作
1.查找某個(gè)基因在染色體上的位置。反之,給定染色體每一區(qū)間,返回該區(qū)間的基因s;
2.通過(guò)EntrezGene的ID查找到相關(guān)序列的GO注釋。反之,給定相關(guān)的GO注釋?zhuān)@取相關(guān)的EntrezGene的ID;
3.通過(guò)EntrezGene的ID查找到相關(guān)序列的上游100bp序列(可能包含啟動(dòng)子等調(diào)控元件);
4.查找人類(lèi)染色體上每一段區(qū)域中已知的SNPs;
5.給定一組的序列ID,獲得其中具體的序列;
實(shí)例背景:RNA-seq
在這篇文章中http://www.lxweimin.com/p/4d0812195b65 我們通過(guò)R語(yǔ)言中的數(shù)據(jù)處理獲得了基因的表達(dá)矩陣,并且獲得了在EBI數(shù)據(jù)庫(kù)中的基因編號(hào)(基因編號(hào)ensembl_gene_id)
>head(raraw_count_filt )
ensembl_gene_id gene_id control1 control2 treat1 treat2
ENSG00000000003 ENSG00000000003 ENSG00000000003.14_2 1576 713 1589 1969
ENSG00000000005 ENSG00000000005 ENSG00000000005.5_2 0 0 0 1
ENSG00000000419 ENSG00000000419 ENSG00000000419.12_2 756 384 806 984
ENSG00000000457 ENSG00000000457 ENSG00000000457.13_3 301 151 217 324
ENSG00000000460 ENSG00000000460 ENSG00000000460.16_5 764 312 564 784
ENSG00000000938 ENSG00000000938 ENSG00000000938.12_2 0 0 0 0
接下來(lái)我們要用bioMart這個(gè)包從ensembl數(shù)據(jù)庫(kù)獲得基因的注釋
下載并載入R包
>source("http://www.bioconductor.org/biocLite.R")
>biocLite("biomaRt")
>library("biomaRt")
1.顯示一下能連接的數(shù)據(jù)庫(kù)
> listMarts()
biomart version
1 ENSEMBL_MART_ENSEMBL Ensembl Genes 94
2 ENSEMBL_MART_MOUSE Mouse strains 94
3 ENSEMBL_MART_SNP Ensembl Variation 94
4 ENSEMBL_MART_FUNCGEN Ensembl Regulation 94
這里我們選擇ensembl數(shù)據(jù)庫(kù)
2.用useMart函數(shù)選定數(shù)據(jù)庫(kù)
> plant<-useMart("ensembl")
用listDatasets()函數(shù)顯示當(dāng)前數(shù)據(jù)庫(kù)所含的基因組注釋
> listDatasets(plant)
dataset
1 acalliptera_gene_ensembl
2 acarolinensis_gene_ensembl
3 acitrinellus_gene_ensembl
4 amelanoleuca_gene_ensembl
5 amexicanus_gene_ensembl
6 anancymaae_gene_ensembl
7 aocellaris_gene_ensembl
···
···
54 hsapiens_gene_ensembl
這里我們要獲取的基因注釋的基因是人類(lèi)基因,所以選擇hsapiens_gene_ensembl
3.用useDataseq()函數(shù)選定數(shù)據(jù)庫(kù)中的基因組
>mart <- useDataset("hsapiens_gene_ensembl", useMart("ensembl"))
這條語(yǔ)句的意思是:選定ensembl數(shù)據(jù)庫(kù)中的hsapiens_gene_ensembl基因組
4.選定我們需要獲得的注釋類(lèi)型
用lsitFilters()函數(shù)查看可選擇的類(lèi)型,選定要獲取的注釋類(lèi)型,以及已知注釋的類(lèi)型
> listFilters(mart)
name
1 chromosome_name
2 start
3 end
4 band_start
5 band_end
6 marker_start
7 marker_end
8 encode_region
9 strand
10 chromosomal_region
11 with_ccds
12 with_chembl
13 with_clone_based_ensembl_gene
14 with_clone_based_ensembl_transcript
15 with_dbass3
16 with_dbass5
17 with_entrezgene_trans_name
18 with_embl
19 with_arrayexpress
20 with_genedb
21 with_go
這里我們選擇這些要獲得數(shù)值的類(lèi)型
ensembl_gene_id ,hgnc_symbol chromosome_name start_position end_position band
我們已知的類(lèi)型是ensembl_gene_id
選擇好數(shù)據(jù)庫(kù),基因組,要獲得的注釋類(lèi)型,和已知的注釋類(lèi)型,就可以開(kāi)始獲取注釋了
5.用getBM()函數(shù)獲取注釋
hg_symbols<- getBM(attributes=c('ensembl_gene_id','hgnc_symbol',"chromosome_name", "start_position","end_position", "band"), filters= 'ensembl_gene_id', values = my_ensembl_gene_id, mart = mart)
這個(gè)函數(shù)有
4個(gè)參數(shù)
attributers()里面的值為我們要獲取的注釋類(lèi)型
filters()里面的值為我們已知的注釋類(lèi)型
values= 這個(gè)值就是我們已知的注釋類(lèi)型的數(shù)據(jù),把上面我們通過(guò)數(shù)據(jù)處理得到的ensembl基因序號(hào)作為ensembl_gene_id 的值
mart= 這個(gè)值是我們所選定的數(shù)據(jù)庫(kù)的基因組
mart <- useDataset("hsapiens_gene_ensembl", useMart("ensembl"))
獲取完注釋就可以把注釋文件和基因表達(dá)量文件合并起來(lái)了
注釋就完成了!