内容

1LOLA生物导体包

生物数据经常与参考数据库进行比较,并寻找有趣的丰富和消耗模式。例如,基因集分析对于建立不同类型的基因组数据之间的联系至关重要。然而,它有一个主要的限制:它需要以基因为中心的数据。随着我们对基因调控的理解不断进步,这一点越来越受到限制。很明显,基因表达和染色质组织由成千上万的增强子和其他功能元件控制,这些功能元件通常很难映射到基因符号上。下一代测序技术推动了对基因组区域集的日益重视,该技术产生的数据在基因组区域的背景下进行了最自然的分析——如峰和片段。研究界现在已经建立了许多细胞类型的调控元件和其他基因组特征的大型目录。LOLA利用这些目录对基因组范围进行富集分析。

1.1分析做准备

在本文中,您将使用LOLA包附带的小型示例数据集来初步了解LOLA工作流中最常见的功能。

运行LOLA分析需要3个条件:

  1. 一个区域数据库。
  2. userSets:感兴趣的区域(至少有一组区域作为GRanges对象,或多个感兴趣的区域作为GRangesList对象)
  3. userUniverse:测试包含在感兴趣的区域集中的区域集(单个GRanges对象)

让我们加载一个示例regionDBloadRegionDB ().下面是LOLA附带的一个小例子。数据库位置应该指向一个包含集合子文件夹的文件夹:

dbPath = system. library("LOLA")file("extdata", "hg19", package="LOLA") regionDB = loadRegionDB(dbPath)

regionDB是一个R (list)对象,它有几个元素:

名(regionDB)
##[1]“dbLocation”“regionAnno”“collectionAnno”“regionGRL”
  • dbLocation:一个字符串,记录传递到的数据库文件夹的位置loadRegionDB ()
  • collectionAnno:data.table对集合进行注释,使用与您的集合数据库中的注释文件。
  • regionAnno:data.table注释每个区域集,用行对应数据库中的床文件(还有一个集合记录每个区域集属于哪个集合的列)。
  • regionGRL:GRangesList对象保存实际的区域,每个区域集有一个列表元素,顺序如下regionAnno

现在加载了数据库,让我们加载一些示例数据(感兴趣的区域和测试的宇宙):

data("sample_input", package="LOLA") #加载userUniverse . data("sample_universe", package="LOLA"

现在我们有一个GRanges对象叫做userSets和GRanges对象userUniverse.这就是我们进行浓缩计算所需要的。

1.2运行分析

runLOLA ()将测试您的userset和regionDB中的每个region set之间的重叠。

locResults = runLOLA(userSets, userUniverse, regionDB, cores=1)

runLOLA测试regionDB中每个用户集和每个区域集之间的成对重叠。然后,它使用费雪精确测试来评估重叠的重要性。结果是data.table有几列:

colnames (locResults)头(locResults)
## b[1]“userSet”“dbSet”“collection”“pValueLog”“oddsRatio”##[6]“support”“rnkPV”“rnkOR”“rnkSup”“maxRnk”##[11]“meanRnk”“b”“c”“d”“description”## b[16]“cellType”“tissue”“antibody”“treatment”“dataSource”##[21]“filename”“qValue”“size”## userSet dbSet collection pValueLog oddsRatio support rnkPV rnkOR rnkSup ## 1: setB 2 ucsc_example 264.4863407 7.7578283 850 11 2 ## 2: setA 2 ucsc_example 254.6188080 8.6487312 632 11 2 ## 3:setB ucsc_example 34.6073689 - 3.3494078 5747 2 2 1 # # 4:刚毛4 ucsc_example 1.7169689 1.2377725 124 2 2 3 # # 5:刚毛5 ucsc_example 1.7169689 1.2377725 124 2 2 3 # # 6:刚毛3 ucsc_example 0.1877354 - 0.9135696 8 4 4 5 # # maxRnk meanRnk b c d描述cellType # # 1: 2 1.33 452 4981 20546 ucsc_example < NA > # # 2: 2 1.33 670 2510 23017 ucsc_example < NA > # # 3: 2 1.67 20018 84 980 CpG岛UCSC的注释< NA > # # 4: 3 2.33 761 3018 22926 ucsc_example < NA > # # 5:3 2.33 761 3018 22926 ucsc_example  ## 6: 5 4.33 66 3134 23621 ucsc_example  ##组织抗体治疗数据源文件名## 1:    laminB1Lads。床## 2:    laminB1Lads。bed ## 3:     cpgIslandExt.bed ## 4:     vistaEnhancers.bed ## 5:     vistaEnhancers_colNames.bed ## 6:     numtSAssembled.bed ## qValue size ## 1: 3.263317e-264 1302 ## 2: 1.202713e-254 1302 ## 3: 8.232086e-35 28691 ## 4: 3.837612e-02 1339 ## 5: 3.837612e-02 1340 ## 6: 1.000000e+00 78

