用GRanges找到染色体的重叠区域

问题描述 投票:2回答:1

我列出了一系列来自一系列患者的基因组区域。

> head(dotoo)
GRanges with 6 ranges and 3 metadata columns:
    seqnames                 ranges strand |       Id       CN Histology
       <Rle>              <IRanges>  <Rle> | <factor> <factor>  <factor>
[1]        3 [167946693, 168005541]      * |        9        3        MD
[2]        3 [189907623, 189954633]      * |        9        3        MD
[3]        6 [132274121, 132384438]      * |        9        3        MD
[4]       11 [ 67685096,  70138399]      * |        9        4        MD
[5]       12 [ 53859037,  53927595]      * |        9        3        MD
[6]       15 [ 19830049,  20089383]      * |        9        1        MD

当我使用时绘制基因组畸变

autoplot(dotoo, aes(fill=as.factor(Id), color=as.factor(Id)))

我看到很多重叠区域,见图像

如何找出至少3名患者之间哪些区域重叠,并共享CN

基本上,如果您查看图片,我如何找到“堆叠”的区域,并且只找到共享的部分?有办法吗?

r bioinformatics overlap bioconductor genetics
1个回答
3
投票

获取“不相交”区域的列表(也许这不是你想要的?其他选项是reduce,只有原始的dotoo对象没有这个步骤)

d = disjoint(dotoo)

找到原始区域和每个不相交区域之间的重叠

olap = findOverlaps(query=dotoo, subject=d)

基于主题和CN将索引分成重叠

splt = split(seq_along(olap), list(subjectHits(olap), dotoo$CN[queryHits(olap)]))

将这些过滤到满足您条件的那些

filt = Filter(function(x) length(x) >= 3, splt)

filt现在是olap的索引列表。您可以使用重叠元素创建GRangesList

idx = unlist(filt)
grp = rep(seq_along(filt), sapply(filt, length))
splitAsList(dotoo[queryHits(olap)[idx]], grp)

在Bioconductor Bioconductor上询问有关mailing list包装的问题(无需订阅)。

© www.soinside.com 2019 - 2024. All rights reserved.