setters: Functions to set interaction data

Description Usage Arguments Value Examples

Description

Use these functions to set data stored in the slots of a GenomicInteractions object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
name(GIObject) <- value

interactionCounts(GIObject) <- value

## S4 replacement method for signature 'GenomicInteractions'
name(GIObject) <- value

## S4 replacement method for signature 'GenomicInteractions,ANY'
description(object) <- value

## S4 replacement method for signature 'GenomicInteractions'
interactionCounts(GIObject) <- value

## S4 replacement method for signature 'GenomicInteractions'
seqinfo(x, new2old = NULL,
  pruning.mode = c("error", "coarse", "fine", "tidy")) <- value

Arguments

GIObject

A GenomicInteractions object

value

A vector to replace a slot in the object

object

Object, possibly derived from class eSet-class.

x

The object from/on which to get/set the sequence information.

new2old

The new2old argument allows the user to rename, drop, add and/or reorder the "sequence levels" in x.

new2old can be NULL or an integer vector with one element per row in Seqinfo object value (i.e. new2old and value must have the same length) describing how the "new" sequence levels should be mapped to the "old" sequence levels, that is, how the rows in value should be mapped to the rows in seqinfo(x). The values in new2old must be >= 1 and <= length(seqinfo(x)). NAs are allowed and indicate sequence levels that are being added. Old sequence levels that are not represented in new2old will be dropped, but this will fail if those levels are in use (e.g. if x is a GRanges object with ranges defined on those sequence levels) unless a pruning mode is specified via the pruning.mode argument (see below).

If new2old=NULL, then sequence levels can only be added to the existing ones, that is, value must have at least as many rows as seqinfo(x) (i.e. length(values) >= length(seqinfo(x))) and also seqlevels(values)[seq_len(length(seqlevels(x)))] must be identical to seqlevels(x).

pruning.mode

When some of the seqlevels to drop from x are in use (i.e. have ranges on them), the ranges on these sequences need to be removed before the seqlevels can be dropped. We call this pruning. The pruning.mode argument controls how to prune x. Four pruning modes are currently defined: "error", "coarse", "fine", and "tidy". "error" is the default. In this mode, no pruning is done and an error is raised. The other pruning modes do the following:

  • "coarse": Remove the elements in x where the seqlevels to drop are in use. Typically reduces the length of x. Note that if x is a list-like object (e.g. GRangesList, GAlignmentPairs, or GAlignmentsList), then any list element in x where at least one of the sequence levels to drop is in use is fully removed. In other words, when pruning.mode="coarse", the seqlevels setter will keep or remove full list elements and not try to change their content. This guarantees that the exact ranges (and their order) inside the individual list elements are preserved. This can be a desirable property when the list elements represent compound features like exons grouped by transcript (stored in a GRangesList object as returned by exonsBy( , by="tx")), or paired-end or fusion reads, etc...

  • "fine": Supported on list-like objects only. Removes the ranges that are on the sequences to drop. This removal is done within each list element of the original object x and doesn't affect its length or the order of its list elements. In other words, the pruned object is guaranteed to be parallel to the original object.

  • "tidy": Like the "fine" pruning above but also removes the list elements that become empty as the result of the pruning. Note that this pruning mode is particularly well suited on a GRangesList object that contains transcripts grouped by gene, as returned by transcriptsBy( , by="gene"). Finally note that, as a convenience, this pruning mode is supported on non list-like objects (e.g. GRanges or GAlignments objects) and, in this case, is equivalent to the "coarse" mode.

See the "B. DROP SEQLEVELS FROM A LIST-LIKE OBJECT" section in the examples below for an extensive illustration of these pruning modes.

Value

GenomicInteractions object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
anchor.one = GRanges(c("chr1", "chr1", "chr1", "chr1"), 
     IRanges(c(10, 20, 30, 20), width=5))
anchor.two = GRanges(c("chr1", "chr1", "chr1", "chr2"), 
     IRanges(c(100, 200, 300, 50), width=5))
interaction_counts = sample(1:10, 4)
test <- GenomicInteractions(anchor.one, anchor.two, 
     metadata=list(experiment_name="test", description="this is a test"),
     counts=interaction_counts)
metadata(test)

name(test) <- "Mouse test"
name(test)

description(test) <- "This is a test using the mouse genome"
description(test)

interactionCounts(test) <- c(2,3,8,5)
interactionCounts(test)

LTLA/fugi documentation built on June 22, 2019, 8:50 p.m.