jinworks / CellChat

R toolkit for inference, visualization and analysis of cell-cell communication from single-cell and spatially resolved transcriptomics
GNU General Public License v3.0
304 stars 52 forks source link

meta structure for analysing multiple VISIUM datasets #123

Open jvogenstahl opened 7 months ago

jvogenstahl commented 7 months ago

Hi !

I'm trying to use CellChat to analyse multiple VISIUM datasets at once, however I doubt what should be the structure of the meta variable. Could you please let me know what should be the rownames and columns in the meta DataFrame ?

Since both of my samples have spots with the same barcodes, I get the following error when I try to use the barcodes as row names of the meta :

rownames(meta) <- barcodes Error in .rowNamesDF<-(x, value = value) : duplicate 'row.names' are not allowed In addition: Warning message: non-unique values when setting 'row.names': ‘AAGAGCTCTTTATCGG-1’, ‘ACGCATTCGTGAGTAC-1’, ‘ACGCGGGCCAAGGACA-1’, ‘CCACCCAAGGAAAGTG-1’, ‘CCGCACAAAGACCAAC-1’, ‘CGGGAATTTATGTAAA-1’, ‘GATCGTGACTGATATC-1’, ‘GGGACTGCATAGATAG-1’, ‘TACGACTGCCTCTTAG-1’, ‘TCTTCGAATAGACGTT-1’, ‘TGGACTGTTCGCTCAA-1’, ‘TTATATACGCTGTCAC-1’

If I don't use barcodes as row names (but put them in another column for instance), the code crashes when I attempt to create the CellChat object since it seems to read the barcodes only in the row names of meta to compare them with the data.input.

I'd be very grateful idd you could help me with this issue.

Cheers,

Johanna

sqjin commented 7 months ago

@jvogenstahl When there are mutiple samples, the common way is to manually add prefix like "s1_ACGCCCCCC-1". Yes, the row names of mata should be the same as data.input. The column should provide a cell label of each spot.