Search code examples
cytoscape

Select all nodes that are 1 or 3 nodes away from a gene of interest


I am working with a network and as a filter I would like to keep only genes that are related to a specific gene.

How can I select only those genes that are 2 or 3 nodes maximum far from a single node?

Ty


Solution

  • If you select the node in the Cytoscape network view, then hit Control-6 (or Apple-6 on a Mac), you'll select all the first neighbors of that node. Do it again to select all of the first neighbors of those nodes and you'll have selected all of the first and second neighbors of the original node. The same thing can be done by using Cytoscape automation (commands, RCy3, or py2cytoscape), and by the menu using Select->Nodes->First neighbors of selected nodes->Undirected.