Entering edit mode
7 months ago
prithvi.mastermind
▴
50
While doing averaging for gene expression values, I'm getting NA values in the expression matrix. How to solve the error.
Load packages
library(affy)
library(limma)
library(oligo)
library(pd.mogene.2.0.st)
library(genefilter)
library(arrayQualityMetrics)
library(mogene20sttranscriptcluster.db)
library(AnnotationDbi)
library(tidyverse)
library(factoextra)
library(ggplot2)
library(ggrepel)
library(NOISeq)
library(annotate)
library(NOISeq)
library(sva)
library(Biobase)
library(oligo)
library(biomaRt)
library(hugene20sttranscriptcluster.db)
library(dplyr)
celfiles <- list.files(pattern = "\\.CEL$", full.names = TRUE)
rawData <- read.celfiles(celfiles)
nromaliizing the data
normdata <- rma(rawData)
fetching expression data of normalized data as a data frame
normalized.exprs<-as.data.frame(exprs(normdata))
annotation_data <- data.frame(Sample = colnames(normalized.exprs))
types <- c(rep("IL", times = 4),
rep("NIL", times = 4),
rep("control", times = 4),
rep("hypoxia", times = 4),
rep("normoxia", times = 4))
annotation_data <- cbind(annotation_data, types)
DO BATCH CORRECTION
DATA_BC<- readData(normalized.exprs, factors = annotation_data)
myPCA = ARSyNseq(DATA_BC, factor = "types", batch = FALSE, norm = "n", logtransf = TRUE)
DATA_BC_DONE <- assayData(myPCA)$exprs
z-score transformation
transposed_matrix <- t(DATA_BC_DONE)
z_tr_mt <- scale(transposed_matrix, scale = TRUE, center = TRUE)
z_score <- t(z_tr_mt)
map probe ids to gene symbols and duplicate gene removal
probeids <- row.names(z_score)
gene.symbols <- mapIds(mogene20sttranscriptcluster.db, keys=probeids, column="SYMBOL", keytype="PROBEID")
normexprs = cbind(gene.symbols,z_score)
countmat = na.omit(normexprs)
double_matrix <- data.frame(countmat)
AGG <- aggregate(double_matrix[,-c(1)], by=list(Gene = double_matrix$gene.symbols), FUN=mean, na.rm =TRUE)
rownames(AGG) <- AGG[,1]
AGG[,1] <- NULL
I'm getting the following values after aggregation as all expression values are NA