gWalk.subset | R Documentation |
sets metadata of gWalk object (accessible through $dt accessor)
sets metadata of gWalk object (accessible through $dt accessor)
subset gWalk on overlaps
## S4 method for signature 'gWalk'
x %&% y
x |
a gWalk |
the subset of gWalks overlapping with the query
new()
gWalk$new( snode.id = NULL, sedge.id = NULL, grl = NULL, graph = NULL, meta = NULL, circular = NULL, disjoin = FALSE, drop = FALSE )
set()
gWalk$set(...)
subset()
Allows for subsetting of the gWalk Object using bracket notation
gWalk$subset(i)
dts()
gWalk$dts(ix = 1:self$length, makelists = TRUE)
fix()
Returns a modified version of the gWalk with seqlevels "fixed", including keeping only certain seqlevels, dropping certain seqlevels, and replacing seqlevels.
Warning: this may modify the walks including getting rid of nodes and edges (i.e. those outside the retained seqlevels) and also change coordinates (ie move ranges that were previously on different chromosomes to the same chromosome etc.). Use with caution!
Default behavior is to replace 'chr', with ”.
gWalk$fix(pattern = NULL, replacement = NULL, drop = TRUE, seqlengths = NULL)
pattern
character pattern to replace in seqlevels (used in a gsub, can have backreferences)
replacement
character to replace pattern with (used in a gsub, can have backreferences)
drop
character vector of seqlevels to drop or logical TRUE to drop all seqlevels that are unused (TRUE)
seqlengths
new seqlengths i.e. named integer vector of seqlevels to drop or embed graph into
current graph modified in place with additional nodes and edges, as specified by user
rep()
Creates "bubbles" in the underlying graph by replicating the gwalks. Node replication replicates edges going in and out of all replicated nodes. If an edge connects a pair of replicated nodes that edge will be replicated across all pairs of those replciated nodes. Walk replication will create "longer bubbles" with fewer edges getting replicated i.e. it will only replicate intra-walk edges within each walk replicate (but not between separate walk replicates).
(note that this returns a copy of the gGraph that this node is linked to, i.e. it does not make this gWalk stale)
New graph keeps track of the parent node and edge ids in the original graph using node metadata parent.node.id and edge metadata parent.edge.id i.e. the replicated nodes will be connected to the sources of the original nodes and if replicated nodes connect to each other, then there will exist an edge connecting all of their instances to each other.
gWalk$rep(times)
times
scalar or vector of length self$length specifying how many times to replicate each of the nodes.
nodes
= gNode object must point to a node in the graph, can also be an index of a node (but not a metadata expression), can also be a gWalk object
Returns a pointer to the new nodes
print()
gWalk$print()
json()
Dumps walk (and underlying graph) to json file
gWalk$json( filename = ".", save = TRUE, verbose = FALSE, annotations = NULL, nfields = NULL, efields = NULL, stack.gap = 1e+05, include.graph = TRUE, settings = list(y_axis = list(title = "copy number", visible = TRUE)), cid.field = NULL, no.y = FALSE )
filename
character path to save to
save
whether to save or return list object representing json contents
annotations
which graph annotations to dump to json
nfields
which node fields to dump to json (NULL)
efields
which edge fields to dump to json (NULL)
stack.gap
this currently does not do anything, but is intended to control the spread of intervals on the y-axis
include.graph
if set to TRUE, then the output will include the underlying graph for the gWalk (TRUE)
settings
for details see gGraph json() module
no.y
for details see gGraph json() module
eval()
Evaluates an expression on gWalk node or edge metadata and returns a vector of length length(self) one per walk.
Ideally the expression should generate a scalar value for each walk.id, though will dedup and re-order even if it does not.
gWalk$eval(x, node, edge)
x
data.table style expression on node or edge metadata (will try each)
node
data.table style expresion on node metadata
edge
data.table style expresion on edge metadata
disjoin()
similar to gGraph disjoin but also updates according gWalk and allows disjoining around a set of gRanges, essentially adding "breaks" to the walks and allowing the ranges in those walks to inherit metadata from overlapping GRanges
gWalk$disjoin( gr = NULL, graph = NULL, by = NULL, collapse = TRUE, na.rm = TRUE, avg = FALSE, sep = ",", FUN = default.agg.fun.generator(na.rm = na.rm, sep = sep, avg = avg) )
simplify()
gWalk simplify will merge reference adjacent nodes in walk +/- "by field" (i.e. which requires the nodes to additional match on by field) and simplify the underlying graph.
Note that this only simplifies walks; the associated graph may not be completely simplified since we retain all walk endpoints
gWalk$simplify( by = NULL, na.rm = TRUE, avg = FALSE, sep = ",", FUN = default.agg.fun.generator(na.rm = na.rm, sep = sep, avg = avg) )
mark()
marks the nodes and edges in the graph corresponding to this walk
gWalk$mark(...)
fitcn()
Given gWalks on a graph with node and edge metadata "cn" attempts to find a non-negative integer combination of those walks that generates those walks minimizes the number of unique walks used (L0 norm).
Modifications to this objecti include (default behavior)
if min.alt = TRUE then solution will minimizes the number of
walks that contain an ALT edge. If weight is provided
then the objective function be \sum_i w_i*I[x_i>0]
where
w_i is the provided weight for walk i and I[x_i>0] is indicator
that is 1 if walk i has a nonzero copy number in the solution
and 0 otherwise.
Complains if "cn" is not a metadata of nodes and edges and if the graph is not "balanced" ie either every node cn >= sum(edge cn) for both incoming and outgoing edges.
gWalk$fitcn( trim = TRUE, weight = NULL, obs.mat = NULL, verbose = FALSE, min.alt = TRUE, edgeonly = FALSE, evolve = FALSE, n.sol = 2 )
weight
either a numeric metadata field of self or a self$length integer weight
verbose
logical flag whether to output CPLEX output
min.alt
logical flag whether to make objective function
edgeonly
logical
evolve
logical
n.sol
numeric
logical
flag trim whether to "trim" the graph relative to the footprint of the walks
gtrack()
gWalk$gtrack(name = NULL, stack.gap = 1e+05, ...)
clone()
The objects of this class are cloneable with this method.
gWalk$clone(deep = FALSE)
deep
Whether to make a deep clone.
Marcin Imielinski
Julie Behr
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.