Question regarding plotting methylation percentages along anotated region

84 views
Skip to first unread message

Sofia Alves

unread,
Oct 6, 2024, 4:07:08 PM10/6/24
to methylkit_discussion

Hello, 

I was able to anotate my differentiatly methylated regions, but I am looking how to plot or extract the methylation percentages along the regions. I have read in a few papers that the regions should be segmented in 10 bins of equal size, and the average methylation percentages for each bin and region are the values to be plot. 

What I am looking for is something like Figure 1-e of https://www.nature.com/articles/s42003-020-1059-1/figures/1

If I do:
>meth.tiles1250CpG=methylKit::unite(tiles1250CpG, destrand=TRUE)
>CpGupdstream2=regionCounts(meth.tiles1250CpG,myinterest.bed$"2kb_upstream")

 I get the overall coverage and Cs for each region that can help me calculate the methylation percentage overall. 
> CpGupdstream2 methylBase object with 25279 rows -------------- chr start end strand coverage1 numCs1 numTs1 coverage2 numCs2 numTs2 coverage3 1 chr1_hap2 42919 44919 + 168 141 27 3749 2948 801 4060 2 chr1_hap2 51905 53905 + 31 27 4 35 29 6 216 3 chr1_hap2 76867 78867 + 214 71 143 157 18 139 405 4 chr1_hap2 92217 94217 - 444 361 83 641 458 183 574 5 chr1_hap2 103436 105436 - 32 27 5 10 10 0 165 6 chr1_hap2 105591 107591 - 106 90 16 70 70 0 544 numCs3 numTs3 coverage4 numCs4 numTs4 coverage5 numCs5 numTs5 coverage6 numCs6 numTs6 1 3614 446 6462 5891 571 4391 3966 425 10103 9179 924 2 185 31 241 209 32 187 160 27 253 223 30 3 30 375 943 431 512 561 248 313 465 249 216 4 494 80 1128 594 534 858 520 338 1547 1060 487 5 152 13 431 395 36 277 252 25 277 260 17 6 504 40 1387 1245 142 924 838 86 1298 1218 80 -------------- sample.ids: MM1Jan MM2Jan MM3Jan MM1Apr MM2Apr MM3Apr destranded TRUE assembly: Hap2 context: CpG treament: 1 1 1 0 0 0 resolution: region


Is there a way to segment each region or do I need to make a new bed file with each region segmented in 10 bins? What is the most efficient way to achieve the data to make those plots?

Any help is appreciated, thank you in advance.

Sofia 

alex....@gmail.com

unread,
Oct 11, 2024, 4:49:39 PM10/11/24
to methylkit_discussion
Hi Sofia, 

There are certainly mulitple ways to generate those metagene plots. 

If you started your analysis with Bismark, then you could use this python package which includes many example figures that look similar to what you want:
- code: https://github.com/shitohana/BSXplorer 
- docs: https://shitohana.github.io/BSXplorer/

Another way would be to export your methylRaw/methylRawList to bedgraph files (methylKit::bedgraph() function), convert them to bigwig and use the versatile deeptools suite.
https://deeptools.readthedocs.io/en/develop/content/tools/plotProfile.html
- https://deeptools.readthedocs.io/en/develop/content/example_gallery.html

These blogpost outline how to extend the deeptools results with ggplot:

Sofia Alves

unread,
Oct 11, 2024, 6:27:03 PM10/11/24
to methylkit_...@googlegroups.com
Hello Alex, 

thank you very much, that's what I was looking for. This will be a huge help.

Best regards,
Sofia

--
You received this message because you are subscribed to the Google Groups "methylkit_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to methylkit_discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/methylkit_discussion/6cc43ebf-683c-4ef0-9eb0-e74b6ac888c8n%40googlegroups.com.


--
Sofia Alves

Altuna Akalin

unread,
Oct 12, 2024, 2:11:37 AM10/12/24
to methylkit_...@googlegroups.com
You can try genomation package 


--
You received this message because you are subscribed to the Google Groups "methylkit_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to methylkit_discus...@googlegroups.com.

Sofia Alves

unread,
Oct 21, 2024, 8:08:57 PM10/21/24
to methylkit_discussion
Hello, 
I successfully used the genomation package but, when ploting I wanted to use the percentage values and not the score values. I plotted through the ScoreMatrixBin() is there any way to convert the values or to generate a matrix using genomation and the bw files to have the percentage instead of scores.


Best regards

alex....@gmail.com

unread,
Nov 26, 2024, 7:54:48 AM11/26/24
to methylkit_discussion
Hi Sofia, 

Depending on your input, the scores might actually correspond to the percentage values (range 0-100). Maybe you just need to change the plot labels? 

Best,
Alex

Sofia Alves

unread,
Jan 11, 2025, 8:17:34 AMJan 11
to methylkit_...@googlegroups.com
Hi Alex, 
Thanks for replying. I was using the percentages extracted by methylkit which range from 0-100%, not the coverage + number of Cs and Ts,  but was getting values of 0.002  so ranging between 0-0.5 with CHH methylation having higher values than CpG. So I used the is.noCovNA=TRUE and I think I solved the problem, because my values now do go between 0-100%.

Best regards


Reply all
Reply to author
Forward
0 new messages