如果你不熟悉怎么做data.table是用R写的,值得一读这个强大包的文档.列userSet而且dbSet是对应GRangeList对象的索引,用于标识每个成对比较。有一系列列描述统计检验的结果,例如pValueLoglogOdds,以及列联表(支持是重叠吗bc,d完成2x2表)。排序列只是对测试进行排序pValueLoglogOdds,或支持;属性之后的一系列列注释了数据库区域,具体取决于您如何填充指数表。

你可以在R中探索这些结果,例如,按不同的顺序排序:

locResults[秩序(支持,减少= TRUE),)
# # userSet dbSet收集pValueLog oddsRatio支持rnkPV rnkOR # # 1: setB ucsc_example 3.460737 e + 01 3.3494078 5747 2 2 # # 2:刚毛ucsc_example 2.818334 e-02 0.8704355 3002 5 5 # # 3: setB 2 ucsc_example 2.644863 e + 02 7.7578283 850 1 1 # # 4:刚毛2 ucsc_example 2.546188 e + 02 8.6487312 632 1 1 # # 5:刚毛4 ucsc_example 1.716969 e + 00 1.2377725 124 2 2 # # 6:刚毛5 ucsc_example 1.716969 e + 00 1.2377725 124 2 2 # # 7: setB 4 ucsc_example 0.000000 e + 00 0.3489379 80 4 3 # # 8:setB 5 ucsc_example 0.000000 e + 00 0.3489379 80 4 3 # # 9:刚毛3 ucsc_example 1.877354 e-01 0.9135696 8 4 4 # # 10: setB 3 ucsc_example 9.184826 e-06 0.2052377 4 3 5 # # rnkSup maxRnk meanRnk b c d描述# # 1:1 2 1.67 20018 84 980 CpG岛UCSC的注释# # 2:1 5 3.67 22763 140 924 CpG岛从UCSC的注释# # 3:2 2 1.33 452 4981 20546 ucsc_example # # 4: 2 2 1.33 670 2510 23017 ucsc_example # # 5: 3 3 2.33 761 3018 22926 ucsc_example # # 6:33 2.33 761 3018 22926 ucsc_example ## 7: 34 3.33 805 5751 20193 ucsc_example ## 9: 5 5 4.33 66 3134 23621 ucsc_example ## 10: 5 5 4.33 70 5827 20928 ucsc_example ## cellType组织抗体治疗数据源文件名## 1:     cpgIslandExt。床## 2:     cpgIslandExt。床## 3:     laminB1Lads。床## 4:     laminB1Lads。bed ## 5:      vistaEnhancers.bed ## 6:      vistaEnhancers_colNames.bed ## 7:      vistaEnhancers.bed ## 8:      vistaEnhancers_colNames.bed ## 9:      numtSAssembled.bed ## 10:      numtSAssembled.bed ## qValue size ## 1: 8.232086e-35 28691 ## 2: 1.000000e+00 28691 ## 3: 3.263317e-264 1302 ## 4: 1.202713e-254 1302 ## 5: 3.837612e-02 1339 ## 6: 3.837612e-02 1340 ## 7: 1.000000e+00 1339 ## 8: 1.000000e+00 1340 ## 9: 1.000000e+00 78 ## 10: 1.000000e+00 78

你可以按其中一列排序:

locResults[秩序(maxRnk,减少= TRUE),)
# # userSet dbSet收集pValueLog oddsRatio支持rnkPV rnkOR # # 1:刚毛3 ucsc_example 1.877354 e-01 0.9135696 8 4 4 # # 2:刚毛ucsc_example 2.818334 e-02 0.8704355 3002 5 5 # # 3: setB 3 ucsc_example 9.184826 e-06 0.2052377 4 3 5 # # 4: setB 4 ucsc_example 0.000000 e + 00 0.3489379 80 4 3 # # 5: setB 5 ucsc_example 0.000000 e + 00 0.3489379 80 4 3 # # 6:刚毛4 ucsc_example 1.716969 e + 00 1.2377725 124 2 2 # # 7:刚毛5 ucsc_example 1.716969 e + 00 1.2377725 124 2 2 # # 8:setB 2 ucsc_example 2.644863 e + 02 7.7578283 850 1 1 # # 9:刚毛2 ucsc_example 2.546188 e + 02 8.6487312 632 1 1 # # 10: setB 1 ucsc_example 3.460737 e + 01 3.3494078 5747 2 2 # # rnkSup maxRnk meanRnk b c d描述# # 1:5 5 4.33 66 3134 23621 ucsc_example # # 2: 1 5 3.67 22763 140 924 CpG岛从UCSC的注释# # 3:5 5 4.33 70 5827 20928 ucsc_example # # 4: 3 4 3.33 805 5751 20193 ucsc_example # # 5: 3 4 3.33 805 5751 20193 ucsc_example # # 6: 3 3 2.33 761 3018 22926 ucsc_example # # 7:33 2.33 761 3018 22926 ucsc_example ## 8: 22 1.33 452 4981 20546 ucsc_example ## 9: 22 1.33 670 2510 23017 ucsc_example ## 10: 1 2 1.67 20018 84 980 CpG岛从UCSC注释## cellType组织抗体治疗数据源文件名## 1:     numts。床## 2:     cpgIslandExt。bed ## 3:      numtSAssembled.bed ## 4:      vistaEnhancers.bed ## 5:      vistaEnhancers_colNames.bed ## 6:      vistaEnhancers.bed ## 7:      vistaEnhancers_colNames.bed ## 8:      laminB1Lads.bed ## 9:      laminB1Lads.bed ## 10:      cpgIslandExt.bed ## qValue size ## 1: 1.000000e+00 78 ## 2: 1.000000e+00 28691 ## 3: 1.000000e+00 78 ## 4: 1.000000e+00 1339 ## 5: 1.000000e+00 1340 ## 6: 3.837612e-02 1339 ## 7: 3.837612e-02 1340 ## 8: 3.263317e-264 1302 ## 9: 1.202713e-254 1302 ## 10: 8.232086e-35 28691

