Closed chualec closed 1 year ago
Hi there! This error is occurring due to the plot type specified in your annoGenomeLabel
call. Y-axis genome labels only work for plots that have a genomic axis along the y-axis, which is currently only possible with plotHicSquare
. Even though you've specified altchrom
in the params
object, plotGenes
does not parse this because it can only handle chrom
. Thus, when you call a y-axis annoGenomeLabel
with the genes plot object, it cannot find an altchrom
to parse and assumes the chromosome is NULL
, throwing that error. However, if you passed your square Hi-C plot into this call, it would be able to find that altchrom
and create the genome label.
Best, Nicole
Hi Nicole,
Thanks! using "annoGenomeLabel(plot = hicPlot_top, params = params_a, scale = "Mb", fontsize = 7, y = 3.85, axis="y")" successfully solve the problem.
Thanks!
Hi, I've been trying to use the plot genome y axis function, but it doesn't really work for me It gives me this error: argument "chrom" is missing, with no default
Please let me know if there is something wrong with how i am interpreting the code. Thanks.
This is the code i used:
gene_A.chrom <- "chr3" gene_A.start <- 127686231 gene_A.end <- 127792951 gene_B.chrom <- "chr3" gene_B.start <- 127686231 gene_B.end <- 127792951
pageCreate(width = 10, height = 5, default.units = "inches") test <- expand.grid(chr8=round(seq(gene_A.start, gene_A.end, 10000), -4), chr3=round(seq(gene_B.start, gene_B.end, 10000), -4)) test <- test %>% relocate(chr3) test$counts <- rnorm(nrow(test), mean=100, sd=50)
params_a <- pgParams(chrom=gene_A.chrom, chromstart = gene_A.start, chromend = gene_A.end, altchrom = gene_B.chrom, altchromstart = gene_B.start, altchromend = gene_B.end, resolution = 10000, assembly = "hg38", x = 3.25, width = 2.75, just = c("left", "top"), default.units = "inches")
hicPlot_top <- plotHicSquare(data = test, params = params_a, zrange = c(0, 1), resolution = 10000, half = "top", y = 0.5, height = 2.75, draw=T) hicPlot_bottom <- plotHicSquare(data = test, params = params_a, zrange = c(0, 1), resolution = 10000, half = "bottom", y = 0.5, height = 2.75, draw=T)
genes_a <- plotGenes(params = params_a, stroke = 1, fontsize = 6, y = 3.35, height = 0.4)
annoGenomeLabel(plot = genes_a, params = params_a, scale = "Mb", fontsize = 7, y = 3.85)
annoGenomeLabel(plot = genes_a, params = params_a, scale = "Mb", fontsize = 7, y = 3.85, axis="y")
pageGuideHide()