pvca error (Error in Data$variables : $ operator is invalid for atomic vectors)
1
0
Entering edit mode
a.riedel • 0
@ariedel-7660
Last seen 9.7 years ago
Australia

Apologies for what I expect will be an easy solve.

I have built an Expression Set from scratch using the instructions at http://www.bioconductor.org/packages/2.13/bioc/vignettes/Biobase/inst/doc/ExpressionSetIntroduction.pdf
I have the expression set imported as a matrix, the pheno Data imported as a data.frame from a cvs file.

Biobase readily creates a 'formal class ExpressionSet', but when I try to run
pvcaObj <- pvcaBatchAssess (exampleSet, batch.factors, pct_threshold)
I only obtain an error message:
Error in Data$variables : $ operator is invalid for atomic vectors

_________________________________________________________________

> dataDirectory <- system.file("extdata", package="Biobase")
> exprsFile <- "~/.../zhen 2.csv"
> exprs <- as.matrix(read.csv(exprsFile, row.names=1,header=TRUE, as.is=TRUE))
> class(exprs)
[1] "matrix"
> # Phenotype data
> pDataFile <- "~/.../zhen pheno.csv"
> pData <- read.csv(pDataFile, header=TRUE)
> colnames(exprs) <- row.names(pData)
> all(rownames(pData)==colnames(exprs)) 
[1] TRUE
> phenoData <- new("AnnotatedDataFrame",
+ data=pData)
> phenoData
An object of class 'AnnotatedDataFrame'
  rowNames: 1 2 ... 96 (96 total)
  varLabels: batch
  varMetadata: labelDescription
> #### 4.5 Assembling an ExpressionSet ####
> exampleSet <- ExpressionSet(assayData=exprs,phenoData=phenoData)
> exampleSet
ExpressionSet (storageMode: lockedEnvironment)
assayData: 3108 features, 96 samples 
  element names: exprs 
protocolData: none
phenoData
  sampleNames: 1 2 ... 96 (96 total)
  varLabels: batch
  varMetadata: labelDescription
featureData: none
experimentData: use 'experimentData(object)'
Annotation:  
> library(pvca)
> pct_threshold <- 0.6
> batch.factors <- "batch"
> pvcaObj <- pvcaBatchAssess (exampleSet, batch.factors, pct_threshold)
Error in Data$variables : $ operator is invalid for atomic vectors

> print(sessionInfo())
R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.3 (Yosemite)

locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] pvca_1.8.0          Biobase_2.28.0      BiocGenerics_0.14.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.11.5           lattice_0.20-31       MASS_7.3-40           grid_3.2.0           
 [5] nlme_3.1-120          affy_1.46.0           BiocInstaller_1.18.1  zlibbioc_1.14.0      
 [9] minqa_1.2.4           affyio_1.36.0         nloptr_1.0.4          limma_3.24.1         
[13] Matrix_1.2-0          preprocessCore_1.30.0 splines_3.2.0         lme4_1.1-7           
[17] tools_3.2.0           vsn_3.36.0

 

_________________________________________________________________


Many thanks for your help!

AR

pvca biobase • 6.0k views
ADD COMMENT
0
Entering edit mode
erflynn • 0
@erflynn-8607
Last seen 9.4 years ago
United States

I ran into the same problem with PVCA.  The code works if you feed it a list of batch factors, but not a list containing a single batch factor. 

For example:

> batch.factors <- c("batch1", "batch2")

will work, while

> batch.factors <- c("batch")

does not. The code assumes that the batch factors are a list, so we get funky data shape / type problems (like a matrix instead of a data frame which produces the error you got) if only one item is provided. 

ADD COMMENT

Login before adding your answer.

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