Back to Download Form
Cavity Find/Molecule View example
Surface View and Database
Initial Results from Automated Surface Searches
Some code highlights from Glutp of more general interest.

Glut demo- interactive data and molecule viewer

The following discussion is a bit confusing as I had originally wanted to make a simple glut program to view data, got distrcted making it into a molecule viewer, and then finally needed the data viewer. So, the discussion is a bit mixed but hopefully the example will be clear. I'm not entirely sure the world needs another data or molecule viewer but the benefit for me is that the source code is available and fairly simple. :)
For comparison, you may be interested in these things too:

R Data Analysis Program
Rasmol molecule viewer
NIST Dataplot
NCBI Cn3D

...etc...

This is a Glut demo program that contains functionality for vieweing pdb files ( some samples were included with the distro ) as well as real time model data from ad hoc sources. None of the functionality is particularly superior to known pacakges ( for example, the molecule viewer is almost as good as rasmol but not competitive with much else) but has been useful for me for a variety of test and development activities ( the molecule viewer, for example, has some cavity code as well as other test code. This doesn't form a comprehensive capability for the user, but has been helpful for examining cavity filling strategies).

The general user interface from the molecule viewer can be adapted and expanded for user interaction with a variety of data sources that generate 3D models. I have used this to examine wavelet processing ideas on survival data and only developed the display code to the point of allowing this task to proceed. The skeletons exist for more complicated models from real time data sources ( but the glut update is rather slow right now, not sure how this compete with alternatives). The user interface allows normal manipulation (zoom,rotate, etc) of the 3D model (molecule system or ad hoc data points) as well as output( bmp or jpeg) and scripting ( see samples) allowing automated production of many images ( limited image processing right now could allow automated zoom-to-fill for example).

The stats_test program in particular makes use of a computational package I downloaded ( see credits below) and the source code contains additional credits beyond those in the "-about" output. Note that MOST OF THIS CODE IS IN SKELETON FORM and ONLY the stuff I needed was debugged and verified.

For example, this command ( line breaks may be bad) generated random data and continually produced graphs with the last 500 data points color coded to determine if the source program was accurately classifying them. Awk is used to adapt the data source to match the format of streaming_data which accepts lines containing either raw points ( size, location, color ) or text commands with appropriate parameters:

  ./stats_test -statistic wavelet_sep -disp_interval 1000 -ok_limit 0 -p_limit .95 -m1 1.2 -n1 250 -n2 250 -graphic exp -effect1 1 -effect2 5 | grep -v [a-z] |\
  awk ' { if ((1+$8) != ( $1 +0) ) {print "3 "$2*500" "$7*200" " l3*00" 1 "$8" " 0;}else {print "3 "$2*500" "$7*200" "l3*0" 1 "1" "1 ;} l3=l2; l2=last; last=$1; }' |\
  ./streaming_data  -history 500 -leader stleader.txt  -config print.src

The files input to streaming_data add various things to the plot ( that could have also been accomplished by the stats_test program or awk injecting them into stdin ):

$ cat stleader.txt
LINE 0 0 0 0 1000 0 1
PUSHCOLOR 1 0 0
LINE 0 0 0 1000 0 0 1
PUSHCOLOR 1 1 0
TEXT 0 0 0 10 hi there

The second file, print.src which is longer and show completely at bottom of this page, contains a script to "print" two bmp images of the original plot and a second plot which has been resized to automatically fit the screen. Note that, once various trigger commands are implemented, this could be used to automatically create a photogallery of images for later human or automated analysis.

The original image, naively produced and then autoresized

Help and About output from the programs :

 $ ./stats_test
    Usage: stats_test
     Generate various survival curves.
     This is monte carlo code designed to do brute force simulation of various
     clinical trial scenarios. It was written specifically to examine a trial
     from Dendreon, but I have generalized it somewhat and used it to test the
     related program 'streaming_data' that can visualize data generated in real time.
     It is designed to be simplistic and adpatable by source code additions and not
     to be completely general for user in current form.
     Note that, unfortunately, this cmd parser doesn't report errors, use this to check:
     -DEBUG : turn on cmd parse diagnostics for subsequent parameter reads
    -n1 N : number in group 1
    -n2 N : number in group 2
    -m1 N : slope of group 1
    -m2 N : slope for group 2
    -events N: limit statistic to first N events
    -disp_interval N : trials per display ( which can be slow)
    -ok_limit N : threshold on test statistic
      Contact: marchywka@hotmail.com, Mike Marchywka 2008

Administrator@TESTBED01 /cygdrive/e/new/glutp/glutp/glutp
$ ./stats_test -about
    Mike Marchywka, 2008. Uses code from various source, mostly described below.

     Originally developed using cygwin.
     References:
      Ref:The Versatility of Function-indexed Weighted Log-rank Statistics MR. Kosorok, Chin-Yu Lin Jrnl ASA.
      Ref:http://citeseer.ist.psu.edu/124967.html
      Ref:Log-rank explained:
      Ref:http://www.ms.uky.edu/~mai/research/LogRank2006.pdf
      Ref: Kleinbaum and Klein, Survival Analysis a Self-learning text, page 65:
      Ref:http://books.google.com/books?id=GNhzxRkFnJ0C&pg=PA65&lpg=PA65&dq=wilcoxon+log+rank&source=web&ots=Z27qYizj31&sig=SSZvyQmJjRDW8aZkiIgtaPPhXSI&hl=en#PPA66,M1
      Ref:Stat disctirutions from here:
      Ref:http://people.scs.fsu.edu/~burkardt/cpp_src/dcdflib/dcdflib.html
      Ref:http://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/ranksum.htm
      Ref:http://www.okstate.edu/sas/v7/sashtml/books/stat/chap34/sect13.htm
      Ref:http://www.stat.auckland.ac.nz/~wild/ChanceEnc/Ch10.wilcoxon.pdf
      Ref:http://www-stat.stanford.edu/~susan/courses/s141/hononpara.pdf
      Ref:http://www.pubmedcentral.nih.gov/articlerender.fcgi?artid=1065034
      Ref:http://www.nature.com/bmt/journal/v28/n10/full/1703260a.html
      Ref:http://www.sta.cuhk.edu.hk/pschan/Courses/STA4008/lecture/set3.pdf

Administrator@TESTBED01 /cygdrive/e/new/glutp/glutp/glutp
$

The "print.src" file referenced above

$ cat print.src |unix2dos >/dev/clipboard
SCRIPT help
SCRIPT print,mysnap.bmp,bmp
#note that nesting doesn't work right
#SCRIPT source,./cf/src.mike
#SCRIPT source,./cf/loop.mike

# demo the center and zoom capability
SCRIPT $sub,center
SCRIPT label1:
SCRIPT screen,bounds=x
SCRIPT $let,marginh,$screenheight-100
SCRIPT $let,marginw,$screenwidth-100
SCRIPT $let,dy,(0-$x[0]-$x[2]+$screenheight)/4
SCRIPT $let,dx,(0-$x[1]-$x[3]+$screenwidth)/4
SCRIPT $echo,$dx
SCRIPT $echo,$dy
SCRIPT move,$dx,$dy
SCRIPT $let,sm,0
SCRIPT $if,label2,($x[0]-$x[2])>$marginh
SCRIPT $if,label2,($x[1]-$x[3])>$marginw
SCRIPT $let,sm,1
SCRIPT zoom,100
SCRIPT label2:
SCRIPT $if,label3,(($x[0]-$x[2])<($marginh+30))&(($x[1]-$x[3])<($marginw+30))
SCRIPT $let,sm,1
SCRIPT zoom,-62
SCRIPT label3:
SCRIPT $if,label1,($dx,>10,)|($dx<-10)|($dy>10)|($dy<-10)
SCRIPT $if,label1,$sm
SCRIPT prop,0,centroid=a
SCRIPT rotcen,$a[0],$a[1],$a[2]
SCRIPT $end
#set rotation center
SCRIPT $sub,rott
SCRIPT prop,0,centroid=a
SCRIPT rotcen,$a[0],$a[1],$a[2]
SCRIPT $end

#SCRIPT $call,center

SCRIPT source,./center.src


#SCRIPT print,myzoom.bmp,bmp