This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Identification of CpG islands

Hello everyone, thanks for letting me post in here, this is my first time.

I am new in the field of methylation, and I was wondering how to know, just with the CpG code (e.g. cg23786580), to what gene does it belong or is close. I just have that information, not even the chromosome. I have a long list of those codes and I would like to get that information not manually, if possible.

I would be glad if someone could help me.

Thank you very much in advance!

cpg islands cpg methylation

What is CpG code ? There are no regulated CpG codes as far as my knowledge. Where from you got this code (SOURCE) ?

I meant the annotation. It's from IlluminaHumanMethylation450k, but I could not access to the rest of the information. Thanks!

1 answer

The below solution is using R and the IlluminaHumanMethylation450kanno.ilmn12.hg19 package from bioconductor (quite a mouthful). Also a little bit of dplyr. For these sorts of exercises, R is useful, and worth getting your teeth into if you're unfamiliar with it.

source("https://bioconductor.org/biocLite.R")
biocLite("IlluminaHumanMethylation450kanno.ilmn12.hg19")

library(dplyr)
library(readr)
library(IlluminaHumanMethylation450kanno.ilmn12.hg19)
data("IlluminaHumanMethylation450kanno.ilmn12.hg19")

#Manually Enter CpGs
query_cpgs <- c("cg23786580")

#Read in CpGs from File
#Extract the "CpGs" Column
query_cpgs <- read_csv("my_cpgs.csv") %>% 
              as.data.frame %>% 
              .[["CpGs"]]

anno       <- IlluminaHumanMethylation450kanno.ilmn12.hg19 %>% 
              getAnnotation %>% 
              as.data.frame %>% 
              dplyr::slice(match(query_cpgs, Name))

https://github.com/AndrewSkelton/Biostars-Answers/blob/master/p236827.R

Great, thank you so much!! It works! :)

Just one additional comment: I need to check like 500 CpG annotations. How should I add all of them without writing ("xxx", "xxx", "xxx")?

I've updated my answer. If you have the CpGs in a spreadsheet, then save it as csv or tab delimited, and read that into R.

Thank you very much! It completely works for me.

Log in to answer this question.