最后,将结果记录到文件中,如下所示:

  1. 写出结果:
writeCombinedEnrichment(locResults, outFolder= "lolaResults")

默认情况下,这个函数将把整个表写入atsv文件。我建议使用inclesplits参数,它告诉函数也打印出由userSet设置的附加表,这样您测试的每个区域集都有自己的结果表。它只是让探索结果更容易一些。

writeCombinedEnrichment(locResults, outFolder= "lolaResults", inclesplits =TRUE)

1.3探索LOLA结果

假设你想知道我们看到的铀浓缩是由哪些地区造成的;或者,换句话说,您希望提取实际上与特定数据库重叠的区域。为此,您可以使用函数extractEnrichmentOverlaps ()

oneResult = locResults[2,] extractEnrichmentOverlaps(oneResult, userSets, regionDB)
## seqnames ranges strand ##    ## [1] chr1 18229560 -19207602 * ## [2] chr1 35350878-35351854 * ## [3] chr1 38065507-38258622 * ## [5] chr1 38499473-39306315 * ## [5] chr1 42611485-42611691 * ## ... ... ... ...[628] chrX 136032577-138821238 * ## [630] chrX 139018365-148549454 * ## [631] chrX 154066672-154251301 * ## [632] chrY 2880166-7112793 * ## ------- # seqinfo:来自未知基因组的69个序列;没有seqlengths

1.4从数据库中提取特定的区域集

如果您有一个大型数据库,您可能有兴趣将LOLA数据库格式用于其他项目,或用于额外的后续分析。在本例中,您可能只对数据库中的一个区域集感兴趣,也可能只对其中的几个区域集感兴趣。LOLA提供了从已加载或未加载的数据库中提取特定区域集的函数。

假设您只想要一个具有“vistaEnhancers”区域集中区域的对象。你可以像这样从加载的数据库中获取它:

getRegionSet(regionDB, collections="ucsc_example", filename ="vistaEnhancers.bed")
##长度为1的GRangesList对象:##[[1]]##具有1339个范围和0个元数据列的GRanges对象:## seqnames ranges strand ##    ## 1 chr1 3190582-3191428 * ## 2 chr1 8130404 -8131887 * ## 3 chr1 10593124-10594209 * ## 4 chr1 10732071-10733118 * ## 5 chr1 10757665-10758631 * ## ... ... ... ...1335 chrX 139380917-139382199 * ## 1337 chrX 139674500-139675403 * ## 1338 chrX 147829017-147830159 * ## 1339 chrX 150407693-150409052 * ## ------- # seqinfo:来自未指定基因组的69个序列;没有seqlengths

或者,如果您还没有加载数据库,您可以只给出数据库的路径,LOLA将只加载您感兴趣的特定区域集。它可以包含多个文件名或集合:

getRegionSet(dbPath, collections="ucsc_example", filename ="vistaEnhancers.bed")
##长度为1的GRangesList对象:##[[1]]##具有1339个范围和0个元数据列的GRanges对象:## seqnames ranges strand ##    ## 1 chr1 3190582-3191428 * ## 2 chr1 8130404 -8131887 * ## 3 chr1 10593124-10594209 * ## 4 chr1 10732071-10733118 * ## 5 chr1 10757665-10758631 * ## ... ... ... ...1335 chrX 139380917-139382199 * ## 1337 chrX 139674500-139675403 * ## 1338 chrX 147829017-147830159 * ## 1339 chrX 150407693-150409052 * ## ------- # seqinfo:来自未指定基因组的23个序列;没有seqlengths

现在您已经对函数有了一个基本的概念,接下来可以学习一些其他的小插图,例如使用LOLA核心,以了解这是如何在现实数据集上工作的。