loomR icon indicating copy to clipboard operation
loomR copied to clipboard

get.attribute.df error

Open davetang opened this issue 5 years ago • 7 comments

For loom files created with velocyto, cell names are called labelled as CellID. I think this is why I'm getting an error with get.attribute.df because it expects the label cell_names.

attrs <- names(r1_loom$col.attrs)
attrs
# [1] "CellID"   "Clusters" "_X"       "_Y"

attr_df <- r1_loom$get.attribute.df(MARGIN = 2, attribute.names = attrs)
Error in `[[.H5File`(self, paste0(attribute.layer, "/", col.names)) : An object with name col_attrs/cell_names does not exist in this group

davetang avatar Sep 19 '18 05:09 davetang

Encountered the same issue, I solved it by expliciting the name of the column name using the col.names argument (row.names if you're querying for gene-related attributes). For instance, to retrieve the cell names and clusters as a dataframe, you would write::

df = lfile$get.attribute.df(MARGIN = 2, attribute.names = c("CellID", "Clusters"), col.names = "CellID")

Hope it helps !

bopekno avatar Oct 11 '18 10:10 bopekno

I have the same issue here...

> names(lfile$row.attrs)
 [1] "Accession"              "Gene"                   "_LogCV"
 [4] "_LogMean"               "_Selected"              "_Total"
 [7] "_Valid"                 "gene_dispersion"        "gene_dispersion_scaled"
[10] "gene_means"             "var_genes"
>
> attrs <- names(lfile$row.attrs)
> attr.df <- lfile$get.attribute.df(MARGIN = 1, attribute.names = attrs)
Error in `[[.H5File`(self, paste0(attribute.layer, "/", row.names)) :
  An object with name row_attrs/gene_names does not exist in this group

yasinkaymaz avatar Nov 17 '18 17:11 yasinkaymaz

@davetang @bopekno @yasinkaymaz @ChristophH @andrewwbutler I met the same problem,how do you solve it? And I tried your command,but it didn't work.Can anyone give me some advice? Thanks!

> attrs <- names(lfile$col.attrs)
> tha.meatdata <- lfile$get.attribute.df(MARGIN = 2, attribute.names = attrs)
Error in `[[.H5File`(self, paste0(attribute.layer, "/", col.names)) : 
  An object with name col_attrs/cell_names does not exist in this group
> df = lfile$get.attribute.df(MARGIN = 2, attribute.names = c("CellID", "Clusters"), col.names = "CellID")
Error in `.rowNamesDF<-`(x, value = value) : 
  duplicate 'row.names' are not allowed
此外: Warning message:
non-unique values when setting 'row.names': ‘10X50_5_AAGTGACCAAGT-’, ‘10X50_5_ACCGGACTCGCT-’, ‘10X50_5_ACCTTGTCTCTA-’, ‘10X50_5_ACGTCTGGCATT-’, ‘10X50_5_ACTCTGTTACCT-’, ‘10X50_5_ACTTCTGCTCCT-’, ‘10X50_5_CAGTTGCCCTTG-’, ‘10X50_5_CGGAACCTGAGT-’, ‘10X50_5_CTCACTGCCATA-’, ‘10X50_5_CTGAGACATGGT-’, ‘10X50_5_GAAACTTAACGC-’, ‘10X50_5_GAAGACACACAC-’, ‘10X50_5_GACCCTTGGGAG-’, ‘10X50_5_GATAGACAACTG-’, ‘10X50_5_GATATGTAGAAG-’, ‘10X50_5_GCACACAGAGAT-’, ‘10X50_5_GCCATGTCCGTC-’, ‘10X50_5_TCGAACTGCTGA-’, ‘10X50_6_AACACTGAGCAG-’, ‘10X50_6_ACGAACGTGTCA-’, ‘10X50_6_ACTTTGGTTTCT-’, ‘10X50_6_AGAACTTAAGCC-’, ‘10X50_6_AGGATGTTCCGC-’, ‘10X50_6_ATACTGAGGTCT-’, ‘10X50_6_CCAGCTTCCGTC-’, ‘10X50_6_TAGAGAATCTCT-’, ‘10X50_6_TCAACTGCCATA-’, ‘10X50_6_TCAGGAGAAGGC-’, ‘10X50_6_TCCAGAGGTACT-’, ‘10X50_6_TCGAACATCACG-’, ‘10X50_6_TGGATGACCTCC-’, ‘10X50_6_TTAAGAGGGACA-’, ‘10X50_7_AACAGATCAAGC-’, [... truncated] 

Sophia409 avatar Mar 06 '19 16:03 Sophia409

Thanks for pointing this out, we will work on a fix.

mojaveazure avatar Mar 11 '19 16:03 mojaveazure

Hi there, I've just run into the same problem as Sophia's. Is there a way to make row.names unique to proceed with get.attribute.df? Best, Lipin

LooLipin avatar May 05 '20 00:05 LooLipin

Having the same issue. All of the row attributes are non unique, so I cannot access them!

reliscu avatar Nov 25 '20 03:11 reliscu