could not find function "pickSoftThreshold"
1
0
Entering edit mode
21 months ago
Sonia • 0

Hello, I am new to R....and while running this in R studio, I'm getting this error...please help me out in resolving the error...

sft = pickSoftThreshold(datExpr, powerVector = powers, verbose = 5) 
Error in pickSoftThreshold(datExpr, powerVector = powers, verbose = 5) : 
  could not find function "pickSoftThreshold"
R • 2.1k views
ADD COMMENT
0
Entering edit mode

did you try loading library(WGCNA) before running the function ? Post your code relevant to your query always.

ADD REPLY
0
Entering edit mode

library(WGCNA) has already been loaded...still i am getting this error

ADD REPLY
0
Entering edit mode

Are you sure library(WGCNA)did not produce any error ?

ADD REPLY
0
Entering edit mode

Error: package or namespace load failed for ‘WGCNA’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘impute’

i am getting this error while loading WGCNA

ADD REPLY
0
Entering edit mode

Install impute and you should be fine

ADD REPLY
0
Entering edit mode
21 months ago
Sonia • 0
setwd("R_WGCNA/Demo_Yu2021NatPlant")

library(WGCNA)
library(DESeq2)
# The following setting is important, do not omit.
options(stringsAsFactors = FALSE);


#===============================================================================
#
#  Download the files
#
#==============================================================================
# Step 1: Download files from https://github.com/PengYuMaize/Yu2021NaturePlants
# Rename the sample ID in the "gene_counts_table" and "sample_info" files, so that they look alike
# Rename for the sample ID start with "787_" and "78371A_"
# or you may just download my modified "gene_counts_table_WGCNA_LC.txt" for smooth tutorial experience

#===============================================================================
#
#  Read the gene counts table and plot the sample tree
#
#===============================================================================
#setwd("~/Yupeng")

# Read the gene counts table 
data0=read.table("gene_counts_table_WGCNA_LC.txt",header=T,row.names=1,sep="\t")
# Normalization with log2(FPKM+1)
sample_metadata = read.csv(file = "sample_info.csv")

dataExpr_deseq <- DESeqDataSetFromMatrix(countData = data0[,-181],colData = sample_metadata,design = ~ Zone)
mcols(dataExpr_deseq)$basepairs = data0$geneLengt1
fpkm_matrix = fpkm(dataExpr_deseq)
datExpr = t(log2(fpkm_matrix+1))

head(datExpr[1:5,1:5]) # samples in row, genes in column
match(sample_metadata$sample_ID, colnames(data0))
datExpr <- datExpr[,1:5000]

# Calculate sample distance and cluster the samples
sampleTree = hclust(dist(datExpr), method = "average");
# plot sample tree
pdf(file = "1-n-sampleClustering.pdf", width = 40, height = 9);
par(cex = 1.3);
par(mar = c(0,4,2,0))
plot(sampleTree, main = "Sample clustering to detect outliers", sub="", xlab="",
     cex.lab = 1.5,cex.axis = 1.5, cex.main = 2)
dev.off()

#===============================================================================
#
#  Choose soft threshold parameter
#
#===============================================================================

# Choose a set of soft threshold parameters
powers = c(c(1:20), seq(from = 22, to=30, by=2))



sft = pickSoftThreshold(datExpr, powerVector = powers, verbose = 5) 
ADD COMMENT
0
Entering edit mode

This is the code , that i was trying to run

ADD REPLY
0
Entering edit mode

Output of sessionInfo()?

ADD REPLY

Login before adding your answer.

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