gWalk.subset.Rd
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 gWalk
%&%(x, y)
a gWalk
the subset of gWalks overlapping with the query
subset()
Allows for subsetting of the gWalk Object using bracket notation
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 ''.
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
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.
print()
json()
Dumps walk (and underlying graph) to json file
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.
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
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
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