# #Description: # Write table with list of CpG positions on hg19, chr7 # #To download: #source("https://bioconductor.org/biocLite.R") #biocLite("BSgenome.Hsapiens.UCSC.hg19") library(BSgenome.Hsapiens.UCSC.hg19) #Get autosome names chrs <- names(Hsapiens)[1:24] #Find CpGs cgs <- lapply(chrs, function(x) start(matchPattern("CG", Hsapiens[[x]]))) #Write data frame just for chr7 chr7_cgs <- data.frame(chrom = rep("chr7", length(cgs[[7]])), position = cgs[[7]]) #Write table write.table(chr7_cgs, file="hg19_chr7_CGpositions.txt", sep="\t", row.names=FALSE, quote=FALSE)