Shians / NanoMethViz

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

clarification of methy_to_bsseq() function #19

Open paulinor-42 opened 2 years ago

paulinor-42 commented 2 years ago

Hello, I really appreciate this tool and it is very helpful and user friendly.

I have a question regarding the methy_to_bsseq() function. Does this function use something similar to the Nanopolish cut off of > 2 log_lik_ratio for saying a read is methylated or <-2 for non-methylated reads.

I see in the tabix files a there is log-likelihood of methylation statistic. So would the function only assign a read as methylated or non-methylated in the bsseq object if the associated stat reaches a threshold?

Thank You, Paulino

Shians commented 2 years ago

Thanks for the feedback! At the moment there is no functionality in methy_to_bsseq() to do filtering. I might put that in for the next version. I think you can get a similar result by using the new filter_methy() function before using methy_to_bsseq(). It would look like

nmr <- load_example_nanomethresult()

# create a temporary methylation file with filtered results, can set a permanent path if you want to keep this
output_file <- paste0(tempfile(), ".tsv.bgz")
filter_methy(nmr, output_file = output_file, statistic < -2 | statistic > 2)

# replace the methylation file in the NanoMethResult with the filtered file and convert
methy(nmr) <- output_file
bsseq <- methy_to_bsseq(nmr)
paulinor-42 commented 2 years ago

Thank you for the clarification!