This function creates a clusters.csv
file similar to the ones created by
SpaceRanger at outs/analysis/clustering
but with the key
column that
combines the barcode
and the sample_id
, which is needed when the spe
object contains data from multiple samples given that the barcodes are
duplicated.
Defaults to the output of
fetch_data(type = 'spe')
. This is a
SpatialExperiment-class
object with the spot-level Visium data and information required for
visualizing the histology. See fetch_data()
for more details.
A character(1)
with the name of the variable you wish to
export.
A character(1)
specifying the output directory, similar
to the outs/analysis/clustering
produced by SpaceRanger.
A logical(1)
indicating whether to overwrite the spe$key
.
The path to the exported clusters.csv
file.
Other cluster export/import utility functions:
cluster_import()
if (enough_ram()) {
## Obtain the necessary data
if (!exists("spe")) spe <- fetch_data("spe")
## Export two cluster variables
cluster_export(spe, "spatialLIBD")
cluster_export(spe, "GraphBased")
}
#> 2024-04-19 19:42:16.608181 loading file /github/home/.cache/R/BiocFileCache/c9922e59250_Human_DLPFC_Visium_processedData_sce_scran_spatialLIBD.Rdata%3Fdl%3D1
#> Overwriting 'spe$key'. Set 'overwrite = FALSE' if you do not want to overwrite it.
#> Overwriting 'spe$key'. Set 'overwrite = FALSE' if you do not want to overwrite it.