考虑切片一个较大的data.frame
:
dput(head(alele_freq_dev))
structure(list(chr = c("1A", "1A", "1A", "1A", "1A", "1A"), locus =
c(1145442L, 1158042L, 1158055L, 1229616L, 1236254L, 1238114L), Trial =
structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("ES1-5", "ES6-13", "ES14-
26", "ES27-38", "SA1-13", "SA14-25"), class = "factor"), MAF =
c(0.0780052257586973, 0.201305225758697,
-0.101594774241303,-0.105094774241303, 0.0710052257586973,
-0.101594774241303)), row.names = c(NA, 6L), class = "data.frame")
df看起来像这样:
chr locus Trial MAF
1A 1145442 ES1-5 0.07800523
1A 1158042 ES1-5 0.20130523
1A 1158055 ES1-5 -0.10159477
1A 1229616 ES1-5 -0.10509477
1A 1236254 ES1-5 0.07100523
1A 1238114 ES1-5 -0.10159477
以及以下晶格图代码:
xyplot(MAF ~ locus | chr, data = alele_freq_dev,
layout = c(1, 3),
as.table=T,
main='MAF per Chromosome',
grid=T,
group = Trial,
type = c('p'),
cex = 0.1,
par.settings = Mytheme,
auto.key = list(title='Trial',space='top',columns=4,lines=F,points=T))
我想在x轴(轨迹)的某个范围内突出显示此图片上的区域,可以使用任何形式的突出显示,例如阴影区域。范围取决于chr(染色体)。以下数据框概述了如何分配范围:
structure(list(chr = c("1A", "1B", "1D", "2A", "2B", "2D"), initial =
c(210200000L, 237700000L, 166200000L, 326300000L, 344400000L, 264400000L),
end = c(215800000L, 243500000L, 173800000L, 327000000L, 351300000L,
272500000L)), row.names = c(NA, 6L), class = "data.frame")
数据框如下所示:
chr initial end
1A 210200000 215800000
1B 237700000 243500000
1D 166200000 173800000
2A 326300000 327000000
2B 344400000 351300000
2D 264400000 272500000