Visualizing graphs with LGL and Partiview

Dinoj Surendran, 08/03/04

This is a tutorial on one particular way of visualizing graphs. It uses the LGL algorithm (Adai et al, 2004)) to create a 3d layout of an arbitrary undirected unweighted graph, and Partiview to visualize it.

Input: A single file, call it infile of edges. Two of its columns, the a-th and b-th (the first column is indexed 0, a and b are 0 and 1 by default).

perl makencol.pl infile blah a b

This produces blah.label, which has labels for each node, and blah.ncol. See below for some examples. Now go to the LGL Submission Page. Choose "Coords & Edges in 3d", using gzip if you want, uploading your edge file blah.ncol in ncol format. Then throw in your email address and submit your job.

After some time, LGL sends you an email, with two unnamed files. Call the first noname1 (or noname1.gz, if you asked the data to be given to you in gzip format; in this case you should say "gunzip noname1.gz") and the second noname2(.gz). noname1 contains an edge file, noname2 contains the 3d coordinates of the nodes.

Then say

perl lgl2speck.pl noname2 noname1 blah.label mygraph

This produces mygraph.speck, mygraph_edges.speck and mygraph.label .

Download the file sample.cf and white.cmap and type "partiview sample.cf"

If you don't have partiview on your system, download it from the Hayden Planetarium site.

You'll probably end up looking at a rather blank screen. Pull out, by holding the right mouse button down while moving the mouse down. For instructions on how to navigate in Partiview, click here.

You probably want to change the center of rotation. To do that, find out a good point to rotate around, and click on it and then press p and then SHIFT-p. If you're happy with the rotation, look at the command window or terminal window for the location of the point, and add to the bottom of sample.cf "eval interest x y z", where x y z is whatever your point is.

You probably want to also change the startup location. To do that, find a good point, and then type where. This should produce in the command window and terminal window a long line with "jump ...". Place the line "eval jump ..." at the end of sample.cf (after the "eval interest x y z" command above, if you have one).


Examples of how to use makencol.pl

Example 1

sillyfile is

jamaica adjto barbados
barbados adjto fiji
barbados adjto guyana
fiji adjto samoa

Then saying

perl makencol.pl sillyfile islands 0 2

produces the following files: islands.label is

jamaica
barbados
fiji
guyana
samoa

And islands.ncol is

1 2
2 3
2 4
4 5

Example 2

moronicfile is

0 31
0 14
14 -5
-5 31
14 0

Then saying

perl makencol.pl moronicfile integers 

results in integers.label being

0
31
14
-5

And integers.ncol being

1 2
1 3
3 4
4 2

Note how the repeated edge 14-0 is not represented in integers.ncol because 0-14 already is there.

References

Adai AT, Date SV, Wieland S, Marcotte EM. LGL: creating a map of protein function with an algorithm for visualizing very large biological networks. J Mol Biol. 2004 Jun 25;340(1):179-90