人間のhg19のkaryogram/ideogramを作成したいと思います。 p値を点プロットとして表示します。Grangesトラックでkaryogramを注釈する
CHROM POS fisher_het
1: 10 134775 0.299587633
2: 10 135237 1.000000000
3: 10 135277 0.483198279
4: 10 135331 0.224587437
5: 10 135334 0.068035761
6: 10 135656 0.468998144
7: 10 135708 0.746611845
8: 10 135801 0.242257762
9: 10 135853 0.0
10: 10 137186 0.774670848
これまでのところ、私はp値をデフォルトのggplotプロットにプロットすることができます。
ggplot(data = my.data.frame,],
aes(POS, -1 * log(fisher_het))
) +
geom_point(alpha = 0.5, size = 0.8) +
facet_wrap(~ CHROM) +
labs(x = "Position on chromosome", y = "-log(raw p-Value)") +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
geom_hline(yintercept = 8, size = 0.3)
今では、これらのp値は、各染色体のkaryogramの上で別々のトラックとしてkaryogram /表意文字の上にプロット持っていいだろう。この目的を達成するために
私は、大部分のアレクサンダースケート(https://www.biostars.org/p/152969/)の質問を行いました。
library("ggbio")
library("GenomicRanges")
# load banding data
data(hg19IdeogramCyto, package = "biovizBase")
hg19 <- keepSeqlevels(hg19IdeogramCyto, paste0("chr", c(1:22, "X", "Y")))
# create a test GRanges object
# from the test data given above
test.granges <- GRanges(seqnames = paste0("chr", df.test.data$CHROM),
ranges=IRanges(start = df.test.data$POS,
end = df.test.data$POS),
strand = "*",
fisher_het = df.test.data$fisher_het)
# attach chromosome lengths
data(hg19Ideogram, package = "biovizBase")
seqlengths(test.granges) <- seqlengths(hg19Ideogram)[names(seqlengths(test.granges))]
# plotting trials
# this works - a set of chromosomes with banding
ggplot(hg19) + layout_karyogram(cytoband = TRUE)
# now i want to add my p-values following the pattern of Alexander Skates
# + layout_karyogram(avs.granges, geom = "rect", ylim = c(11, 21), color = "red")
# using geom = "point"
ggplot(hg19) +
layout_karyogram(cytoband = TRUE) +
layout_karyogram(data = test.granges,
geom = "point",
aes(x=???, y=fisher_het)
)
私はGRangesオブジェクトまたはggplot/ggbioで受け入れられる他のオブジェクトに有効なx座標とy座標を指定できません。
# also tried to no avail
ggplot(hg19) +
layout_karyogram(cytoband = TRUE) +
plotRangesLinkedToData(data = test.granges)