Hello, I am trying to analyze some RNASeq data using the WCGNA package. For the most part it works fine but I can't seem to connect my trait data with my expression data.
I have a normalized expression matrix with 39 samples and a lot of contigs. My data is a developmental series with 3-16 samples at each stage of development. The "trait" data is just the developmental stage. So I have a trait file with "Stage" (numbered 0-5) and "Individual". I added X's before the individual names in both files, because they were just numbers. When I try and connect the traits with the expression data I get a problem with the rownames.
The code I am using and error are:
>allTraits = traitData[, c(1:2) ]
> dim(allTraits)
[1] 39 2
> names(allTraits)
[1] "Individual" "Stage_number"
> Eep_samples=rownames(datExpr)
> traitRows = match(Eep_samples, allTraits$Individual)
> datTraits = allTraits[traitRows, -1]
> rownames(datTraits) = allTraits[traitRows, 1]
Error in `rownames<-`(`*tmp*`, value = c("X221_quant", "X267_quant", "X320_quant", :
attempt to set 'rownames' on an object with no dimensions
I am just learning R. Am missunderstanding what the code is doing and am actually deleting all the trait data? I assume the -1, 1 are defining where the row names are...
Any help would be appreciated! Thank you!
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6
Thank you so much! That solved the problem.
Jessica