Entering edit mode
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")
thanks @James, what would be best way to convert mval into matrix? I am just using this
That or
as.matrix
. Your call.thanks James, all sorted now I got DMRcate out file, could you please help how to use CHiPpeakAnno or CHiPseeker for further analysis?
Both of those packages have extensive vignettes that you can consult.