DMRcate: How to get Cpgids present in the DMR
2
1
Entering edit mode
5.1 years ago
bassanio ▴ 60

Hi,

The below is my Dmrcate run and I do get the DMRS. but how to get the CPGids that are part of these DMRS

corfit <- duplicateCorrelation(myMs, design=designMatrix, block = biolrep)
dmrCate.<-cpg.annotate("array", myMs, what="M", arraytype = "EPIC", analysis.type="differential", design=designMatrix, coef=2, block=biolrep, correlation=corfit$consensus.correlation,fdr=0.01)
dmrcoutput_all <- dmrcate(dmrCate,lambda=500, C=5, pcutoff="fdr",min.cpgs=1,mc.cores=1)
wgbs.ranges_all.snp7 <- extractRanges(dmrcoutput_all, genome = "hg19")
write.csv (wgbs.ranges_all.snp7,file="DMRCate_DifferentailRange.txt")
write.csv(dmrcoutput_all.snp7$results,file="DMRCate_ALL.txt")

how to get the 17 Cpgids from the result shown below

"","seqnames","start","end","width","strand","no.cpgs","minfdr","Stouffer","maxbetafc","meanbetafc","overlapping.promoters"
"1","chr6",31539539,31540750,1212,"*",17,2.06654851019045e-120,2.16758469969414e-149,-0.162022961391297,-0.106211449278892,"LTA-001, LTA-002, LTA-004, LTA-003"

I tried with gRanges but unable to understand how to perform it

P.S: I have posted the same in Bioconductor Forum. sorry for redundancy. Any help soon is appriciated

Methylation DMRCate Epicarray CPGids • 2.2k views
ADD COMMENT
1
Entering edit mode
5.1 years ago
bassanio ▴ 60
gr <- granges(OBJECT)
locs.ranges<-names(gr[seqnames(gr) == "chr6" & start(gr)>=31539539 & end(gr) <=31540750 ])

The above two lines I was able to subset the ids belonging to 1 location of interest. How can I loop this multiple locations present in a dataframe?

ADD COMMENT
1
Entering edit mode
5.1 years ago
bassanio ▴ 60

There would be multiple ways(more efficient way ) to what do than the below script which I have used solve my own problem.

But It would be great to know If there is any efficient way to do the same.

OBJECT <- is the last object from which beta/mvalue for DMRCate is give as input

gr <- granges(OBJECT)

    mydata<-read.csv(file="DMRCate_Output.csv",header=TRUE,stringsAsFactors = FALSE)
    for(n in 1:nrow(mydata))
    {
      chr<-mydata2[n,2]
      start=mydata2[n,3]
      end=mydata2[n,4]
      infos<-names(gr[seqnames(gr) == chr & start(gr)>=start & end(gr) <=end ])
      allcpg<-toString(infos)
      mydata$cpgids<-allcpg
    }

    write.table(mydata,file="DMRCate_Model3_DifferentailRange_V3V4_withCpgids",sep="\t");

P.S: Here the output from DMRcate is written to a file

ADD COMMENT

Login before adding your answer.

Traffic: 2490 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6