[Bio] / Speck / README Repository:
ViewVC logotype

View of /Speck/README

Parent Directory Parent Directory | Revision Log Revision Log

Revision - (download) (annotate) (vendor branch)
Thu Sep 9 19:54:06 2004 UTC (15 years, 2 months ago) by sheradon
Branch: init, MAIN
CVS Tags: v0, HEAD
Changes since 1.1: +0 -0 lines
Initial load to CVS

Larry Sheradon
September 9, 2004

 Included modules:

SpeckCanvas		- Base class for the other various canvases. Doesn't draw or 
	do anything by itself, just sets up windowing, events, etc. that should
	be common to derived canvas classes.

DotCanvas		- Displays Graphviz objects. Constructor takes the parent window
	and the data, which is the string representation of a graph, as in a .dot file.
	Optional color= argument can be given to specify the color scheme; see DotCanvas.py
	for specifics.

*DotViewer		- Run from the command-line, reads the DOT file you give as the argument and
	makes a DotCanvas view on it.
*SpeckRemoteControl	- A standalone wxPython app that provides a mouse/kb input area to remotely
	manipulate a SpeckCanvas (derivative). It uses xmlrpc to send events to the specified
	server (be sure to press "set server" after typing in the hostname of the machine
	running your canvas). It can be run on multiple computers (tablets, PCs, laptops, etc)
	simultaneously, sending input to the same app.

SpeckServer		- Runs an xmlrpc server, listening for events from the above client. If you want
	to use this, pass a serverPort=nnnn parameter to your SpeckCanvas constructor. Otherwise the
	canvas won't run as a server. You needn't interact with anything in this file, really.
Chromium			- Communicates with the Chromium tiled display package to put up one of
	the canvases on a mural. Call display() with the name of the mural, the classname
	of the canvas you want to create, and any arguments to pass to the canvas' constructor.
	At the moment it's only been used/tested with the uM2. The AM probably needs more complicated
	procedures to use the TeraGrid?
	See documentation in Chromium.py for details.

JGLayout (2,3)	- Perform a JGraph layout. JGLayout.layoutDot is what you would use.
	2.py runs via Jython and interacts with the JGraph Java package. 3.java is straight Java and
	implements a custom algorithm in JGraph style.

KPLayout			- A little experimental algorithm based on papers by Karp&Paley and Becker&Rojas.
	Not especially useful... slow and needs more work to give useful results on graphs of any size.

PixFont			- Just allows more reasonable OpenGL text drawing. Scalable (unlike GL's bitmap fonts)
	and perhaps faster? For usage, see documentation in PixFont.py for drawString().

(* signifies executable scripts)

 Some usage examples:

1) As in DotViewer.py, creates a simple wx app that displays the DOTfile specified at cmdline.

	#!/usr/bin/env python

	from Speck.DotCanvas import DotCanvas
	from wxPython.wx import *

	if len(sys.argv) > 1: fn = sys.argv[1]
		print 'Usage: %s <filename.dot>' % sys.argv[0]
	app = wxPySimpleApp()
	win = wxFrame(None, wxID_ANY, 'Speck DOT viewer', size = (640, 480))
	DotCanvas(win, file(fn).read())

2) You can grab the data object and twiddle its attributes while it's being displayed.
	Suppose we want to write an application that shows a graph and updates node or edge labels
	periodically, maybe running a simulation on the side or getting new data. Assume we've
	already opened such a window and canvas, then we might use a function like this...
	def update(dc, src, tgt, label, redrawNow=False):
		"""Changes the label on the edge src->tgt to label.
			Will repaint the canvas immediately if redrawNow is True, otherwise the change will be
			visible on the next OnPaint().
			@type g: DotCanvas
			@type src, tgt: string
			@type rate: string, int, float... anything representable as a string.
		g = dc.dot							# get data object from canvas
		e = g.get_edge(src, tgt)		# grab Edge object
		e.label = str(label)				# set its label attribute
		fred.needUpdate = True			# flag that the next paint should look at the data
		if redrawNow: fred.OnPaint()	

	That is, if you haven't started a wxApp loop... then execution is stuck in there. It shouldn't
	be too hard to figure out a way around this, but here are some ideas:
		a) Put the side calculating stuff inside the wx application, as a button event etc.
		b) Make a subclass of the canvas and put your fancy calculating/updating routines there
		c) Make a thread to do other processing alongside the graphics part (probably dangerous)

 Packages utilized:

Chromium 1.4
 - It's available on oddball2, but not the standard unix
   environment, so I installed for myself. All you need is
	for the-install-dir/bin/Linux to be in your PATH
 - currently in ~sheradon/pax/cr-1.4
 - Note: to display on the uM2 you need to be able to login
   to oddball2.mcs.anl.gov. Running ssh-agent also helps to
	streamline that operation.

Graphviz 1.8.10
 - From AT&T. Very popular graphing package. You'll want
   a proper installation, with the programs (dot, neato, etc)
	available in your PATH.
 - Other, more recent versions are also fine, probably better.

JGraph 5.0 (for Java 1.3) and JGraphAddons 1.0
 - Needed only for the JGLayout modules. 
 - jgraph.jar and jgraphaddons.jar must be in CLASSPATH
 - currently in ~sheradon/pax/jgraph-5.0-java1.3-gpl
           and  ~sheradon/pax/jgraphaddons-1.0

Jython 2.1
 - Needed only for the JGLayout modules.
 - It's a Python interpreter written in Java, which is used
   to interface python to the Java graph layout library JGraph.
 - Just need a running installation, and the "jython" command
   to be available in your PATH.

Pydot 0.9.9
 - pydot.py and dot_parser.py in the Speck/ dir, though it could
   be installed anywhere in the PYTHONPATH.
 - A Python implementation of the Graphviz data structures, &
   interface to its layout stuff.

 - currently in SysBio dirs, for Python 2.3
 - (also in /usr/lib/python2.2/site-packages for 2.2, but we
   aren't using that one)

Pyparsing 1.2
 - used by pydot to parse DOT files.

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3