Question: [WGCNA] Error in goodSamplesGenes function
gravatar for gustavoborin01
5.4 years ago by
University of Campinas, Brazil
gustavoborin0140 wrote:

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 it's a data.frame where the genes and the samples are the columns and rows, respectively, like it was done in the WGCNA tutorial.



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



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


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


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


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.


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


indentation for diagnostic messages. Zero means no indentation, each unit adds two spaces.

wgcna rna-seq R • 8.2k views
ADD COMMENTlink modified 7 weeks ago by alexgongfy0 • written 5.4 years ago by gustavoborin0140

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

ADD REPLYlink written 5.2 years ago by sharanya.ravi0

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 REPLYlink written 4 months ago by 149abhi10
gravatar for gustavoborin01
5.2 years ago by
University of Campinas, Brazil
gustavoborin0140 wrote:

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.


# 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 =[, -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)

# 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 COMMENTlink modified 18 months ago by Kevin Blighe61k • written 5.2 years ago by gustavoborin0140

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 REPLYlink written 5.1 years ago by sharanya.ravi0

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 REPLYlink written 3.0 years ago by pranav0

hey when i tried your method im getting this error:

Error: object 'gsg' not found

ADD REPLYlink written 4.2 years ago by aj12370

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

ADD REPLYlink written 4.0 years ago by gustavoborin0140
gravatar for alexgongfy
7 weeks ago by
alexgongfy0 wrote:


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



datExpr0 =[, -1]))

names(datExpr0) = rpkm$ID

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

gsg = goodSamplesGenes(datExpr0, verbose = 3)


sep = "\t" maybe the reason

ADD COMMENTlink modified 7 weeks ago • written 7 weeks ago by alexgongfy0
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1104 users visited in the last hour