[WGCNA] Error in goodSamplesGenes function
2
0
Entering edit mode
9.2 years ago

Dear all,

I'm new in R and I'm using WGCNA package to build a co-regulation network from my RNASeq data. I'm following the WGCNA tutorial but I have a error message when I try to run the goodSamplesGenes function. My RNASeq matrix has 7 conditions with more than 9,000 differentially expressed genes. The experiment was carry out with two biological replicates for each condition and the reads have already been normalized to RPKM. Could anyone help me in this regards?

gsg = goodSamplesGenes(datExpr0, verbose = 3)
 Flagging genes and samples with too many missing values...
  ..step 1
Error in goodGenes(datExpr, goodSamples, goodGenes, minFraction = minFraction,  :
  Too few genes with valid expression levels in the required number of samples.

datExpr0 is a data.frame where the genes and the samples are the columns and rows, respectively, like it was done in the WGCNA tutorial.

Usage

goodSamplesGenes(
  datExpr, 
  minFraction = 1/2, 
  minNSamples = ..minNSamples, 
  minNGenes = ..minNGenes, 
  verbose = 1, indent = 0)

Arguments

datExpr

expression data. A data frame in which columns are genes and rows are samples.

minFraction

minimum fraction of non-missing samples for a gene to be considered good.

minNSamples

minimum number of non-missing samples for a gene to be considered good.

minNGenes

minimum number of good genes for the data set to be considered fit for analysis. If the actual number of good genes falls below this threshold, an error will be issued.

verbose

integer level of verbosity. Zero means silent, higher values make the output progressively more and more verbose.

indent

indentation for diagnostic messages. Zero means no indentation, each unit adds two spaces.
RNA-Seq wgcna R • 17k views
ADD COMMENT
0
Entering edit mode

I have a similar problem did you find a solution to this?

ADD REPLY
0
Entering edit mode

I have created the object 'gsg' using the goodSamplesGenes, I am still getting the error.

gsg = goodSamplesGenes(datExpr0, verbose = 3);
Error in goodGenes(datExpr, weights, goodSamples, goodGenes, minFraction = minFraction, : datExpr must contain numeric data.
ADD REPLY
4
Entering edit mode
9.0 years ago

Hi, sharanya.ravi

Yes, I've solved it but first let me tell you how my data input looked like. I had a table with my conditions in 7 columns and my experiment's fungal genes in the rows (more than 9,000 genes/rows). So, I run this commands below and it worked.

rpkm=read.csv("file.csv",header=TRUE)
dim(rpkm)
names()

# Note that each row corresponds to a gene and column to a sample or auxiliary information.
# We now remove the auxiliary data and transpose the expression data for further analysis.
datExpr0 = as.data.frame(t(rpkm[, -1]))
names(datExpr0) = rpkm$Genes                      #Use the first column name after '$'
rownames(datExpr0) = names(rpkm)[-1]

# Checking data for excessive missing values and identification of outlier microarray samples
gsg = goodSamplesGenes(datExpr0, verbose = 3)
gsg$allOK

# If you got "TRUE", there is no outliers in your samples. If it had appeared 'FALSE', run this...
if (!gsg$allOK)
    {
    if (sum(!gsg$goodGenes)>0)
    printFlush(paste("Removing genes:", paste(names(datExpr0)[!gsg$goodGenes], collapse = ", ")))
    if (sum(!gsg$goodSamples)>0)
    printFlush(paste("Removing samples:", paste(rownames(datExpr0)[!gsg$goodSamples], collapse = ", ")))
    datExpr0 = datExpr0[gsg$goodSamples, gsg$goodGenes]
    }

I hope I've helped you. :D

ADD COMMENT
0
Entering edit mode

Thank you so much ... I think the mistake i did was manually preparing the input file in excel without using the initial R commands. it works now . Thank you so much

ADD REPLY
0
Entering edit mode

Hi, I didn't get by your point- that you were trying to make input file in excel without using initial R commands.. What initial R commands are needed to make a input file?

ADD REPLY
0
Entering edit mode

hey when i tried your method im getting this error:

Error: object 'gsg' not found

ADD REPLY
0
Entering edit mode

Did you solve the problem? Probably, you didn't create the object 'gsg' using the goodSamplesGenes function.

ADD REPLY
0
Entering edit mode
3.9 years ago
alexgongfy • 0

library(WGCNA)

rpkm=read.table("WGCNA/WS1",header=TRUE,sep = "\t")

dim(rpkm)

names()

datExpr0 = as.data.frame(t(rpkm[, -1]))

names(datExpr0) = rpkm$ID

rownames(datExpr0) = names(rpkm)[-1]

gsg = goodSamplesGenes(datExpr0, verbose = 3)

gsg$allOK

sep = "\t" maybe the reason

ADD COMMENT

Login before adding your answer.

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