Differentially methylated genes

196 views
Skip to first unread message

Lei Jiang

unread,
Jul 3, 2023, 12:04:02 AM7/3/23
to methylkit_discussion
Hi, Altuna,
I have used  methylkit and genomation for DMR analysis and it works very well. I have a question, to identify DMR, I used tileMethylcounts function with specified windowsize and stepsize to define the regions. Then I used the annotateWithGeneParts and getAssociationWithTSS to get their genomic feature to see where the DMR overlaps with specific genes. I am wondering whether it is possible to directly compare the methylation difference on a per-gene basis without defining the window of regions but using the gene length as the window? Is it possible to do that using methylkit and genomation?
Thanks in advance!
Lei

David Fisher

unread,
Jul 12, 2023, 9:47:03 AM7/12/23
to methylkit_discussion
Hi Lei,

Yes this is possible. If you have your genes as a GRanges object (this is how I did it, you might have another approach):

ann_granges = read_gff3("../../path/annotation.gff3")

genes_granges = ann_granges %>% filter(type == "gene") #using dplyr functions

you can then use the "regionCounts" function to summarise the methylated and unmethylated Cs for each gene:

#Assume "db" is you methyl database object

counts_gene = regionCounts(db, genes_granges)

You can then use the functions like normal:

lapply(counts_gene, getMethylationStats,  plot=F)
lapply(counts_gene, getCoverageStats,  plot=F)

counts_gene_f = filterByCoverage(counts_gene, hi.count = 100000)  #need to check the plots/info to work out what this should be
counts_gene_fu = methylKit::unite(counts_gene_f, destrand=FALSE, min.per.group = 3L, suffix = "genes_fu3") #some of these options are specifc to what I was doing.
... etc


Hope that helps.

David

Lei Jiang

unread,
Jul 23, 2023, 8:58:58 PM7/23/23
to methylkit_discussion
Hi, David,
Thanks so much for the hint! Using read.gff and dplyr will generate a transcript/gene table but not the grange file that can be processed in the following regioncounts analysis. However, I found the following code that would work to generate a grange from gff or gtf file:   makeGRangesFromGFF( file, level = c("genes", "transcripts"), ignoreTxVersion = TRUE, .checkAgainstTxDb = FALSE ) or makeGRangesFromGTF( file, level = c("genes", "transcripts"), ignoreTxVersion = TRUE, .checkAgainstTxDb = FALSE )
Best,
Lei

Lei Jiang

unread,
Jul 28, 2023, 9:53:31 PM7/28/23
to methylkit_discussion
Hi everyone!
granges object of gene bodies can also be prepared from the gff file using the gffToGRanges function in the genomation package (Akalin et al. 2014)

Georges Kanaan

unread,
Sep 26, 2023, 3:32:21 PM9/26/23
to methylkit_discussion
Hi Lei,

I was wondering if you could share the code that ended up working for you when using gffToGRanges?

Reply all
Reply to author
Forward
0 new messages