生物信息学分析生物信息学与算法生物信息学习

msigdbr 包提供多个物种的MSigDB数据

2020-08-07  本文已影响0人  JeremyL

富集分析是一种大家常用的分析。富集分析之前通常需要将人类定义好的基因集转换为其他物种。msigdbr 是一个工具包,就可以很好地帮大家解决这个问题。

#1. 安装:

install.packages("msigdbr")

#2. 使用

library(msigdbr)

##2.1 查看数据可用的物种

msigdbr_show_species()
#>  [1] "Bos taurus"               "Caenorhabditis elegans"   "Canis lupus familiaris"  
#>  [4] "Danio rerio"              "Drosophila melanogaster"  "Gallus gallus"           
#>  [7] "Homo sapiens"             "Mus musculus"             "Rattus norvegicus"       
#> [10] "Saccharomyces cerevisiae" "Sus scrofa"

##2.2 人类的基因集:

m_df = msigdbr(species = "Homo sapiens")
head(m_df)
#> # A tibble: 6 x 9
#>   gs_id  gs_name    gs_cat gs_subcat   human_gene_… species_n… entrez_g… gene_sym… sources
#>   <chr>  <chr>      <chr>  <chr>       <chr>        <chr>          <int> <chr>     <chr>  
#> 1 M12609 AAACCAC_M… C3     MIR:MIR_Le… ABCC4        Homo sapi…     10257 ABCC4     <NA>   
#> 2 M12609 AAACCAC_M… C3     MIR:MIR_Le… ABRAXAS2     Homo sapi…     23172 ABRAXAS2  <NA>   
#> 3 M12609 AAACCAC_M… C3     MIR:MIR_Le… ACTN4        Homo sapi…        81 ACTN4     <NA>   
#> 4 M12609 AAACCAC_M… C3     MIR:MIR_Le… ACVR1        Homo sapi…        90 ACVR1     <NA>   
#> 5 M12609 AAACCAC_M… C3     MIR:MIR_Le… ADAM9        Homo sapi…      8754 ADAM9     <NA>   
#> 6 M12609 AAACCAC_M… C3     MIR:MIR_Le… ADAMTS5      Homo sapi…     11096 ADAMTS5   <NA>

##2.3 查看基因集类别:

m_df %>% dplyr::distinct(gs_cat, gs_subcat) %>% dplyr::arrange(gs_cat, gs_subcat)
#> # A tibble: 19 x 2
#>    gs_cat gs_subcat       
#>    <chr>  <chr>           
#>  1 C1     ""              
#>  2 C2     "CGP"           
#>  3 C2     "CP"            
#>  4 C2     "CP:BIOCARTA"   
#>  5 C2     "CP:KEGG"       
#>  6 C2     "CP:PID"        
#>  7 C2     "CP:REACTOME"   
#>  8 C3     "MIR:MIRDB"     
#>  9 C3     "MIR:MIR_Legacy"
#> 10 C3     "TFT:GTRD"      
#> 11 C3     "TFT:TFT_Legacy"
#> 12 C4     "CGN"           
#> 13 C4     "CM"            
#> 14 C5     "BP"            
#> 15 C5     "CC"            
#> 16 C5     "MF"            
#> 17 C6     ""              
#> 18 C7     ""              
#> 19 H      ""

##2.4 检索鼠类的hallmark 基因集:

m_df = msigdbr(species = "Mus musculus", category = "H")
head(m_df)
#> # A tibble: 6 x 9
#>   gs_id gs_name   gs_cat gs_subcat human_gen… species_… entrez_g… gene_sym… sources       
#>   <chr> <chr>     <chr>  <chr>     <chr>      <chr>         <int> <chr>     <chr>         
#> 1 M5905 HALLMARK… H      ""        ABCA1      Mus musc…     11303 Abca1     Inparanoid,Ho…
#> 2 M5905 HALLMARK… H      ""        ABCB8      Mus musc…     74610 Abcb8     Inparanoid,Ho…
#> 3 M5905 HALLMARK… H      ""        ACAA2      Mus musc…     52538 Acaa2     Inparanoid,Ho…
#> 4 M5905 HALLMARK… H      ""        ACADL      Mus musc…     11363 Acadl     Inparanoid,Ho…
#> 5 M5905 HALLMARK… H      ""        ACADM      Mus musc…     11364 Acadm     Inparanoid,Ho…
#> 6 M5905 HALLMARK… H      ""        ACADS      Mus musc…     11409 Acads     Inparanoid,Ho…

