I'm editing an R code block that's supposed to produce a compounded circos-plot figure page. When the code reaches a particular line, it generates the error:
"Error in UseMethod("ggplot_build") : no applicable method for 'ggplot_build' applied to an object of class "NULL" Calls: ... update.reargraph -> ggplotGrob -> ggplot_gtable -> ggplot_build Execution halted"
These are the libraries:
library(ggplot2)
library(tidyverse)
library(dplyr)
library(trellis)
library(magrittr)
library(here)
library(grid)
library(gridExtra)
The code block that causes the error is:
## Look for split read joining chr19 and chr22
lb <- linkedBins(r.161t)
is_19.22 <- as.character(seqnames(lb)) == "chr19" &
as.character(seqnames(linkedTo(lb))) == "chr22"
r.161t2 <- r.161t[ is_19.22 ]
r.161t3 <- r.161t2[1] %>%
fiveTo3List() %>%
## manual inspection
"[["(1) %>%
rearDataFrame(build="hg18")
r161.grob <- ggRearrange(r.161t3)
r161.grob <- update.reargraph(r161.grob) ### This line is generating an error
r.172t <- rlist2[["CGOV172T"]]
lb <- linkedBins(r.172t)
is_10.10 <- as.character(seqnames(lb)) == "chr10" &
as.character(seqnames(linkedTo(lb))) == "chr10"
r.172t2 <- r.172t[ is_10.10 ]
r.172t3 <- r.172t2[3] %>%
fiveTo3List() %>%
## manual inspection
"[["(1) %>%
rearDataFrame(build="hg18")
r172.grob <- ggRearrange(r.172t3)
r172.grob <- update.reargraph(r172.grob) ### This line is generating an error
I've pointed out the 2 lines where the code fails, both have to do with the update.reargraph() method. The individual figures generate, but not the composite.
I'm not entirely familiar with ggplot2 so any help would be greatly appreciated.