copy

copy

flip

terminal

Author

Joe DeRose

Marcin Imielinski

Methods


Method new()

Set up the constructor GNODE index - snode.id graph

Usage

gNode$new(snode.id = NULL, graph)

Arguments

snode.id

signed node id

graph

gGraph associated with this sNode


Method mark()

Marks the nodes pointed at by this gNode by adding metadata in the gGraph they came from. Metadata names can be arbitrary, such as "lwd = 7" or "highlight = TRUE". gGraph nodes have metadata specified appended to them

Usage

gNode$mark(...)

Arguments

...

metadata names = data to store in metadata columns

...

name = value pairs of scalar or vector (length edges in graph) arguments ```

Details

``` gg$nodes[1:5]$mark(col = "purple") gg$nodes$mark(changed = FALSE)


Method rep()

Creates "bubbles" in the graph by replicating the nodes in the argument. 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).

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

gNode$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 swap()

Swap nodes with granges, grl, or Gwalks. Provided replacement vector must be the same length as the inputted nodes, resulting in each node being "swapped" by the provided interval, node, grl (representing a walk), or gWalk. The replacement will inherit left and right edges for the removed node. If the replacement is a walk, then the left side of the first node in the walk will inherit the edges that were previously to the left of the node being replaced, and right side of the last node of the walk will inherit the edges that were previously to the right of the node being replaced.

Note: these replacement obey the orientation of the arguments. So if the node to be replaced is flipped (- orientation with respect to the reference, then it's "left" is to the right on the reference. Similarly for walks whose first interval is flipped with respect to the reference, the left edges will be attached to the right of the node on the reference.)

Usage

gNode$swap(replacement)

Arguments

replacement

GRanges, GRangesList, or gWalk object whose length is the length(nodes)

Returns

gGraph (also modified in place) with nodes annotated with parent.node.id, parent.rep


Method subset()

Allows subseting of the Node object using bracket notation

Usage

gNode$subset(i)

Arguments

i

integer or logical index

Returns

subset of nodes indexed by i


Method eval()

Evaluates expression over edge metadata for all nodes in self with a keyby node.id returning a self$length vector

Usage

gNode$eval(x, right = TRUE, all = FALSE)

Arguments

x

expression over edge metadata value for "cluster"


Method clusters()

Marks nodes in graph with metadata field $cluster based on one of several algorithms, selected by mode.

Unlike the gGraph version of this function, this usage enables computation of clusters based on a subset of nodes in the graph (i.e. ignoring certain nodes) while still marking the original graph (and leaving the excluded graph with an NA) value for "cluster"

Usage

gNode$clusters(mode = "weak")

Arguments

weak

character scalar that can take one of the following possible values - "weak" or "strong" specifying weakly or strongly connected components, walktrap specifying cluster_walktrap community detection

weak

character scalar that can take one of the following possible values - "weak" or "strong" specifying weakly or strongly connected components, walktrap specifying cluster_walktrap community detection


Method ego()

returns all nodes with k degrees of separation (i.e. "order") from these

Usage

gNode$ego(order = 0, mindist = 0)

Arguments

order

integer edge distance from these (seed) nodes to return

mindist

minimum distance from these (seed) nodes

Returns

gNode object comprising nodes within the ego of this node


Method print()

Prints out the gNode Object. Prints the length and the GRanges of the nodes.

Usage

gNode$print()


Method loose.degree()

Usage

gNode$loose.degree(orientation)

Arguments

orientation

(character) one of 'left' or 'right'

Returns

number of loose ends with given orientation


Method clone()

The objects of this class are cloneable with this method.

Usage

gNode$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.