Description Usage Arguments Details Value Author(s) Examples
Use renew
to update an object defined in ShortRead with
new values. Discover update-able classes and values with
renewable
.
1 2 |
x |
For |
... |
For |
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.
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 ...
.
Martin Morgan <mtmorgan@fhcrc.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## 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))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.