I would like to visualize this interaction list. Is there an online/web based way to do it? Is there a way to analyze the data?
Assuming I have exported the list into lines such as:
2 A2M 348 APOE
I would like to visualize this interaction list. Is there an online/web based way to do it? Is there a way to analyze the data?
Assuming I have exported the list into lines such as:
2 A2M 348 APOE
since I am not yet allowed to comment, I will have to pots this as an answer.
I guess Cytoscape (http://cytoscape.org/) would be a nice way to analyse such interaction lists/networks (still depends a bit on what you plan to do).
However, for this you will have to preprocess the downloadable excel sheet a bit.
python3 script.py <path-to-tsv-file> <delimeter for cytoscape>
. The new format is written to std out on the console, therefore maybe you need to write the output to a new file. A sample call could look like python3 testbench.py human_interactome_2017-06-12.tsv.csv ";"
. Make sure to add the delimeter in quotes.Code below:
import sys
HIIIidx = 4
HII5idx = 5
venkatesanidx = 6
yuidx = 7
Litidx = 8
print(sys.argv)
if len(sys.argv) <= 1:
print("Usage: script.py file delimeter")
delim = ';'
inFile = sys.argv[1]
if len(sys.argv) > 2:
delim = sys.argv[2]
def printInteraction(syma, symb, inter):
print(syma + delim + inter + delim + symb)
with open( inFile , 'r') as file:
file.readline()
for line in file:
aline = line.strip('\n').split('\t')
if aline[HIIIidx] == '1':
printInteraction(aline[1], aline[3], 'HIII')
if aline[HII5idx] == '1':
printInteraction(aline[1], aline[3], 'HII5')
if aline[venkatesanidx] == '1':
printInteraction(aline[1], aline[3], 'VEN')
if aline[yuidx] == '1':
printInteraction(aline[1], aline[3], 'YU')
if aline[Litidx] == '1':
printInteraction(aline[1], aline[3], 'LIT')
lineCount
counter, if you want to skip the first line you can do: with open(inFile, "r") as my_file: my_file.readline(); for line in my_file:
. The readline
will advance to the file to its next line. It is considered best practice to open a file inside a with
context manager.
$\endgroup$
aline = line.strip("\n").split("\t")
, since you don't re-use the modified line
(and I would call this variable fields
rather than aline
).
$\endgroup$
Your list has two identifiers for the same node per line. In order to use it, you will need to change that. If you want to use the gene name (2nd and 4th fields, in your example), just run:
awk 'print $2,$4' netw.txt > netw.gr
If you want to use the Entrez geneIDs instead, run:
awk 'print $1,$3' netw.txt > netw.gr
Then, as others already mentioned, install Cytoscape
, launch it and import your gene list:
In the welcome screen, select "From Network File...":
Then, select your network file (netw.gr
in the example above) and choose "Advanced Options":
Set the delimiter to SPACE and uncheck "Use first line as column names":
Finally, click on the header of each column and set the first to "source node" and the second to "target node":
Now, click "OK" and you will have successfully imported your network into Cytoscape.
Usually interactions are represented in a graph, with edges representing the interactions (colors, thickness or values on the edges represent different properties of those edges).
As far as I know, there aren't on line programs to represent this kind of information. For an off line representation, you can use the igraph package in R, or Cytoscape program.
Several have mentioned the excellent Cytoscape desktop package for visualising interactions as a graph. If you want to build your own web-based visualisations (rather than using a pre-built website to visualise them) then the Cytoscape javascript library might fulfil your needs.