##2.5 检索鼠类C2 (curated) CGP (chemical and genetic perturbations)基因集:

m_df = msigdbr(species = "Mus musculus", category = "C2", subcategory = "CGP")
head(m_df)
#> # A tibble: 6 x 9
#>   gs_id gs_name   gs_cat gs_subcat human_gen… species_… entrez_g… gene_sym… sources       
#>   <chr> <chr>     <chr>  <chr>     <chr>      <chr>         <int> <chr>     <chr>         
#> 1 M1423 ABBUD_LI… C2     CGP       AHNAK      Mus musc…     66395 Ahnak     Inparanoid,Ho…
#> 2 M1423 ABBUD_LI… C2     CGP       ANKRD40    Mus musc…     71452 Ankrd40   Inparanoid,Ho…
#> 3 M1423 ABBUD_LI… C2     CGP       ARID1A     Mus musc…     93760 Arid1a    Inparanoid,Ho…
#> 4 M1423 ABBUD_LI… C2     CGP       BCKDHB     Mus musc…     12040 Bckdhb    Inparanoid,Ho…
#> 5 M1423 ABBUD_LI… C2     CGP       C16orf89   Mus musc…    239691 AU021092  Inparanoid,Ho…
#> 6 M1423 ABBUD_LI… C2     CGP       CAPN9      Mus musc…     73647 Capn9     Inparanoid,Ho…

##2.6 msigdbr()的输出,常规的R数据框操作都可以进行

m_df = msigdbr(species = "Mus musculus") %>% dplyr::filter(gs_cat == "H")
head(m_df)
#> # A tibble: 6 x 9
#>   gs_id gs_name   gs_cat gs_subcat human_gen… species_… entrez_g… gene_sym… sources       
#>   <chr> <chr>     <chr>  <chr>     <chr>      <chr>         <int> <chr>     <chr>         
#> 1 M5905 HALLMARK… H      ""        ABCA1      Mus musc…     11303 Abca1     Inparanoid,Ho…
#> 2 M5905 HALLMARK… H      ""        ABCB8      Mus musc…     74610 Abcb8     Inparanoid,Ho…
#> 3 M5905 HALLMARK… H      ""        ACAA2      Mus musc…     52538 Acaa2     Inparanoid,Ho…
#> 4 M5905 HALLMARK… H      ""        ACADL      Mus musc…     11363 Acadl     Inparanoid,Ho…
#> 5 M5905 HALLMARK… H      ""        ACADM      Mus musc…     11364 Acadm     Inparanoid,Ho…
#> 6 M5905 HALLMARK… H      ""        ACADS      Mus musc…     11409 Acads     Inparanoid,Ho…

#3 与其它Pathway 分析工具进行整合分析

m_t2g = m_df %>% dplyr::select(gs_name, entrez_gene) %>% as.data.frame()
enricher(gene = gene_ids_vector, TERM2GENE = m_t2g, ...)
m_t2g = m_df %>% dplyr::select(gs_name, gene_symbol) %>% as.data.frame()
enricher(gene = gene_symbols_vector, TERM2GENE = m_t2g, ...)
m_list = m_df %>% split(x = .$gene_symbol, f = .$gs_name)
fgsea(pathways = m_list, ...)

#4 注意:

原文: Introduction to the msigdbr package

上一篇下一篇

猜你喜欢

热点阅读