error while running DMRcate
1
0
Entering edit mode
Jitendra ▴ 10
@nabiyogesh-11718
Last seen 5 months ago
United Kingdom

Hi all,

I am getting an error while running DMRcate code below;

 Error in rmSNPandCH(mval, dist = 2, mafcut = 0.05) : 
      is.matrix(object) is not TRUE
    Calls: rmSNPandCH -> stopifnot
    Execution halted

DMRcate code

library("data.table")
#phenotype file
targets<-read.table("Limma.phenotypes.txt", header=TRUE, stringsAsFactor=FALSE,row.names=NULL, sep="\t")
head(targets)

#convert eGFR into  log 2

targets$logeGFR=log2(targets$eGFR)

#set first column header as blanck

names(targets)[1] <- ""

# first column as row names
targets2<-targets[,-1]
rownames(targets2)<-targets[,1]

head(targets2)
dim(targets2)

#read mehtylation data

###################



#Start by inputting your original beta value file, skipping any of the first few columns we don't need for this analysis (easily done in preview import)

betaval <- read_csv("betas_1.csv", col_types = cols(Chromosome = col_skip(), Start = col_skip(), End = col_skip(), Strand = col_skip()))




head(betaval, 10) [,1:5]

#set first column header as blank
names(betaval)[1] <- ""

#convert into dataframe
betaval <- data.frame(betaval)
# first column as row names

betaval2<-betaval[,-1]
rownames(betaval2)<-betaval[,1]

#convert beta value into m value
mval<-log2(betaval2/(1-betaval2))


dim(mval)

head(mval, 10) [,1:5]



library(DMRcate)


myMs.noSNPs <- rmSNPandCH(mval, dist=2, mafcut=0.05)

design <- model.matrix(~logeGFR + as.factor(Gender) + Age +CD8T +CD4T +NK + Bcell +Mono ,data=targets2)

myannotation <- cpg.annotate(myMs.noSNPs, analysis.type="differential",design=design, coef=2, contrats=FALSE)
dmrcoutput <- dmrcate(myannotation, lambda=1000, C=2)
results.ranges <- extractRanges(dmrcoutput, genome = "hg19")
stattistics epicarray Epigenetics DMRcate • 918 views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 10 hours ago
United States

Yes, and the error seems self-explanatory?

Error in rmSNPandCH(mval, dist = 2, mafcut = 0.05) : 
      is.matrix(object) is not TRUE

Reading the help page will tell you that object is the first argument.

ADD COMMENT
0
Entering edit mode

thanks @James, what would be best way to convert mval into matrix? I am just using this

# Converting into numeric matrix 
mval <- data.matrix(mval)
ADD REPLY
0
Entering edit mode

That or as.matrix. Your call.

ADD REPLY
0
Entering edit mode

thanks James, all sorted now I got DMRcate out file, could you please help how to use CHiPpeakAnno or CHiPseeker for further analysis?

ADD REPLY
0
Entering edit mode

Both of those packages have extensive vignettes that you can consult.

ADD REPLY

Login before adding your answer.

Traffic: 940 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