How to use Cytoscape for making interaction networks: 6 simple steps
We're back with another Bioinformatics tool, called the Cytoscape, widely used for making gene interaction networks. If you're looking to make something that looks like this, you are at the right place! Woohoo!
Cytoscape is an open-source software platform for visualizing molecular interaction networks and biological pathways and integrating these networks with annotations, gene expression profiles and other state data.
Pre-requisites: What gene network do we want to explore?
In this blog, we will be depicting the interaction of miRNAs, target genes, and the JAK-STAT signaling pathway for in-vivo feline and canine parvovirus (FPV) infection. Therefore, we will be looking to replicate figure 4A in this paper. Awesome right?
Now, not only will we learn how to make the network, but we will also change the colors and shapes of the elements in our networks to make it more interesting, coz that’s always fun right? So, who’s ready? Let’s goooooo!
Just follow me along these six simple steps to get started with your Cytoscape journey!
Step 1- Make the files required to make the networks
Now, before using Cytoscape to replicate the network in figure 4A, we will need to have two types of files -
A matching file:
The matching file will contain all the mapping pairs that we want to show in the network, and essentially, every mapping in figure 4A is depicted by an arrow, and the two species marked by that arrow are put in this file.
For example, the matching_file for figure 4A looks like this -
Notice how the gene and pathway pairs are also mapped since we also want to show that the gene maps to the pathway in the center of the figure.
It’s good to make this mapping in an excel sheet and then save it as a csv file. For this case, I have already made this file, and you can download it from here. Yay!
A name type file:
This file will consist of the names and types of all the different elements that we have in our network, and this is what the file looks like for figure 4A -
Again it is good practice to make this the name_type file a .csv file, and I have already made this file, so you can download it from here. Yay!
Now that we are ready with our prerequisites, i.e, the matching_file.csv and name_type.csv files, let’s go ahead and get started!
Remember: When you’re working on your own personal project using Cytoscape, do have a good look at how these files are made since they are one of the most important and basic aspects of using Cytoscape. Always make your files correctly.
We’re done with Step 1, let’s move to Step 2! Yay!
Step 2- Download the software and install it on your computer
In case you have Cytoscape already downloaded on your system, you can skip this step.
Cytoscape is not a web tool, and you will have to download it to use it. Go to Cytoscape, and download the software for your computer. The software requires Java, and try updating Java for your system, in case the software does not work after the download. Check out this page in case you are facing any more issues.
Once you've downloaded and opened Cytoscape, the window should look something like this:
Yay! Done with Step 2! It was so simple no? Woohoo! Let’s go to Step 3!
Step 3- Load name_type file onto the Cytoscape screen
We will now be using our matching_file.csv and name_type file.csv to plot the networks. Awesome!
Go to the File tab on top of the Cytoscape screen, and hover your arrow on Import in the available options dropdown, you will then find an option to import your ‘Network From File’. Click on that.
Once you have clicked on this option, a pop-up will come up asking you to upload your file, where you need to upload your name_type file.
After you upload your name_type file, you’ll be able to see this screen -
Click on the key symbol near the column heading ‘name’ and change it to the green dot symbol, meaning that this is the source node. Don’t click on OK just yet.
Now, go to the arrow symbol near the column heading ‘type’, and change it to the green note symbol meaning source node attribute.
Once you are done with changing both of these, click on OK.
Click on Yes for this pop-up.
This is what your screen will look like now. Don’t worry about the network, it looks like this since we have added all of the elements in the network, but we haven’t added the mappings yet.
But we are halfway through already! Yay! Let’s go to the next step!
Step 4- Making Cytoscape networks using the matching_file and name_type files
Now that we have all the elements that we will make our network with, on board this awesome ship, hehe, not ship, I meant the Cytoscape screen, hehe, we will go ahead with adding in our matching_file.
We will click on the File tab once again, to go to Import, and choose the ‘Network From File’ option, but we have to ensure that our name_type file is already selected in the Cytoscape screen.
The name_type file will have a blue box around it when it is selected.
This time when we select the ‘Network From File’ option, we need to choose the matching_file. A pop-up box like this will once again appear when we are done choosing our file.
Notice how the Network Collection above mentions name_type.csv since we selected that before importing our matching_file into Cytoscape.
This time we will keep the green dot symbol as it is, but we will change the note symbol near the column heading miRNA/pathway to a target symbol (meaning our target node).
Now click on OK.
Wow! Doesn’t this look great? Our network is here, and though it looks a bit shabby and lacks colors, it still looks cool! Aaand we’re done with this step!
Let’s move on to Step 5!
Step 5- Add colors and styles.
This is the fun step where we’ll add some colors and styles to the network we’ve just made.
1. Place the network elements properly
We will first place our network elements in proper order so that our network does not look this shabby. To move an element, you can just click on the element and then drag it around. The element gets highlighted in yellow when you select it.
Drag the selected elements around to arrange the elements as in figure 4A. You can zoom in or zoom out of the network by using your trackpad.
Wowww! Doesn’t our network look clean and beautiful already? Let’s add some colors now.
2. Adding in the colors
To add colors, go to the complete leftmost side of the Cytoscape screen and you should find a ‘Style’ tab. Click on that to access the color options.
Options like these should appear.
Choose the colors from the ‘Fill Color’ option by clicking on the small arrow at the end of the Fill Color tab.
You should be able to see such options.
In the ‘Column’ option under ‘Fill Color’, click on the faded — — select value — — option (you might have to double click sometimes) and choose ‘type’. This is because we want to color our network elements with different colors, based on if they are a gene, miRNA, or pathway which essentially means their type.
Similarly, for the — — select value — — option for the ‘Mapping Type’, choose ‘Discrete Mapping’. This is what your screen should look like now.
Choose different colors for marking the genes, miRNA, and pathway by clicking the plain white box right side below the Discrete mapping text. You will find a small box with three dots coming up on the right side of the row (Edit Color), you can click that to choose the colors.
You will get an option of colors, and you can choose what you like. I will choose light blue for my genes, light red for my miRNAs, and green for the pathway.
Yay! My network looks sooo beautiful now! Oh, you beauty! ❤
Now, I would like to change the shape of boxes for my genes, miRNAs, and the pathway to make them more distinct. I’ll show you what it looks like, but it’s an assignment for you to change the shape, the hint being that it’s very similar to changing the colors and you can use the Shape option in the Style tab for it. Can you do it? Do let me know in the comments below!
My network looks amazing now! Just one small thing, there are no arrows as in figure 4A! Let’s add the arrows now.
3. Adding the arrows
To add arrows, go to the bottommost part of the screen to find tabs like Node, Edge, Network, and Table. From there, click on ‘Edge’.
Once you click on ‘Edge’, your screen should look like this.
From the ‘Edge’ options, choose ‘Source Arrow Shape’ similar to how we filled in colors, and fill up ‘shared interaction’ and ‘Discrete Mapping’ in Column and Mapping Type respectively.
For the ‘interacts with’ option, choose a ‘Delta Short1’ arrow.
The network will look like this now.
WOW! The network looks absolutely perfect! Absolutely gorgeous! Omg, I wanna export it right now and put it in a publication! Yay Yay Yay!
Awesome work people! A long Step 4 we had, but we are just left with exporting now, and we’ll be done! Woohoo! Let’s go to the last and final step — Step 6!
Step 6- Export your work.
Now that we have a pretty network, we should definitely try exporting it. Go to the File tab on the top and hover on the Export option to find the ‘Network to Image option’, and click on it.
Choose your export file format (png or jpeg or any other), zoom options, file path, name, etc, and then click on OK.
Yay! And we’ve saved our file! Woohoo! Awesome Awesome! This is what it looks like finally!
Isn’t it pretty? Uff, beautiful! Perfect! ❤ I guess hard work really pays off!
Now, do try to play around with Cytoscape to understand it better, and let me know if you’re having any doubts anywhere!
I guess that should be it for today! It is the end of a longgg blogg and congratulations on making it to the end! You’re a hard worker! Keep it up! And thanks for reading!
Citation for the paper: Zhou, Pei & Zhang, Xin & Zeng, Weijie & Zheng, Qingxu & Hao, Xiangqi & Lin, Xi & Zheng, Yun & Wang, Lifang & Zhang, Guihong & Li, Shoujun. (2017). MicroRNA expression analysis of feline and canine parvovirus infection in vivo (felis). PLOS ONE. 12. e0185698. 10.1371/journal.pone.0185698.
Simple.Concise.Precise. That’s the motto.
Note from the Author: Hey there! How you doin’? Hope you enjoyed my writing! Let me know if you liked it! You can always write to me if you want me to write the manual for a particular software, give me a feedback, or even want to reach out regarding anything in general. I’ll be happy! Reach out to me at snippetsbio@gmail.com. Thank you!