How to select subnetworks, or regions, with a certain number of nodes or edges with RCy3
1
1
Entering edit mode
David R ▴ 90
@david-rengel-6321
Last seen 3 days ago
European Union

network obtained from the chunk below

Hi,

In R-controlled Cytoscape, I would like to select nodes within regions with more than two nodes OR more than one edge. With the code below, nodes 1, 4 and 5 get selected. My goal is to select only nodes 4 and 5 (see image).

Any help would be greatly appreciated. Thanks!

David

library(RCy3)
nodes <- data.frame(
  id = c("node 0","node 1","node 2","node 3", "node 4", "node 5"),
  stringsAsFactors = FALSE)

edges <- data.frame(
  source = c("node 0","node 0","node 0","node 2", "node 4"),
  target = c("node 1","node 2","node 3","node 3", "node 5"),
  stringsAsFactors = FALSE)

createNetworkFromDataFrames(nodes, edges, title = "test")

createDegreeFilter(
  filter.name = 'degree filter',
  criterion = c(2,3),
  predicate = 'IS_NOT_BETWEEN')
Network RCy3 • 1.1k views
ADD COMMENT
0
Entering edit mode
alex.pico ▴ 30
@alexpico-15339
Last seen 11 weeks ago
United States

If I understand correctly, you want to select all binary pairs of connected nodes. Here's one approach, basically, select the nodes your DON'T want and then inverse selection:

library(RCy3)
nodes <- data.frame(
  id = c("node 0","node 1","node 2","node 3", "node 4", "node 5"),
  stringsAsFactors = FALSE)

edges <- data.frame(
  source = c("node 0","node 0","node 0","node 2", "node 4"),
  target = c("node 1","node 2","node 3","node 3", "node 5"),
  stringsAsFactors = FALSE)

createNetworkFromDataFrames(nodes, edges, title = "test")

createDegreeFilter(
  filter.name = 'degree filter',
  criterion = c(1,1),
  predicate = 'IS_NOT_BETWEEN')

selectFirstNeighbors()

invertNodeSelection()
ADD COMMENT

Login before adding your answer.

Traffic: 479 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6