Closed FlavianR closed 1 year ago
Hi @FlavianR, If I run the vignette and create a plot, I can plot it just fine.
# Running TADCompare as-is
TD_Compare <- TADCompare(mtx1, mtx2, resolution = res)
# Running the plotting algorithm with pre-specified TADs
p <- DiffPlot(tad_diff = TD_Compare,
cont_mat1 = mtx1,
cont_mat2 = mtx2,
resolution = res,
start_coord = start_coord,
end_coord = end_coord,
show_types = TRUE,
point_size = 5,
max_height = 5,
rel_heights = c(1, 2),
palette = "RdYlBu")
plot(p)
To save it, we don't provide a specific code, but simple library(ggplot2); ggsave("demo.pdf")
saves the plot.
In general, we recommend https://hicexplorer.readthedocs.io/en/latest/content/tools/hicPlotTADs.html for plotting.
Please, let me know if you still have issues.
Hi! Sorry for the delay in responding! I try with your proposition but I still got the same issue. I think it's only a version problem when I try to use DiffPlot in script rather than in Rstudio (this 2 environments might defer). I will explore this and come back to you if I find a solution.
If you could provide a reproducible example, that'll be great.
I can provide you a portion of my script but I can't provide my data, but for testing I used the test.mcool from Cooltools documentation. My matrices were generated using cooler dump and used in input of my Rscript. My code :
#Utilities
library(TADCompare)
library(SpectralTAD)
library(dplyr)
library(data.table)
#Inputs
if (length(args)<12) {
stop("Need at least 5 inputs (-h/--help)", call.=FALSE)
}
input1 <- args[6]
input2 <- args[7]
res <- args[8]
chr <- args[9]
path_TAD_1 <- args[10]
path_TAD_2 <- args[11]
output <- args[12]
if (length(args)==14){
start <- args[13]
end <- args[14]
}
#PreProcess
print("Matrix 1")
mat1 <- fread(input1, data.table = FALSE)
print("Sparsing")
sparse_mat1 <- HiCcompare::cooler2sparse(mat1)
print("Spectral TAD")
Spec_1 <- SpectralTAD(sparse_mat1[[chr]], chr = chr, levels = 3)
print("Matrix 2")
mat2 <- fread(input2, data.table = FALSE)
print("Sparsing")
sparse_mat2 <- HiCcompare::cooler2sparse(mat2)
print("Spectral TAD")
Spec_2 <- SpectralTAD(sparse_mat2[[chr]], chr = chr, levels = 3)
list_TAD <- list(bind_rows(Spec_1), bind_rows(Spec_2))
# Process
print("TADCompare exe")
test <- TADCompare(sparse_mat1[[chr]],
sparse_mat2[[chr]],
resolution = as.numeric(res),
pre_tads = list_TAD)
print("Graphique generation")
pdf(paste0(output,chr,"_AD_",res,".pdf"))
DiffPlot(tad_diff = test,
cont_mat1 = sparse_mat1[[chr]],
cont_mat2 = sparse_mat2[[chr]],
resolution = as.numeric(res),
start_coord = as.numeric(start),
end_coord = as.numeric(end),
pre_tad = list_TAD,
show_types = TRUE,
point_size = 5,
palette = "RdYlBu",
rel_heights = c(1, 2))
dev.off()
With this code TADCompare worked correctly, only DiffPlot have an issue.
Hi! Thanks for this great tool, as always!! I have an issue on the DiffPlot, when I try to use it a warning rise and the plot isn't generated. I wanted to save the plot in a pdf file, and I used exactly the same command as in the documentation. In the file, i just have an empty page. The warning is : or (in terminal) :
When I call lifecycle::last_lifecycle_warnings(), I obtain :
NB : I used ggplot2 3.4.2