Skip to contents

This class is a composed class of TENxFileList which can contain a list of TENxFile objects for the cell-feature matrix. It is meant to handle a single Xenium sample from 10X Genomics.

Usage

TENxXenium(
  resources,
  xeniumOut,
  sample_id = "sample01",
  format = c("mtx", "h5"),
  boundaries_format = c("parquet", "csv.gz"),
  spatialCoordsNames = c("x_centroid", "y_centroid"),
  ...
)

# S4 method for class 'TENxXenium,ANY,ANY'
import(con, format, text, ...)

Arguments

resources

A TENxFileList object or a file path to the tarball containing the matrix / assay data resources.

xeniumOut

character(1) The path to the Xenium output directory.

sample_id

character(1) A single string specifying the sample ID.

format

The format of the output. If missing and con is a file name, the format is derived from the file extension. This argument is unnecessary when con is a derivative of BiocFile.

boundaries_format

character(1) Either "parquet" or "csv.gz" to specify the file extension of the boundaries file. Default is "parquet".

spatialCoordsNames

character() A vector of strings specifying the names of the columns in the spatial data containing the spatial coordinates.

...

In the constructor, additional arguments passed to TENxFileList; otherwise, not used.

con

The connection from which data is loaded or to which data is saved. If this is a character vector, it is assumed to be a file name and a corresponding file connection is created and then closed after exporting the object. If it is a BiocFile derivative, the data is loaded from or saved to the underlying resource. If missing, the function will return the output as a character vector, rather than writing to a connection.

text

If con is missing, this can be a character vector directly providing the string data to import.

Value

A SpatialExperiment object

Details

Note that one can provide a ref argument to import method which will get passed to the internal splitAltExps operation. This allows one to set a mainExpName in the output object.

Functions

  • import(con = TENxXenium, format = ANY, text = ANY): Import Xenium Analyzer data

Slots

resources

A TENxFileList or TENxH5 object containing the cell feature matrix.

boundaries

Either a TENxSpatialParquet or TENxSpatialCSV object containing the spatial boundaries data.

coordNames

character() A vector specifying the names of the columns in the spatial data containing the spatial coordinates.

sampleId

character(1) A scalar specifying the sample identifier.

colData

TENxSpatialParquet A TENxSpatialParquet object containing the spatial coordinates data.

metadata

XeniumFile A XeniumFile object containing the metadata information.

Examples

showClass("TENxXenium")
#> Class "TENxXenium" [package "XeniumIO"]
#> 
#> Slots:
#>                                            
#> Name:                             resources
#> Class:               TENxFileList_OR_TENxH5
#>                                            
#> Name:                            boundaries
#> Class: TENxSpatialParquet_OR_TENxSpatialCSV
#>                                            
#> Name:                            coordNames
#> Class:                            character
#>                                            
#> Name:                              sampleId
#> Class:                            character
#>                                            
#> Name:                               colData
#> Class:                   TENxSpatialParquet
#>                                            
#> Name:                              metadata
#> Class:                           XeniumFile

zipfile <- paste0(
    "https://mghp.osn.xsede.org/bir190004-bucket01/BiocXenDemo/",
    "Xenium_Prime_MultiCellSeg_Mouse_Ileum_tiny_outs.zip"
)
destfile <- XeniumIO:::.cache_url_file(zipfile)
#> Registered S3 method overwritten by 'bit64':
#>   method          from 
#>   print.bitstring tools
outfold <- file.path(
    tempdir(), tools::file_path_sans_ext(basename(zipfile))
)
if (!dir.exists(outfold))
    dir.create(outfold, recursive = TRUE)
unzip(
    zipfile = destfile, exdir = outfold, overwrite = FALSE
)
TENxXenium(xeniumOut = outfold) |>
    import(ref = "Gene Expression")
#> class: SpatialExperiment 
#> dim: 5006 36 
#> metadata(2): experiment.xenium polygons
#> assays(1): counts
#> rownames(5006): ENSMUSG00000052595 ENSMUSG00000030111 ...
#>   ENSMUSG00000055670 ENSMUSG00000027596
#> rowData names(3): ID Symbol Type
#> colnames(36): aaamobki-1 aaclkaod-1 ... olbjkpjc-1 omjmdimk-1
#> colData names(13): cell_id transcript_counts ... segmentation_method
#>   sample_id
#> reducedDimNames(0):
#> mainExpName: Gene Expression
#> altExpNames(5): Deprecated Codeword Genomic Control Negative Control
#>   Codeword Negative Control Probe Unassigned Codeword
#> spatialCoords names(2) : x_centroid y_centroid
#> imgData names(0):