HenrikBengtsson / affxparser

🔬 R package: This is the Bioconductor devel version of the affxparser package.
http://bioconductor.org/packages/devel/bioc/html/affxparser.html
7 stars 3 forks source link

Several read functions do not handle zero-length indices #3

Open HenrikBengtsson opened 9 years ago

HenrikBengtsson commented 9 years ago

[Adding a bug report that's been open since 2008-05-08!]

Several methods treats cell/unit indices specified as integer(0) just as NULL. For consistency, we should let NULL mean "read everything", whereas integer(0) should be "read nothing/read zero elements".

readCel(pathname, indices=integer(0))
readCdf(pathname, units=integer(0))
readCdfUnits(pathname, units=integer(0))
readCdfUnitNames(pathname, units=integer(0))
readCdfUnitsWriteMap(pathname, units=integer(0))
readCdfQc(pathname, units=integer(0))
readCdfNbrOfCellsPerUnitGroup(pathname, units=integer(0))
readCdfIsPm(pathname, units=integer(0))
readCdfGroupNames(pathname, units=integer(0))
readCdfCellIndices(pathname, units=integer(0))
readCdfDataFrame(pathname, units=integer(0))
HenrikBengtsson commented 9 years ago

As a start, the 'devel' branch (sic!) of this repository now gives an informative error in all of the above cases when indices or units is of length zero and not NULL, e.g.

> readCdfUnits(cdf, units=integer(0))
Error in readCdfUnits(cdf, units = integer(0)) :
  readCdfUnits(..., units=integer(0)) is not supported.
HenrikBengtsson commented 9 years ago

Added the same protection for:

readPgf(..., indices=integer(0))
readPgfEnv(..., indices=integer(0))

which is somewhat related to Issue #2.

I think by now that all read as well as update functions are protected and give informative error messages.

HenrikBengtsson commented 8 years ago

Just a reminder: Protection against integer(0) indices was added to:

Version: 1.39.1 [2014-10-26] o ROBUSTNESS: Now all methods gives an informative error message if zero elements are requested, i.e. via zero-length argument 'indices' or 'units' that is not NULL. Previously this case would access all values just like NULL does.