Shians / NanoMethViz

https://shians.github.io/NanoMethViz/
Apache License 2.0
24 stars 1 forks source link

Main spaghetti lines missing in my plot #27

Closed YingziZhang-github closed 1 year ago

YingziZhang-github commented 1 year ago

Hi Shian,

When I used plot_region(nmeth_results, "chr*", $1, $2, spaghetti = TRUE), the output figure was missing the main spaghetti line of each group, as this: 20051681977453_ pic

It was different than the example spaghetti figure: peg3_spaghetti

Would you suggest if I made anything wrong? Or did I miss to set any options?

Thank you! Looking forward to your reply!

Yingzi

Shians commented 1 year ago

Are there any warnings or errors that pop up? What does it look like if you set spaghetti = FALSE?

YingziZhang-github commented 1 year ago

Yes, there are warnings as the following:

Warning messages:
1: Computation failed in `stat_lowess()`
Caused by error in `as.data.frame.default()`:
! cannot coerce class ‘"lowess"’ to a data.frame
2: Removed 3 rows containing missing values (`geom_segment()`).
3: Removed 3 rows containing missing values (`geom_segment()`).

When I set spaghetti = FALSE, the warnings are as the same. The output figure turned out empty: Rplot01

Shians commented 1 year ago

That is very surprising, I really don't have any idea why it would happen. Does this happen for any other regions you try to plot?

YingziZhang-github commented 1 year ago

Hi Shian,

I tried three regions in different chromosomes. It happened the same way.

The warning message is

Computation failed in `stat_lowess()`
Caused by error in `as.data.frame.default()`:
! cannot coerce class '"lowess"' to a data.frame

The other NanoMethViz functions all run very well with my data, only the spaghetti plots behave weirdly as mentioned above. I may try to find other alternatives to make the line plot. Many thanks for the help.

Yingzi

Shians commented 1 year ago

If possible I would appreciate example data to reproduce this bug. If you could use query_methy() to extract an unimportant region where this bug occurs I could use that data to try and debug this issue.

YingziZhang-github commented 1 year ago

example data to reproduce this bug

Hi Shian,

Thank you very much. I sent the example data to the email box su.s@wehi.edu.au.

Best, Yingzi

Shians commented 1 year ago

I'm unable to reproduce the bug, but maybe I am using different settings to you. I suggest using the heatmap = TRUE argument which might provide further insight into what's going on.

nmr <- NanoMethResult(
    methy = "experimental/smooth_bug.tsv.bgz",
    samples = samples
)

plot_region(nmr, "chr15", 24952550, 24953450, heatmap = TRUE, spaghetti = TRUE)

smooth_bug