pairParam {diffHic} | R Documentation

## pairParam class and methods

### Description

Class to specify read pair loading parameters

### Details

Each pairParam object stores a number of parameters to extract reads from a BAM file. Slots are defined as:

`fragments`:

  a `GRanges` object containing the coordinates of the restriction fragments

`restrict`:

  a character vector or 2-column matrix containing the names of allowable chromosomes from which reads will be extracted

`discard`:

  a `GRanges` object containing intervals in which any alignments will be discarded

`cap`:

  an integer scalar, specifying the maximum number of read pairs per pair of restriction fragments

The `fragments` object defines the genomic interval spanned by each restriction fragment. All reads are generated around restriction sites, so the spatial resolution of the experiment depends on such sites. The object can be can be obtained by applying `cutGenome` on an appropriate `BSgenome` object.

If `restrict` is supplied, reads will only be extracted for the specified chromosomes. This is useful to restrict the analysis to interesting chromosomes, e.g., no contigs/scaffolds or mitochondria. `restrict` can also be a N-by-2 matrix, specifying N pairs of chromosomes over which read pairs are to be counted.

If `discard` is set, a read will be removed if the corresponding alignment is wholly contained within the supplied ranges. Any pairs involving reads discarded in this manner will be ignored. This is useful for removing unreliable alignments in repeat regions.

If `cap` is set to a non-`NA` value, an upper bound will be placed on the number of read pairs that are counted for each fragment pair (after any removal due to `discard`). This protects against spikes in the read pair density throughout the interaction space. Such spikes may be caused by technical artifacts like PCR duplication or repeats, which were not successfully removed in prior processing steps.

### Constructor

  `pairParam(fragments, discard=GRanges(), restrict=NULL, cap=NA)`: Creates a pairParam object. Each argument is placed in the corresponding slot, with coercion into the appropriate type.

### Subsetting

In the code snippets below, `x` is a pairParam object.

  `x$name`: Returns the value in slot `name`.

### Other methods

In the code snippets below, `x` is a pairParam object.

  `show(x)`: Describes the parameter settings in plain English.

  `reform(x, ...)`: Creates a new pairParam object, based on the existing `x`. Any named arguments in `...` are used to modify the values of the slots in the new object, with type coercion as necessary.

### Author(s)

Aaron Lun

### See Also

`cutGenome`, `squareCounts`

### Examples

    cuts <- readRDS(system.file("exdata", "cuts.rds", package="diffHic"))

    blah <- pairParam(cuts)
    blah <- pairParam(cuts, discard=GRanges("chrA", IRanges(1, 10)))
    blah <- pairParam(cuts, restrict='chr2')
    blah$fragments
    blah$restrict
    blah$cap

    # Use 'reform' if only some arguments need to be changed.
    blah
    reform(blah, restrict='chr3')
    reform(blah, discard=GRanges())
    reform(blah, cap=10)

    # Different restrict options.
    pairParam(cuts, restrict=c('chr2', 'chr3'))
    pairParam(cuts, restrict=cbind('chr2', 'chr3'))
    pairParam(cuts, restrict=cbind(c('chr1', 'chr2'), c('chr3', 'chr4')))

[Package diffHic version 1.24.1 Index]