This constructor function was developed using the PBMC 3K dataset from 10X
Genomics (version 3). Other versions are supported and input arguments
version and group can be overridden.
Arguments
- resource
character(1) The path to the file
- version
character(1) There are currently two recognized versions associated with 10X data, either version "2" or "3". See details for more information.
- group
character(1) The HDF5 group embedded within the file structure, this is usually either the "matrix" or "outs" group but other groups are supported as well (e.g., "mm10").
- ranges
character(1) The HDF5 internal folder location embedded within the file that points to the ranged data information, e.g., "/features/interval". Set to
NA_character_if range information is not present.- rowidx, colidx
numeric() A vector of indices corresponding to either rows or columns that will dictate the data imported from the file. The indices will be passed on to the
[method of theTENxMatrixrepresentation.- ...
Additional inputs to the low level class generator functions
Details
The various TENxH5 methods including rowData and rowRanges,
provide a snapshot of the data using a length 12 head and tail subset for
efficiency. In contrast, methods such as dimnames and dim give
a full view of the dimensions of the data. The show method provides
relevant information regarding the dimensions of the data including
metadata such as rowData and "Type" column, if available. The data files
are imported as SingleCellExperiment class objects.
An additional ref argument can be provided when the file contains
multiple feature_type in the file or "Type" in the rowData. By default,
the first type reported in table() is set as the mainExpName in the
SingleCellExperiment object.
For data that do not contain genomic coordinate information, the TENxH5
will fail to read "/features/interval" and will set the ranges
argument to NA_character_.
The data version "3" mainly includes a "matrix" group and "interval"
information within the file. Version "2" data does not include
ranged-based information and has a different directory structure compared
to version "3". See the internal data.frame: TENxIO:::h5.version.map
for a map of fields and their corresponding file locations within the H5
file. This map is used to create the rowData structure from the file.
See also
import section in TENxH5
Examples
h5f <- system.file(
"extdata", "pbmc_granulocyte_ff_bc_ex.h5",
package = "TENxIO", mustWork = TRUE
)
TENxH5(h5f)
#> TENxH5 object
#> resource: /tmp/RtmpyohtVo/temp_libpathb4d447d8acf/TENxIO/extdata/pbmc_granulocyte_ff_bc_ex.h5
#> dim: 10 10
#> rownames: ENSG00000243485 ENSG00000237613 ... ENSG00000286448 ENSG00000236601
#> rowData names(3): ID Symbol Type
#> Type: Gene Expression
#> colnames: AAACAGCCAAATATCC-1 AAACAGCCAGGAACTG-1 ... AAACCGCGTGAGGTAG-1 AAACGCGCATACCCGG-1
import(TENxH5(h5f))
#> preview <= 12 rowRanges: pbmc_granulocyte_ff_bc_ex.h5
#> class: SingleCellExperiment
#> dim: 10 10
#> metadata(1): TENxFile
#> assays(1): counts
#> rownames(10): ENSG00000243485 ENSG00000237613 ... ENSG00000286448
#> ENSG00000236601
#> rowData names(3): ID Symbol Type
#> colnames(10): AAACAGCCAAATATCC-1 AAACAGCCAGGAACTG-1 ...
#> AAACCGCGTGAGGTAG-1 AAACGCGCATACCCGG-1
#> colData names(0):
#> reducedDimNames(0):
#> mainExpName: Gene Expression
#> altExpNames(0):
h5f <- system.file(
"extdata", "10k_pbmc_ATACv2_f_bc_ex.h5",
package = "TENxIO", mustWork = TRUE
)
## Optional ref input, most frequent Type used by default
th5 <- TENxH5(h5f, ranges = "/features/id", ref = "Peaks")
th5
#> TENxH5 object
#> resource: /tmp/RtmpyohtVo/temp_libpathb4d447d8acf/TENxIO/extdata/10k_pbmc_ATACv2_f_bc_ex.h5
#> dim: 10 10
#> rownames: chr1:9772-10660 chr1:180712-181178 ... chr1:605079-605959 chr1:629538-630397
#> rowData names(3): ID Symbol Type
#> Type: Peaks
#> colnames: AAACGAAAGAGAGGTA-1 AAACGAAAGCAGGAGG-1 ... AAACGAACACCCTTTG-1 AAACGAACACCGTTGG-1
TENxH5(h5f, ranges = "/features/id")
#> TENxH5 object
#> resource: /tmp/RtmpyohtVo/temp_libpathb4d447d8acf/TENxIO/extdata/10k_pbmc_ATACv2_f_bc_ex.h5
#> dim: 10 10
#> rownames: chr1:9772-10660 chr1:180712-181178 ... chr1:605079-605959 chr1:629538-630397
#> rowData names(3): ID Symbol Type
#> Type: Peaks
#> colnames: AAACGAAAGAGAGGTA-1 AAACGAAAGCAGGAGG-1 ... AAACGAACACCCTTTG-1 AAACGAACACCGTTGG-1
import(th5)
#> preview <= 12 rowRanges: 10k_pbmc_ATACv2_f_bc_ex.h5
#> class: SingleCellExperiment
#> dim: 10 10
#> metadata(1): TENxFile
#> assays(1): counts
#> rownames(10): chr1:9772-10660 chr1:180712-181178 ... chr1:605079-605959
#> chr1:629538-630397
#> rowData names(3): ID Symbol Type
#> colnames(10): AAACGAAAGAGAGGTA-1 AAACGAAAGCAGGAGG-1 ...
#> AAACGAACACCCTTTG-1 AAACGAACACCGTTGG-1
#> colData names(0):
#> reducedDimNames(0):
#> mainExpName: Peaks
#> altExpNames(0):