Let’s Increase the Difficulty
The programs discussed in this section will require a few more steps, but the customization control is worth it. These programs are the reason the csv is structured in a particular way. They also require more data. The spreadsheets are linked here again for convenience: Nodes and Edges. These programs will allow you to customize the network and to do some deeper analysis.
Cytoscape is an open source software that is predominately used for bioinformatics. On this website you can also download plugins through their app store. We will be discussing the upload, customizations, and export of the network. If you desire further knowledge, then Cytoscape’s tutorial and manual are a recommended starting point. First you will need to download. Note that you will need to have Java Runtime Environment installed on your computer before Cytoscape will install; if you do not, you will be prompted to download it. Once you have completed the installation and opened Cytoscape, you will see a screen like the one below:
The easiest way to upload your file will be to drag to the box that says “drag network files here” on the left. Once it is uploaded, a window like the one below will appear, where you will assign each column to a particular “meaning.” As in the picture below, this drop down menu will appear for each column. The point of this step is to tell Cytoscape what type of data each column contains.
The edges spreadsheet for Cytoscape is very similar to what is needed for Palladio and Connect the Dots. It is necessary to discuss the slight differences now, so it will make sense on how to match the “meanings” for each column once it is uploaded into Cytoscape. The edges sheet is structured particularly for this program. This is the only program where the interaction column, or relationship, needs to be defined in words, not a quantitative value. The other programs mentioned on this page do not need the interaction column. The interaction column is the word associated with that particular weight. So for example, if you give a weight of 1 to represent a friend, 1 would be in the weight column while “friend” would be in the interaction column. After dragging your data into Cytoscape, it will ask you to verify that Cytoscape has labeled your columns correctly, illustrated above. What is meant by that is, Cytoscape reads the column headers in your csv, and it tries to match up the “meanings” it needs. It knows though that it can be wrong sometimes depending on the column header, thus it gives you the opportunity to confirm and or correct its assumptions. Based on the edges sheet that the DigiLab has provided, this table below will tell you how to match them up. It is recommended that you at least structure your edges sheet similar to our template because Cytoscape only needs a max of 6 “meanings.” The first column will be your spreadsheet columns and the right will be the corresponding “meaning.” If you have more in this file, it will display all columns but there can only be one Source, Target, and Interaction. The rest will have to be some attribute or not imported. Cytoscape specifically does not require IDs, so the Source and Target columns will be classified as the “Not Imported” meaning. The way you know which meaning icon is which, just hover the cursor over the icon and the name should pop up. This is also illustrated in the picture above as well.
|Headers in the edges template
||Corresponding Cytoscape “meaning”
Once all of the meanings are assigned, Cytoscape will build the network. It will be a generic looking network to start with. The next step will to customize. So the first step is to analyze the network. At the top of cytoscape, go to Tools → Analyze Network and check the box to treat network as directed. Now that we have the network data, we can use it to customize our network before it is exported. This may open up a separate window or a different section on your current window of Cytoscape. This can be predominantly ignored for we are only concerned with customizing and most of that data would be useful for bioinformatics networks. On the control panel there are going to be 4 steps to sizing the nodes by centrality. The steps are displayed below:
- To customize your network, the style tab on the far left must be selected.
- Since we are trying to size the nodes, make sure you are on the nodes tab at the bottom. Here is where you can also color the nodes and customize other features as well.
- Next, this drop-down menu is for certain styles. Play around and figure out which one suits you the best.
- Click on the arrow next to size. Set Column to betweenness centrality and Mapping Type to discrete mapping to assign each centrality its own size. You could also choose continuous as your mapping and cytoscape will proportion the sides of the nodes to the best it can. Sometimes the leaf nodes (the ones usually with 0 centrality) might be too small. In that case discrete is the way to go so you can control the difference in sizes.
- If you decided to choose discrete mapping, then here is where you will insert the sizes (in the box to the right of each value). 10 is a good starting spot for the 0s. From there try to scale according to the difference in centrality. It is needed to know that if the difference is small between two different centralities, it might not be necessary to treat them as a different centrality. Completely up to you, just play around with them and see what looks the best for your graph.
For coloring the edges by interaction type:
- Make sure you are on the edges tab.
- Select Color or Stroke Color. Choose “interaction” and “discrete mapping.”
- For each interaction type, select the color you want for the edge.
Now that your network is scaled and colored, it is easier to see just by looking at the network who is connected to more clusters than leaf nodes (betweenness centrality) and the different relationships between the nodes. Remember it is one-directional, so just because there is a friend edge between two nodes, that does not mean that both consider each other friends. There could be two separate edges connecting to two nodes. They could be the same color or different, either could be expected. Now depending on your network, cytoscape might have clustered it together or not. Once you are finished customizing the design, all that is needed to spread the network out is to locate the layout button on the top menu. From there, there are some different layouts that cytoscape offers, but the best for these types of projects will be Apply preferred layout in the layout menu.
Exporting from cytoscape can go two different ways. First, it can export as a normal picture file. If you do this step, then make sure that the entire network is viewable in the window before clicking on these buttons File → Export as Image. Cytoscape can also export the network as a webpage File → Export as a webpage and make sure you have the simple viewer for current layout before you select OK on the export popup window. What this provides is a zip file that will need to be extracted. Once it is extracted, it is your basic html layout and easily embeddable into your webpage.
The image below illustrates the type of visual that you can generate in Cytoscape. For another example of network analysis in action, you can also check out Mina Loy’s social network!