Skip to contents

This constructor function is designed to work with the files denoted with "peak_annotation" in the file name. These are usually produced as tab separated value files, i.e., .tsv.

Usage

TENxPeaks(resource, extension, ...)

Arguments

resource

character(1) The path to the file

extension

character(1) The file extension for the given resource. It can usually be obtained from the file path. An override can be provided especially for ExperimentHub resources where the file extension is removed.

...

Additional inputs to the low level class generator functions

Value

A GRanges class object of peak locations

Details

The output class allows handling of peak data. It can be used in conjunction with the annotation method on a SingleCellExperiment to add peak information to the experiment. The ranged data is represented as a GRanges class object.

Examples


fi <- system.file(
    "extdata", "pbmc_granulocyte_sorted_3k_ex_atac_peak_annotation.tsv",
    package = "TENxIO", mustWork = TRUE
)
peak_file <- TENxPeaks(fi)
peak_anno <- import(peak_file)
peak_anno
#> GRanges object with 10 ranges and 3 metadata columns:
#>        seqnames        ranges strand |        gene  distance   peak_type
#>           <Rle>     <IRanges>  <Rle> | <character> <numeric> <character>
#>    [1]     chr1    9768-10660      * | MIR1302-2HG    -18894      distal
#>    [2]     chr1 180582-181297      * |  AL627309.5     -6721      distal
#>    [3]     chr1 181404-181887      * |  AL627309.5     -7543      distal
#>    [4]     chr1 191175-192089      * |  AL627309.5    -17314      distal
#>    [5]     chr1 267561-268455      * |  AP006222.2       707      distal
#>    [6]     chr1 270864-271747      * |  AP006222.2      4010      distal
#>    [7]     chr1 273947-274758      * |  AP006222.2      7093      distal
#>    [8]     chr1 585751-586647      * |  AC114498.1      -982    promoter
#>    [9]     chr1 629484-630393      * |  AC114498.1     41856      distal
#>   [10]     chr1 633556-634476      * |  AC114498.1     45928      distal
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths

example(TENxH5)
#> 
#> TENxH5> h5f <- system.file(
#> TENxH5+     "extdata", "pbmc_granulocyte_ff_bc_ex.h5",
#> TENxH5+     package = "TENxIO", mustWork = TRUE
#> TENxH5+ )
#> 
#> TENxH5> 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 
#> 
#> TENxH5> 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):
#> 
#> TENxH5> h5f <- system.file(
#> TENxH5+     "extdata", "10k_pbmc_ATACv2_f_bc_ex.h5",
#> TENxH5+     package = "TENxIO", mustWork = TRUE
#> TENxH5+ )
#> 
#> TENxH5> ## Optional ref input, most frequent Type used by default
#> TENxH5> th5 <- TENxH5(h5f, ranges = "/features/id", ref = "Peaks")
#> 
#> TENxH5> 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> 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 
#> 
#> TENxH5> 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):

## Add peaks to an existing SCE
## First, import the SCE from an example H5 file
h5f <- system.file(
    "extdata", "pbmc_granulocyte_ff_bc_ex.h5",
    package = "TENxIO", mustWork = TRUE
)
con <- TENxH5(h5f)
sce <- import(con)
#> preview <= 12 rowRanges: pbmc_granulocyte_ff_bc_ex.h5 
## auto-import peaks when using annotation<-
annotation(sce, name = "peak_annotation") <- peak_file
annotation(sce)
#> $peak_annotation
#> GRanges object with 10 ranges and 3 metadata columns:
#>        seqnames        ranges strand |        gene  distance   peak_type
#>           <Rle>     <IRanges>  <Rle> | <character> <numeric> <character>
#>    [1]     chr1    9768-10660      * | MIR1302-2HG    -18894      distal
#>    [2]     chr1 180582-181297      * |  AL627309.5     -6721      distal
#>    [3]     chr1 181404-181887      * |  AL627309.5     -7543      distal
#>    [4]     chr1 191175-192089      * |  AL627309.5    -17314      distal
#>    [5]     chr1 267561-268455      * |  AP006222.2       707      distal
#>    [6]     chr1 270864-271747      * |  AP006222.2      4010      distal
#>    [7]     chr1 273947-274758      * |  AP006222.2      7093      distal
#>    [8]     chr1 585751-586647      * |  AC114498.1      -982    promoter
#>    [9]     chr1 629484-630393      * |  AC114498.1     41856      distal
#>   [10]     chr1 633556-634476      * |  AC114498.1     45928      distal
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths
#>