Bioconductor / LoomExperiment

A package to read, write, and manipulate loom files using LoomExperiments. Uses the loom file format from the Linnarson Lab. https://linnarssonlab.org/loompy/
https://www.bioconductor.org/packages/LoomExperiment
6 stars 5 forks source link

`import()` sometimes? fails #13

Closed mtmorgan closed 4 years ago

mtmorgan commented 4 years ago

from the support site

url = "https://storage.googleapis.com/linnarsson-lab-loom/l5_all.agg.loom"
path = BiocFileCache::bfcrpath(rnames = url)
LoomExperiment::import(path)

fails 'for me' and the user, but not @LiNk-NY .

To debug, I wrote

debugonce(import, signature="LoomFile")
LoomExperiment::import(path)

and stepped through to https://github.com/Bioconductor/LoomExperiment/blob/8872bbe6ec9c8fd9911333d6f662ded3d1fd544b/R/import-method.R#L175-L176 . This fails with

Browse[2]>     colData <- .importLoom_DataFrame(con, '/col_attrs', colnames_attr, unlist(metadata[reducedDims_names]))
Error in normalizeDoubleBracketSubscript(i, x, exact = exact, allow.NA = TRUE,  : 
  invalid [[ subscript type: NULL

and in particular

Browse[2]> colnames_attr
NULL

is the argument matching rownames. So at https://github.com/Bioconductor/LoomExperiment/blob/8872bbe6ec9c8fd9911333d6f662ded3d1fd544b/R/import-method.R#L46 we have

Browse[4]> rowname
NULL
Browse[4]> df[[rowname]]
Error in normalizeDoubleBracketSubscript(i, x, exact = exact, allow.NA = TRUE,  : 
  invalid [[ subscript type: NULL

I'm not sure why this does not fail for Marcel? The failure is simply

> S4Vectors::DataFrame(x=1:2)[[NULL]]
Error in normalizeDoubleBracketSubscript(i, x, exact = exact, allow.NA = TRUE,  :
  invalid [[ subscript type: NULL
LiNk-NY commented 4 years ago

See #12 for a fix.