Added by Mingxun Wang, last edited by Laura Pace on Jul 24, 2015  (view change)


Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.

Cytoscape 2.8.X Analysis of Molecular Networks

Cytoscape is a powerful tool for the visualization and analysis of complex networks. This documentation will describe how to utilize Cytoscape to visualize and analyze network data produced from the Molecular Networking workflow of GNPS.

The details presented in this section will apply only to  . Refer to the section entitled [Network Visualization and Analysis utilizing Cytoscape 3.2.X] for documentation on using Cytoscape 3.2.X.

File Data

Prior to Cytoscape analysis, the Molecular Networking workflow must be completed. To perform molecular networking, follow the guide here. To download the output files, click here.

The downloaded data will be a zip file that contains several folders.

For Cytoscape analysis, the following folders are of most interest:

Folder Name Description
networkedges Network Topology File, describing similarity (edges) between spectra (nodes)
- Each node has at least one neighbor connected by an edge
Network Topology File, describing similarity (edges) between spectra (nodes)
- Allows individual nodes without neighbors to be viewed
Node metadata file. Describes the spectra
- Used with data that did not include library search
clusterinfosummarygroup_attributes_withIDs Node metadata file. Describes the spectra
- Used with data that included a library search
Node metadata file. Describes the spectra
- Used with data that included attribute mapping

A single Cytoscape input file is inside each of the folders listed.

Input Network Topology into Cytoscape

For the remainder of this document, a sample dataset, molecular network and cytoscape output will be used.  This document assumes Cytoscape has been downloaded, installed and opened.

Dataset/Molecular Network: click here

Cytoscape Output: click here

Import the network topology file from the networkedges folder or the networkedges_selfloop folder.

Click File->Import->Network From Table. Select the file within the networkedges folder. A new window will appear.

To properly import the topology file:

For "Source Interaction" choose "Column 1" (purple)

- column 1 is a list of nodes labeled by node index number

For "Target Interaction" choose "Column 2" (orange)

- column 2 is the list of neighboring nodes to column 1

To activate "Column 3" left-click on the column name (it will turn blue). Right-click and rename "Column 3" to "deltaMZ"

- this is the mass difference between two neighboring nodes.

To activate "Column 5" left-click on the column name (it will turn blue). Right-click and rename "Column 5" to "Cosine"

- this is the cosine score between two neighboring nodes.

Your view will look like this:

Importing will yield a default unorganized network:

Applying Layouts

Currently the preferred layout plugin is called FM3. To install this plugin refer to this documentation.

To apply the layout, click Layout->Cytoscape Layouts->FM3 Layout.

The resulting layout will look similar to this:

Changing Default Appearance

Click the VizMapper tab.

Click the Defaults window shown below to apply changes to the entire network.

A new window will open.
This window can be used to change the default values for the network's nodes, edges and global settings such as background color.

After applying the changes to default appearance, the network will look something like this:

Import Node Attributes

Now that a the basic network topology is visualized in Cytoscape, attributes containing metadata about each node or edge have to be imported.

Import the attributes file from the clusterinfosummarygroup_attributes_withIDs_arbitraryattribute folder.

Click File->Import->Attribute From Table. Select the file within the clusterinfosummarygroup_attributes_withIDs_arbitraryattribute folder. A new window will appear.

There are a variety of attributes that can be imported into Cytoscape. To enable or disable an attribute column for import, left click on the column.

If a column is checked and has black text, it will be imported.  If a column has an X and has gray text, it will NOT be imported.

Key attributes are:

Attribute Description
Cluster Index
Corresponds to the cluster index in the molecular networking data within GNPS
All Files
Original data file and scan number of the node's constituent spectra
Default Groups*
The default groups of the node's spectra, comma separated
Precursor Mass/
Parent Mass
Precursor/ parent mass of the node's constituent spectra
ProteoSAFeClusterLink url to view the node's constituent spectra in GNPS
Mean retention time of the node's constituent spectra

*If you are using group mapping, you should import AllGroups instead of default groups

**If you are using attribute mapping, you should also import the columns corresponding to your attribute names.

To label your column headers, click the Show Text File Import Options box. 
Under Attribute Names, click the Transfer first line as attribute names box.

Click Import.

To show all attributes in the Cytoscape Data Panel click:

If you import attributes that you do not want to show in the Data Panel, they can be hidden.
Click Select Attributes (left most button in Data Panel). A new window will appear.  Uncheck any attribute you do not want to show.

Applying Visualizations To Attributes

In this next section, suggestions for visualization of attributes within cytoscape are suggested.  While the use of some visualizations are strongly encouraged (parent mass, cosine score), other visualizations are up to the user.  Users should explore how different Cytoscape settings change overall network visualization.

Follow the directions to visualize the attributes below.  If the visualization does not appear in the network, click View and then Show Graphics Details.

Parent Mass

The easiest way to identify nodes with m/z values of interest is to label the nodes with the precursor mass.

To label the nodes, click the VizMapper tab in the Control Panel.

In the Visual Mapping Browser, choose Node Label.  In the dropdown list, choose parent mass (default setting is ID). 

Under Mapping Type, choose Passthrough Mapping.

Cosine Score

To visualize difference in cosine values between network pairs, the thickness of the edges is used. The thicker the edge line is, the higher the cosine score.

To adjust the edge thickness, click the VizMapper tab in the Control Panel.

In the Visual Mapping Browser, choose Edge Line Width. In the drop-down list, choose Cosine

Under Mapping Type, choose Continuous Mapping.

A new window will open.  Edge line width is the y-axis and the cosine score in the x-axis.  Adjust the empty red boxes to change the edge width thickness. Click OK to apply the settings.

In this example, low cosine values have a edge line width approaching zero, while high cosine values have an edge line width approaching 30.


When the Molecular Networking workflow was performed for this example, the spectra were divided into two groups:

G1 contains MS/MS spectra files from a crude sample. G2 contains MS/MS spectra file of standards (purified compounds of known structure).

To visualize these groups, node color is used. 

In the Visual Mapping Browser, choose Node Color.  In the dropdown list, choose DefaultGroups

Under Mapping Type, choose Discrete Mapping. Select colors for each group.

This will color the network appropriately, with nodes corresponding to the crude sample (G1) in red, nodes corresponding to standards (G2) in blue, and nodes with spectra from both the crude sample and standard in green (G1, G2). 

Mass Difference Between Two Nodes

To help aid in structural elucidation of nodes within a cluster, it may be helpful to know the mass difference between the nodes.

The edges are labeled to visualized the mass difference between two nodes. 

In the Visual Mapping Browser, choose Edge Label.  In the dropdown list, choose delta MZ

Under Mapping Type, choose Passthrough Mapping.

Cluster Showing Full Visualization of Attributes

After all attributes are correctly loaded, a cluster of related nodes should appear similar to this:

Exploring Nodes of Interest in GNPS

If there are nodes of interest, users can highlight the node to view certain attributes of each node. As shown here:

The yellow nodes have been selected. To quickly view the spectra that make up a node in the network, users can view spectra in GNPS through the attribute ProteoSAFeClusterLink.

To do this, right click on the link and choose Open this URL in a browser.

This will open a webpage as shown below. Further instructions on navigating the GNPS results can be found here.