CountSignals-class: Container for count signals

Description Usage Arguments Value Methods (by generic) Slots See Also Examples

Description

This s4 class is a tiny wrapper around a normal list (stored in the signals slot) and it is the output of the methods in the bamsignals package. Among other things the container provides an accessor method, that returns single signals as vectors and matrices, and the methods as.list and alignSignals, that convert the container to a list or an array/matrix respectively. A CountSignals object is read-only, i.e. it cannot be modified.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## S4 method for signature 'CountSignals'
length(x)

## S4 method for signature 'CountSignals'
width(x)

## S4 method for signature 'CountSignals,ANY'
x[i, drop = TRUE]

## S4 method for signature 'CountSignals'
as.list(x)

## S4 method for signature 'CountSignals'
alignSignals(x)

Arguments

x

A CountSignals object

i

Index for subsetting. It can be a single index as well as a vector of indices.

drop

In case i is a vector of length 1, after subsetting, collapse the CountSignal object to a single signal or not.

Value

return values are described in the Methods section.

Methods (by generic)

Slots

ss

A single boolean value indicating whether all signals are strand-specific or not

signals

A list of integer vectors (if ss==TRUE) or of integer matrices, representing each signal

See Also

bamsignals-methods for the functions that produce this object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#get a CountSignals object
library(GenomicRanges)
bampath <- 
system.file("extdata", "randomBam.bam", package="bamsignals")
genes <- 
get(load(system.file("extdata", "randomAnnot.Rdata", package="bamsignals")))
csig <- bamProfile(bampath, genes, ss=TRUE)

#show it
show(csig)

#number of contained signals
len <- length(csig)

#width of each signal
w <- width(csig)

#get one element as a vector (or matrix)
v <- csig[1]

#use as if it was a list
tot_per_sig <- sapply(csig, sum)

#convert to a list
siglist <- as.list(csig)

#get regions and signals of the same width
proms <- promoters(genes, upstream=150, downstream=150)
csig <- bamCoverage(bampath, proms)

#convert to matrix
mat <- alignSignals(csig)

lamortenera/bamsignals documentation built on Oct. 9, 2021, 10:03 p.m.