Loading Traitdata file for WGCNA analysis
0
0
Entering edit mode
2.1 years ago
priya.bmg ▴ 60

Hello

I am trying to load the trait data for WGCNA analysis. I followed the steps given in section 1c of this link https://horvath.genetics.ucla.edu/html/CoexpressionNetwork/Rpackages/WGCNA/Tutorials/FemaleLiver-01-dataInput.pdf.

I have a problem in loading the traitdata. Has anyone come across this error

I have 492 rows as samples

traitData = read.csv("F:\\gene_priortization\\wgcnafiles\\trait.csv")
allTraits = traitData[c(1:2)] ## select the first two columns. First column has 492 sample names and second column is coded 1 or 2
dim(allTraits)
names(allTraits)

Samples = rownames(df1_edit_cg); ##df1_edit_cg is the expression data 
traitRows = match(Samples, allTraits$ArrayName); ##I get a list with 492 integers
datTraits = allTraits[traitRows, -1]; ## Here I get the second column from all traits coded as 1 or 2
rownames(datTraits) = allTraits[traitRows, 1];

Error in `rownames<-`(`*tmp*`, value = c("X8.pcw_amygdaloid.complex",  : 
  attempt to set 'rownames' on an object with no dimensions

datTraits
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[57] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[113] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[169] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[225] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[281] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[337] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[393] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[449] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

Thanks

R WGCNA • 910 views
ADD COMMENT
0
Entering edit mode

Please provide an example of datTraits, it is likely impossible to help without seeing data head(datTraits)

ADD REPLY
0
Entering edit mode

I have given an example of datTrait in the question above

ADD REPLY
1
Entering edit mode

Well datTraits is a vector, it is not a dataframe. If you want to give names to a vector you need names(datTraits)= ...

ADD REPLY
0
Entering edit mode

Thank you

ADD REPLY

Login before adding your answer.

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