Collapsed to unique genes
0
0
Entering edit mode
18 months ago
Leite ★ 1.1k

Hello everyone,

I've a problem with gene expression analysis. I found a similar post that I used as a guide, but could not solve my problem.

First I downloaded the normalized file directly from GEO. Then, I download the annotation file containing the probe name for gene name and use the merged function to join the two files.

My objective is Collapsed to unique genes using avereps function and then do the analysis of DEGs.

This is the code I am using. However when I try to use the lmFit function I have this error:

> #Apply the intensity values to lmFit
> fit <- lmFit(fil_eset_NA3, design)

> Error in rowMeans(y$exprs, na.rm = TRUE) : 'x' must be numeric

# Read normalized data
eset <- read.delim("Data_Processed.txt", header=T, comment = "!")

# Read annotations_probes to genes
Annotations <- read.delim("Annotations.txt", header=TRUE)

# Merge two data frames by ID
eset2 <- merge(Annotations, eset,by="ID_REF")

# Remove NA
no_symbol<-is.na(eset2$gennames)
no_entr<-is.na(eset2$biotype_gene)
fil_eset_NA<-eset2[!no_symbol&!no_entr,]

**# collapsing transcript expression to gene-level expression**
fil_eset_NA2 <-avereps(fil_eset_NA,ID=fil_eset_NA$gennames)


# Assign labels in column 2 to "rnames"
rnames <- fil_eset_NA2[,2]

# Transform colums into a matrix
fil_eset_NA3 <- data.matrix(fil_eset_NA2[,4:ncol(fil_eset_NA2)])

# assign row names
rownames(fil_eset_NA3) <- rnames
fil_eset_NA3

# Read Targets
targets <- read.delim("Target.txt", header=TRUE)

#See if the data is normalized
boxplot(fil_eset_NA3)

#Design matrix for the linear modelling function
f <- factor(targets$Target, levels = unique(targets$Target))
design <- model.matrix(~0 + f)
colnames(design) <- levels(f)



#Apply the intensity values to lmFit
fit <- lmFit(fil_eset_NA3, design)
write.table(fit, file="fit.txt", sep="\t", quote=FALSE)

#Create a contrast matrix
contrast.matrix <- makeContrasts("Disease-Control", levels=design)

#Apply this contrast matrix to the modeled data and compute statistics for the data
fit2 <- contrasts.fit(fit, contrast.matrix)
fit2 <- eBayes(fit2)

#Output the statistics for the dataset and write them to disk
output <- topTreat(fit2, coef=1, number=Inf, adjust.method="BH", lfc=1)
write.table(output, file="Sepsis-Control_MARS_LFC_1.txt", sep="\t", quote=FALSE)
r gene • 529 views
ADD COMMENT
0
Entering edit mode

Is your original eset an ExpressionSet?

ADD REPLY
0
Entering edit mode

Hey russhh,

Yes it's an ExpressionSet.

Maybe I found the answer:

class(fil_eset_NA3) <- "numeric"

is.numeric(fil_eset_NA3)

TRUE
ADD REPLY

Login before adding your answer.

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