HenrikBengtsson / aroma.affymetrix

🔬 R package: Analysis of Large Affymetrix Microarray Data Sets
https://cran.r-project.org/package=aroma.affymetrix
10 stars 3 forks source link

Subsetting by name on empty AffymetrixCelSet tries to read non-existing CEL file #11

Closed HenrikBengtsson closed 8 years ago

HenrikBengtsson commented 8 years ago
> library("aroma.affymetrix")
> ds <- AffymetrixCelSet()
> # ds["foo"] or
> extract(ds, "foo")
Error in affxparser::readCelHeader(...) :
  Argument 'filename' should be a single file:
> traceback()
> traceback()
13: stop("Argument 'filename' should be a single file: ", paste(filename,
        collapse = ", "))
12: affxparser::readCelHeader(...)
11: .readCelHeader(pathname)
10: getHeader.AffymetrixCelFile(this)
9: getHeader(this)
8: getCdf.AffymetrixCelFile(getOneFile(this), ...)
7: getCdf(getOneFile(this), ...)
6: getCdf.AffymetrixCelSet(this)
5: getCdf(this)
4: clearCache.AffymetrixCelSet(res)
3: clearCache(res)
2: extract.GenericDataFileSet(ds, "foo")
1: extract(ds, "foo")
HenrikBengtsson commented 8 years ago

This is because clearCache() tries to call getCdf() on an AffymetrixCelSet with a files list containing a single NULL element:

> clearCache.AffymetrixCelSet
function (this, ...)
{
    NextMethod("clearCache")
    this$.averageFiles <- list()
    if (length(this) > 0) {
        cdf <- getCdf(this)
        clearCache(cdf)
    }
    invisible(this)
}
<environment: namespace:aroma.affymetrix>
HenrikBengtsson commented 8 years ago

The above is effectively because it is possible to have:

> library("aroma.affymetrix")
> df <- AffymetrixCelFile()
> getPathname(df)
NULL
> df
Error in readBin(pathname, what = raw(), n = 10) : invalid connection
> getCdf(df)
Error in affxparser::readCelHeader(...) :
  Argument 'filename' should be a single file:

This lead me to identify the following two underlying issues in R.filesets:

We most likely want to solve/decide on those two before attacking this issue.

HenrikBengtsson commented 8 years ago

Fixed in commit 14a06b8, e.g.

> AffymetrixCelSet()
AffymetrixCelSet:
Name: NA
Tags:
Path: NA
Platform: Affymetrix
Chip type: NA
Number of arrays: 0
Time period: NA
Total file size: 0.00MB
RAM: 0.00MB