ShellyCoder / cellcall

inferring cell-cell communication from scRNA-seq of ligand-receptor
73 stars 20 forks source link

ViewInterCircos #5

Open sailseem opened 3 years ago

sailseem commented 3 years ago

Dear, I would like to ask one question,when I perform the circos plot, I got error like that

image

Thanks in advance for helping me out.

ShellyCoder commented 3 years ago

Hi sailseem,

The parameter omi decide the margin between figure region and plot region width. So can you show the output gridBase::gridOMI() in your device?

Sincerely Shelly

sailseem commented 3 years ago

Dear Shelly, Sure, here is the output

gridBase::gridOMI() [1] 0.0000 0.0000 -1.5339 -2.4583

ShellyCoder commented 3 years ago

Sorry to reply now. Have no idea if it will be helpful to you. The return value of gridBase::gridOMI() seems invalid. And you can close the plot device, and re-run funtion ViewInterCircos(). gridOMI value may be invalid when your plot device is dragged by mouse.

In the R package circlize, omi may be a static value for global layout. Considering this defect, we tend to replace it with ggplot2 object in next version. And if thers is any idea to fix it, much appreciation.

Shelly

wunnies commented 2 years ago

Hi. ~~I had this issue and solved it by resizing the right and bottom borders of Rstudio window until all numbers returned by gridBase::gridOMI() were positive numbers. Resizing the viewport panel did not work, I had to resize Rstudio itself. OS: MacOS monterey 12.0 on 2021 M1 macbook pro~~

Hmm the above seemed to only work once.

I ended up doing trace(ViewInterCircos, edit=TRUE) then changing the line: par(omi = gridOMI(), new = TRUE) to par(omi = c(0, 0, 0, 0), new = TRUE) and running ViewInterCircos with parameter gap.degree = 0

The legend overlaps the plot but it looks like that can be edited by exporting the image as .pdf and editing in inkscape (or maybe illustrator). Hope this helps anyone

ShellyCoder commented 1 year ago

Hi. ~I had this issue and solved it by resizing the right and bottom borders of Rstudio window until all numbers returned by gridBase::gridOMI() were positive numbers. Resizing the viewport panel did not work, I had to resize Rstudio itself. OS: MacOS monterey 12.0 on 2021 M1 macbook pro~

Hmm the above seemed to only work once.

I ended up doing trace(ViewInterCircos, edit=TRUE) then changing the line: par(omi = gridOMI(), new = TRUE) to par(omi = c(0, 0, 0, 0), new = TRUE) and running ViewInterCircos with parameter gap.degree = 0

The legend overlaps the plot but it looks like that can be edited by exporting the image as .pdf and editing in inkscape (or maybe illustrator). Hope this helps anyone

Thanks for your wonderful comments. I also had this issue today, since I have my first Macbook :-). I have a alternative but no that cool solutions. Set the weight:height in function Options() and save figure to file by pdf() & dev.off():

options(repr.plot.width = 12, repr.plot.height = 5)
pdf("./debug/control.pdf", width = 12, height = 5)

ViewInterCircos(object = CellCall_obj, ,,, )

dev.off()

I have done tests on Windows and Linux and there seems to be no such error. Here I really did the above solution for MacBook. Very sorry, in subsequent updates I will try using ggplot objects.

PS: My device in this test: MacBook Pro, M1, macOS Monterey

DavidH-hub commented 1 year ago

ViewInterCircos(object = mt, font = 2, cellColor = cell_color,

  • lrColor = NULL,
  • arr.type = "big.arrow",arr.length = 0.04,
  • trackhight1 = 0.05, slot="expr_l_r_log2_scale",
  • linkcolor.from.sender = TRUE,
  • linkcolor = NULL, gap.degree = 0.1,
  • order.vector=c('ST', "SSC", "SPGing", "SPGed"),
  • trackhight2 = 0.032, track.margin2 = c(0.01,0.12), DIY = TRUE) Error in par(omi = gridOMI(), new = TRUE) : The value set for the graphical parameter 'omi' is incorrect.

Followed:

options(repr.plot.width = 12, repr.plot.height = 5) pdf("E:/USTC/2023/2nd Quarter/20230308/control.pdf", width = 12, height = 5) ViewInterCircos(object = mt, font = 2, cellColor = cell_color,

  • lrColor = NULL,
  • arr.type = "big.arrow",arr.length = 0.04,
  • trackhight1 = 0.05, slot="expr_l_r_log2_scale",
  • linkcolor.from.sender = TRUE,
  • linkcolor = NULL, gap.degree = 0.1,
  • order.vector=c('ST', "SSC", "SPGing", "SPGed"),
  • trackhight2 = 0.032, track.margin2 = c(0.01,0.12), DIY = TRUE) Error in colSums(object) : "'x' must be an array of at least two dimensions".

How to solve this problem?