Question: [WGCNA] Error in goodSamplesGenes function
0
gravatar for gustavoborin01
3.7 years ago by
University of Campinas, Brazil
gustavoborin0120 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.

 

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 ar 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.

wgcna rna-seq R • 4.7k views
ADD COMMENTlink modified 3.5 years ago by sharanya.ravi0 • written 3.7 years ago by gustavoborin0120
0
gravatar for sharanya.ravi
3.5 years ago by
Malaysia
sharanya.ravi0 wrote:

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

ADD COMMENTlink written 3.5 years ago by sharanya.ravi0
1
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 REPLYlink written 3.4 years ago by gustavoborin0120

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 3.4 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 14 months ago by pranav0

hey when i tried your method im getting this error:

Error: object 'gsg' not found

ADD REPLYlink written 2.4 years ago by aj12370

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

ADD REPLYlink written 2.3 years ago by gustavoborin0120
Please log in to add an answer.

Help
Access

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