gWalk.subset: sets metadata of gWalk object (accessible through $dt...

gWalk.subsetR Documentation

sets metadata of gWalk object (accessible through $dt accessor)

Description

sets metadata of gWalk object (accessible through $dt accessor)

sets metadata of gWalk object (accessible through $dt accessor)

subset gWalk on overlaps

Usage

## S4 method for signature 'gWalk'
x %&% y

Arguments

x

a gWalk

Value

the subset of gWalks overlapping with the query

Methods

Public methods


Method new()

Usage
gWalk$new(
  snode.id = NULL,
  sedge.id = NULL,
  grl = NULL,
  graph = NULL,
  meta = NULL,
  circular = NULL,
  disjoin = FALSE,
  drop = FALSE
)

Method set()

Usage
gWalk$set(...)

Method subset()

Allows for subsetting of the gWalk Object using bracket notation

Usage
gWalk$subset(i)

Method dts()

Usage
gWalk$dts(ix = 1:self$length, makelists = TRUE)

Method 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 ”.

Usage
gWalk$fix(pattern = NULL, replacement = NULL, drop = TRUE, seqlengths = NULL)
Arguments
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

Returns

current graph modified in place with additional nodes and edges, as specified by user


Method 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.

Usage
gWalk$rep(times)
Arguments
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

Returns a pointer to the new nodes


Method print()

Usage
gWalk$print()

Method json()

Dumps walk (and underlying graph) to json file

Usage
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
)
Arguments
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


Method 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.

Usage
gWalk$eval(x, node, edge)
Arguments
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


Method 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

Usage
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)
)

Method 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

Usage
gWalk$simplify(
  by = NULL,
  na.rm = TRUE,
  avg = FALSE,
  sep = ",",
  FUN = default.agg.fun.generator(na.rm = na.rm, sep = sep, avg = avg)
)

Method mark()

marks the nodes and edges in the graph corresponding to this walk

Usage
gWalk$mark(...)

Method 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.

Usage
gWalk$fitcn(
  trim = TRUE,
  weight = NULL,
  obs.mat = NULL,
  verbose = FALSE,
  min.alt = TRUE,
  edgeonly = FALSE,
  evolve = FALSE,
  n.sol = 2
)
Arguments
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


Method gtrack()

Usage
gWalk$gtrack(name = NULL, stack.gap = 1e+05, ...)

Method clone()

The objects of this class are cloneable with this method.

Usage
gWalk$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Author(s)

Marcin Imielinski

Julie Behr


mskilab/gGnome documentation built on May 8, 2024, 4:25 p.m.