renew: Renew (update) a ShortRead object with new values

renewableR Documentation

Renew (update) a ShortRead object with new values

Description

Use renew to update an object defined in ShortRead with new values. Discover update-able classes and values with renewable.

Usage


renewable(x, ...)
renew(x, ...)

Arguments

x

For renewable: missing, character(1), or a class defined in the ShortRead package. For renew: an instance of a class defined in the ShortRead package.

...

For renewable, ignored. For renew, named arguments identifying which parts of x are to be renewed.

Details

When invoked with no arguments renewable returns a character vector naming classes that can be renewed.

When invoked with a character(1) or an instance of a ShortRead class, a list of the names and values of the elements that can be renewed. When x is a character vector naming a virtual class, then each element of the returned list is a non-virtual descendant of that class that can be used in renewal. This is not fully recursive.

renew is always invoked with the x argument being an instance of a class identified by renewable(). Remaining arguments are name-value pairs identifying the components of x that are to be renewed (updated). The name-value pairs must be consistent with renewable(x). The resulting object is checked for validity. Multiple components of the object can be updated in a single call to renew, allowing comparatively efficient complex transformations.

Value

renewable() returns a character vector of renewable classes.

renewable(x) returns a named list. The names correspond to renewable classes, and the elements of the list correspond to renewable components of the class.

renew(x, ...) returns an object of the same class as x, but with components of x replaced by the named values of ....

Author(s)

Martin Morgan <mtmorgan@fhcrc.org>

Examples

## discovery
renewable()
renewable("AlignedRead")
renewable("QualityScore") ## instantiable classes

## example data
sp <- SolexaPath(system.file("extdata", package="ShortRead"))
ap <- analysisPath(sp)
filt <- chromosomeFilter("chr[[:digit:]+].fa")
aln <- readAligned(ap, "s_2_export.txt", "SolexaExport",
                   filter=filt)

## renew chromosomes from 'chr1.fa' to 'chr1', etc
labels <- sub("\\.fa", "", levels(chromosome(aln)))
renew(aln, chromosome=factor(chromosome(aln), labels=labels))

## multiple changes -- update chromosome, offset position
renew(aln, chromosome=factor(chromosome(aln), labels=labels),
      position=1L+position(aln))

## oops! invalid instances cannot be constructed
try(renew(aln, position=1:10))


Bioconductor/ShortRead documentation built on Nov. 2, 2024, 4:38 p.m.