MarioniLab / miloR

R package implementation of Milo for testing for differential abundance in KNN graphs
https://bioconductor.org/packages/release/bioc/html/miloR.html
GNU General Public License v3.0
339 stars 22 forks source link

How to extract cell barcode identified by MiloR? #306

Closed obotman closed 7 months ago

obotman commented 7 months ago

Hello,

First, thanks for developing MiloR. It's a super tool. I would just like to known how to extract cell barcode identified from a milo object. How can I convert the index into its corresponding barcode?

Thanks a lot, Olivier

MikeDMorgan commented 7 months ago

Hi @obotman - could you please clarify your question? Do you mean the single-cell IDs? The are the column names of the Milo object. Or do you mean the cell ID for the neighbourhood Index cells? If so, the entries of the nhoodIndex() list are the positions of the cells in the columns of the Milo object, therefore you can retrieve the cell IDs for the nhood indices as the following:

index.ids <- colnames(milo.obj)[unlist(nhoodIndex(milo.obj))]

Here milo.obj would be whatever variable name you have for your Milo object.

obotman commented 7 months ago

Thanks @MikeDMorgan, this is exactly what I simply asking for. I didn't realise that the index corresponds to the the positions of the cells. Best regards, Olivier