Restore deleted binary files.

This commit is contained in:
cjmyers 2016-07-04 19:26:47 +00:00
parent c671a0288d
commit b8083c718f
38 changed files with 6305 additions and 0 deletions

5
bin/ATACSGUI.bat Executable file
View file

@ -0,0 +1,5 @@
setlocal ENABLEDELAYEDEXPANSION
set CLASSPATH="%ATACSGUI%\gui\dist\classes"
for /f %%a IN ('dir /b "%ATACSGUI%\gui\lib\*.jar"') do call set CLASSPATH=!CLASSPATH!;"%ATACSGUI%\gui\lib\%%a"
java -Xmx2048M -Xms2048M -XX:+UseSerialGC -classpath %CLASSPATH% main.Gui -atacs

11
bin/ATACSGUI.linux Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
export LD_LIBRARY_PATH=$ATACSGUI/lib:$LD_LIBRARY_PATH
CLASSPATH=$ATACSGUI/gui/dist/classes
for jarFile in $ATACSGUI/gui/lib/*.jar
do
CLASSPATH=$CLASSPATH:$jarFile
done
exec java -Xmx2048M -Xms2048M -XX:+UseSerialGC -classpath $CLASSPATH main.Gui -atacs

11
bin/ATACSGUI.linux64 Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
export LD_LIBRARY_PATH=$ATACSGUI/lib64:$LD_LIBRARY_PATH
CLASSPATH=$ATACSGUI/gui/dist/classes
for jarFile in $ATACSGUI/gui/lib/*.jar
do
CLASSPATH=$CLASSPATH:$jarFile
done
exec java -Xmx2048M -Xms2048M -XX:+UseSerialGC -classpath $CLASSPATH main.Gui -atacs

12
bin/ATACSGUI.mac Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
#
# run-time wrapper for BioSim gui
export DYLD_LIBRARY_PATH=$ATACSGUI/lib:$DYLD_LIBRARY_PATH
CLASSPATH=$ATACSGUI/gui/dist/classes
for jarFile in $ATACSGUI/gui/lib/*.jar
do
CLASSPATH=$CLASSPATH:$jarFile
done
exec java -Xmx2048M -Xms2048M -XX:+UseSerialGC -classpath $CLASSPATH -Dapple.laf.useScreenMenuBar=true -Xdock:name="ATACSGUI" -Xdock:icon=$ATACSGUI/gui/icons/ATACS.png main.Gui -atacs

14
bin/ATACSGUI.mac64 Executable file
View file

@ -0,0 +1,14 @@
#!/bin/sh
#
# run-time wrapper for BioSim gui
export ATACSGUI=/Applications/ATACS.app/Contents/Resources
export PATH=$ATACSGUI/bin:$PATH
export DYLD_LIBRARY_PATH=$ATACSGUI/lib64:$DYLD_LIBRARY_PATH
CLASSPATH=$ATACSGUI/gui/dist/classes
for jarFile in $ATACSGUI/gui/lib/*.jar
do
CLASSPATH=$CLASSPATH:$jarFile
done
exec java-Xmx2048M -Xms2048M -XX:+UseSerialGC -classpath $CLASSPATH -Dapple.laf.useScreenMenuBar=true -Xdock:name="ATACSGUI" -Xdock:icon=$ATACSGUI/gui/icons/ATACS.png main.Gui -atacs

BIN
bin/GeneNet Executable file

Binary file not shown.

6
bin/LEMA.bat Normal file
View file

@ -0,0 +1,6 @@
setlocal ENABLEDELAYEDEXPANSION
set CLASSPATH="%LEMA%\gui\dist\classes"
for /f %%a IN ('dir /b "%LEMA%\gui\lib\*.jar"') do call set CLASSPATH=!CLASSPATH!;"%LEMA%\gui\lib\%%a"
java -Xmx2048M -Xms2048M -XX:+UseSerialGC -classpath %CLASSPATH% main.Gui -lema

11
bin/LEMA.linux Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
export LD_LIBRARY_PATH=$LEMA/lib:$LD_LIBRARY_PATH
CLASSPATH=$LEMA/gui/dist/classes
for jarFile in $LEMA/gui/lib/*.jar
do
CLASSPATH=$CLASSPATH:$jarFile
done
exec java -Xmx2048M -Xms2048M -XX:+UseSerialGC -classpath $CLASSPATH main.Gui -lema

11
bin/LEMA.linux64 Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
export LD_LIBRARY_PATH=$LEMA/lib64:$LD_LIBRARY_PATH
CLASSPATH=$LEMA/gui/dist/classes
for jarFile in $LEMA/gui/lib/*.jar
do
CLASSPATH=$CLASSPATH:$jarFile
done
exec java -Xmx2048M -Xms2048M -XX:+UseSerialGC -classpath $CLASSPATH main.Gui -lema

12
bin/LEMA.mac Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
#
# run-time wrapper for BioSim gui
export DYLD_LIBRARY_PATH=$LEMA/lib:$DYLD_LIBRARY_PATH
CLASSPATH=$LEMA/gui/dist/classes
for jarFile in $LEMA/gui/lib/*.jar
do
CLASSPATH=$CLASSPATH:$jarFile
done
exec java -Xmx2048M -Xms2048M -XX:+UseSerialGC -classpath $CLASSPATH -Dapple.laf.useScreenMenuBar=true -Xdock:name="LEMA" -Xdock:icon=$LEMA/gui/icons/LEMA.png main.Gui -lema

12
bin/LEMA.mac64 Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
#
# run-time wrapper for BioSim gui
export DYLD_LIBRARY_PATH=$LEMA/lib64:$DYLD_LIBRARY_PATH
CLASSPATH=$LEMA/gui/dist/classes
for jarFile in $LEMA/gui/lib/*.jar
do
CLASSPATH=$CLASSPATH:$jarFile
done
exec java -Xmx2048M -Xms2048M -XX:+UseSerialGC -classpath $CLASSPATH -Dapple.laf.useScreenMenuBar=true -Xdock:name="LEMA" -Xdock:icon=$LEMA/gui/icons/LEMA.png main.Gui -lema

BIN
bin/MSVCRT.DLL Normal file

Binary file not shown.

12
bin/andrew Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
#
# run-time wrapper for BioSim gui
export DYLD_LIBRARY_PATH=$LEMA/lib64:$DYLD_LIBRARY_PATH
CLASSPATH=$LEMA/gui/dist/classes
for jarFile in $LEMA/gui/lib/*.jar
do
CLASSPATH=$CLASSPATH:$jarFile
done
exec java -Xmx2048M -Xms2048M -XX:+UseSerialGC -classpath $CLASSPATH -Dapple.laf.useScreenMenuBar=true -Xdock:name="LEMA" -Xdock:icon=$LEMA/gui/icons/LEMA.png verification.timed_state_exploration.zoneProject.Conolse7_26_2012

102
bin/apply_post_filter.pl Executable file
View file

@ -0,0 +1,102 @@
#!/usr/bin/perl
if ($#ARGV != 3){
print "Usage: ./recheck_results.pl cutoff file_method_dot file_correct.dot file_output\n";
exit(1);
}
my $cutoff = $ARGV[0];
my $outfile = $ARGV[3];
check_correctness($ARGV[1], $ARGV[2]);
sub check_correctness{
my $filename = shift;
my $dot_file = shift;
open (IN1, "$dot_file") or die "I cannot check dot correctness for $dot_file\n";
open (IN2, "$filename") or die "I cannot check correctness for $filename\/method.dot\n";
open (OUT, ">$outfile") or die "I cannot write the checked file\n";
my @in1 = <IN1>;
my @in2 = <IN2>;
close IN1;
close IN2;
my $in1 = join ("",@in1);
my $in2 = join ("",@in2);
$in1 =~ s/sp_//g;
$in2 =~ s/sp_//g;
print OUT "digraph G {\n";
#generate the states in the corrected output
for (my $i = 0; $i <= $#in2; $i++){
if ($in2[$i] =~ m/shape=ellipse/){
print OUT $in2[$i];
}
}
my $r_c = 0;
my $r_t = 0;
#check precision
while ($in1 =~ m/s([0-9]+) -> s([0-9]+) .+arrowhead=((vee|tee))/g){
$r_t++;
my $state1 = $1;
my $state2 = $2;
my $arc = $3;
#print "I matched $state1 $arc $state2\n";
if ($in2 =~ m/s$state1 -> s$state2 .*arrowhead=$arc/){
$r_c++;
}
}
print "\tRecall: $r_c/$r_t = '" . $r_c/$r_t . "'\n";
my $p_c = 0;
my $p_t = 0;
#check precision
while ($in2 =~ m/s([0-9]+) -> s([0-9]+) (.+), *arrowhead=((vee|tee))/g){
$p_t++;
my $state1 = $1;
my $state2 = $2;
my $mid = $3;
my $arc = $4;
my $remove_arc = 0;
#print "I matched $state1 $arc $state2\n";
if ($mid =~ m/label=\"[-]*([0-9]+[.]*[0-9]*)/){
my $num = $1;
$num = (int (10000 * $num)) / 10000;
# $mid =~ m/(label=\"[-]*)[0-9]+[.]*[0-9]*/$1$num/;
if ($num < $cutoff){
$mid =~ s/color=\"[^\"]+/color=\"green/;
$remove_arc = 1;
}
}
if (not $remove_arc){
#WE DO NOT NEED TO CHECK THIS AT THIS STAGE
# if ($in1 =~ m/s$state1 -> s$state2 .*arrowhead=$arc/){
# $p_c++;
print OUT "s$state1 -> s$state2 $mid,arrowhead=$arc]\n";
# }
# else{
# print OUT "s$state1 -> s$state2 $mid,arrowhead=$arc,style=dashed]\n";
# }
}
}
if ($p_t > 0){
print "\tPrecision: $p_c/$p_t = '" . $p_c/$p_t . "'\n";
}
else{
print "\tPrecision: $p_c/$p_t = '0'\n";
}
print OUT "\n}\n";
close OUT;
return ($r_c,$r_t,$p_c,$p_t);
}

BIN
bin/atacs Executable file

Binary file not shown.

955
bin/autogenT.py Normal file
View file

@ -0,0 +1,955 @@
#!/usr/bin/python
##############################################################################
## Copyright (c) 2007 by Scott R. Little
## University of Utah
##
## Permission to use, copy, modify and/or distribute, but not sell, this
## software and its documentation for any purpose is hereby granted
## without fee, subject to the following terms and conditions:
##
## 1. The above copyright notice and this permission notice must
## appear in all copies of the software and related documentation.
##
## 2. The name of University of Utah may not be used in advertising or
## publicity pertaining to distribution of the software without the
## specific, prior written permission of University of Utah.
##
## 3. THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
## EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
## WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
##
## IN NO EVENT SHALL UNIVERSITY OF UTAH OR THE AUTHORS OF THIS SOFTWARE BE
## LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES
## OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
## OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON
## ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE
## OR PERFORMANCE OF THIS SOFTWARE.
##
##############################################################################
### TODO ###
#Provide a method to specify different numbers of thresholds for different variables?
#Use properties to aid in the threshold generation?
#Update genBins to use the partial results list
#Add a brief comment regarding how to add optimization and cost functions
import re, os.path, cText, copy, sys
from optparse import OptionParser
#Regular expressions
lQuoteR = re.compile("\"+")
tQuoteR = re.compile("\"+")
numVarsR = re.compile("Variables: ")
numPointsR = re.compile("Points: ")
spaceR = re.compile("\s+")
lSpaceR = re.compile("^\s+")
tSpaceR = re.compile("\s+$")
lineSpaceR = re.compile("^\s+$")
newLR = re.compile("\n+")
lDotR = re.compile("^\.\w")
epsilonR = re.compile(".epsilon")
lengthR = re.compile(".length")
timeR = re.compile(".time")
absoluteTimeR = re.compile(".absoluteTime")
percentR = re.compile(".percent")
inputR = re.compile(".inputs")
outputR = re.compile(".outputs")
dmvcR = re.compile(".dmvc")
rateSamplingR = re.compile(".rateSampling")
pathLengthR = re.compile(".pathLength")
vaRateUpdateIntervalR = re.compile(".vaRateUpdateInterval")
minDelayValR = re.compile(".minDelayVal")
minRateValR = re.compile(".minRateVal")
minDivisionValR = re.compile(".minDivisionVal")
decPercentR = re.compile(".decPercent")
minVarValR = re.compile(".minVarVal")
maxVarValR = re.compile(".maxVarVal")
falseR = re.compile("false",re.I) #pass the I flag to be case insensitive
trueR = re.compile("true",re.I) #pass the I flag to be case insensitive
binCommentR = re.compile("^\#")
lParenR = re.compile("\\(+")
rParenR = re.compile("\\)+")
rowsR = re.compile("\\(.*?\\)")
##############################################################################
# A class to hold the lists of places and transitions in the graph.
##############################################################################
class Variable:
"A continuous variable in the system being modeled."
def __init__(self,nameStr):
self.name = nameStr #the name of the variable
self.dmvc = None #Boolean denoting the status of the variable as a discrete multi-valued continuous (DMVC) variable
self.input = None #Boolean denoting that the variable is a model input
self.output = None #Boolean denoting that the variable is a model output
self.type = None #Describes the type of the variable using an enumerated type (VOLTAGE, CURRENT) which is needed by Verilog-A.
def __str__(self):
retStr = self.name+"["
if self.dmvc:
retStr = retStr + "1]"
else:
retStr = retStr + "0]"
return retStr
## End Class Variable ########################################################
##############################################################################
# A class to hold the parameters specified in the threshold (.bins) file.
##############################################################################
class ThresholdParameters:
"The parameters possibly specified in the thresholds (.bins) file."
def __init__(self,numVars):
#Default values
self.epsilon = 0.1 #What is the +/- epsilon where signals are considered to be equivalent
self.length = 15 #the number of time points that a value must persist to be considered constant
self.time = 5e-6 #the amount of time that must pass to be considered constant when using absoluteTime
self.absoluteTime = False #when False time points are used to determine DMVC and when true absolutime time is used to determine DMVC
self.percent = 0.8 #a decimal value representing the percent of the total trace that must be constant to qualify to become a DMVC var
self.numValuesL = [] #the number of constant values for each variable...-1 indicates that the variable isn't considered a DMVC variable
self.vaRateUpdateInterval = 1e-6 #how often the rate is added to the continuous variable in the Verilog-A model output
for i in range(numVars):
self.numValuesL.append(-1)
def __str__(self):
retStr = "epsilon:"+str(self.epsilon)+" length:"+str(self.length)+" numValuesL:"+str(self.numValuesL)
return retStr
############################################################################
# Determine if two values are equal within the given epsilon.
############################################################################
def epsilonEquiv(self,v1,v2):
if abs(v1-v2) <= self.epsilon:
return True
else:
return False
## End Class ThresholdParameters #############################################
##############################################################################
# A class for data required for the discovery of discrete multi-valued
# continuous variables.
##############################################################################
class DMVCpart:
"Information about a single run of a constant value."
numDMVCparts = 0
def __init__(self):
self.id = DMVCpart.numDMVCparts #unique numeric ID for each run
DMVCpart.numDMVCparts = DMVCpart.numDMVCparts + 1
self.varInd = -1 #an index into the varsL array denoting which variable owns the run
self.valueL = [] #the list of values for this run
self.startPoint = -1 #an index into datL for the start point of the run
self.endPoint = -1 #an index into datL for the end point of the run
self.nextRun = None #a reference to the next sequential run
def __str__(self):
retStr = "Part:"+str(self.id)+" Start:"+str(self.startPoint)+" End:"+str(self.endPoint)+" Val:"+str(self.constVal())
if self.nextRun:
retStr += " Next:"+str(self.nextRun.id)
else:
retStr += " Next:None"
return retStr
############################################################################
# Calculate the constant value from the value list. Currently it is an
# average of all list values.
############################################################################
def constVal(self):
total = 0
for i in self.valueL:
total = total + i
return total/float(len(self.valueL))
############################################################################
# Calculate the delay for a given DMVC run.
############################################################################
def calcDelay(self,datL):
ind1 = self.startPoint
ind2 = self.endPoint
delay = datL[ind2][0]-datL[ind1][0]
#Assuming that there is some time between runs we want to account for that time. If we assume a constant rate of change we can just split the difference
if self.nextRun:
ind3 = self.nextRun.startPoint
delay += ((datL[ind3][0]-datL[ind2][0])/2)
return delay
## End Class DMVCpart ########################################################
##############################################################################
# Remove leading & trailing space as well as trailing new line characters.
##############################################################################
def cleanLine(line):
lineNS = re.sub(lSpaceR,"",line)
lineNL = re.sub(newLR,"",lineNS)
lineTS = re.sub(tSpaceR,"",lineNL)
return lineTS
##############################################################################
# Remove leading & trailing space as well as trailing new line characters.
##############################################################################
def cleanName(name):
nameNL = re.sub(lQuoteR,"",name)
nameTS = re.sub(tQuoteR,"",nameNL)
return nameTS
##############################################################################
# Creates a 2 dimensional array of lists rows x cols with each value
# initialized to initVal.
##############################################################################
def create2Darray(rows,cols,initVal):
newL = []
for i in range(rows):
initL = []
for j in range(cols):
initL.append(initVal)
newL.append(initL)
return newL
##############################################################################
# Create the list of variables. All data files must have the same variables
# in the same order.
##############################################################################
def extractVars(datFile):
varsL = []
line = ""
inputF = open(datFile, 'r')
rowsL = inputF.read()
rowsM = rowsR.match(rowsL)
row = rowsM.group()
varNames = cleanRow(row)
varNamesL = varNames.split(",")
for varStr in varNamesL:
varStr = cleanName(varStr)
varsL.append(Variable(varStr))
varsL[0].dmvc = False
inputF.close()
return varsL
##############################################################################
# Parse a .dat file ensuring that the varsL matches the global list.
##############################################################################
def parseDatFile(datFile,varsL):
inputF = open(datFile, 'r')
linesL = inputF.read()
rowsL = rowsR.findall(linesL)
for i in range(len(rowsL)):
rowsL[i] = cleanRow(rowsL[i])
numPoints = -1
varNames = cleanRow(rowsL[0])
varNamesL = []
varNamesL = varNames.split(",")
for i in range(len(varNamesL)):
varNamesL[i] = cleanName(varNamesL[i])
numPoints = len(varNamesL)
if len(varNamesL) == len(varsL):
for i in range(len(varNamesL)):
if varNamesL[i] != varsL[i].name:
cStr = cText.cSetFg(cText.RED)
cStr += "ERROR:"
cStr += cText.cSetAttr(cText.NONE)
print cStr+" Expected "+varsL[i].name+" in position "+str(i)+" but received "+varNamesL[i]+" in file: "+datFile
sys.exit()
else:
cStr = cText.cSetFg(cText.RED)
cStr += "ERROR:"
cStr += cText.cSetAttr(cText.NONE)
print cStr + " Expected "+str(len(varsL))+" variables but received "+str(len(varNamesL))+" in file: "+datFile
sys.exit()
datL = []
for i in range(1,len(rowsL)):
valStrL = cleanRow(rowsL[i]).split(",")
valL = []
for s in valStrL:
valL.append(float(s))
datL.append(valL)
inputF.close()
return datL, numPoints
##############################################################################
# Parse the .bins (thresholds) file.
##############################################################################
def parseBinsFile(binsFile,varsL):
global pathLength
global rateSampling
global minDelayVal
global minRateVal
global minDivisionVal
global decPercent
global minVarValL
global maxVarValL
global limitExists
minVarValL = []
maxVarValL = []
limitExists = False
for i in range(len(varsL)):
minVarValL.append(None)
maxVarValL.append(None)
if not os.path.isfile(binsFile):
cStr = cText.cSetFg(cText.RED)
cStr += "ERROR:"
cStr += cText.cSetAttr(cText.NONE)
print cStr+" the .bins file, "+binsFile+" was not found."
sys.exit()
inputF = open(binsFile, 'r')
linesL = inputF.readlines()
tParam = ThresholdParameters(len(varsL))
divisionsStrL = []
numDivisions = 0
for i in range(1,len(varsL)):
divisionsStrL.append([])
for i in range(len(linesL)):
#Allow blank lines and comments
if lineSpaceR.match(linesL[i]) or binCommentR.match(linesL[i]):
continue
if lDotR.match(linesL[i]):
if epsilonR.match(linesL[i]):
epsilonL = spaceR.split(linesL[i])
tParam.epsilon = abs(float(epsilonL[1]))
elif lengthR.match(linesL[i]):
lengthL = spaceR.split(linesL[i])
tParam.length = float(lengthL[1])
elif timeR.match(linesL[i]):
timeL = spaceR.split(linesL[i])
tParam.time = float(timeL[1])
elif vaRateUpdateIntervalR.match(linesL[i]):
vaRateUpdateIntervalL = vaRateUpdateIntervalR.split(linesL[i])
tParam.vaRateUpdateInterval = float(vaRateUpdateIntervalL[1])
elif absoluteTimeR.match(linesL[i]):
absoluteTimeL = spaceR.split(linesL[i])
if trueR.match(absoluteTimeL[1]):
tParam.absoluteTime = True
elif falseR.match(absoluteTimeL[1]):
tParam.absoluteTime = False
else:
cStr = cText.cSetFg(cText.RED)
cStr += "ERROR:"
cStr += cText.cSetAttr(cText.NONE)
print cStr+" Attempted to set .absoluteTime with"+absoluteTimeL[i]+" which is unrecognized. It was not set. Please use True or False."
sys.exit()
elif percentR.match(linesL[i]):
percentL = spaceR.split(linesL[i])
tParam.percent = float(percentL[1])
elif inputR.match(linesL[i]):
cLine = cleanLine(linesL[i])
inputL = spaceR.split(cLine)
for i in range(1,len(inputL)):
found = False
for j in range(1,len(varsL)):
if inputL[i] == varsL[j].name:
#print varsL[j].name+" is an input."
varsL[j].input = True
found = True
break
if not found:
cStr = cText.cSetFg(cText.RED)
cStr += "ERROR:"
cStr += cText.cSetAttr(cText.NONE)
print cStr+" "+inputL[i]+" was specified as an input in the .bins file, but wasn't found in the variable list."
sys.exit()
elif outputR.match(linesL[i]):
cLine = cleanLine(linesL[i])
outputL = spaceR.split(cLine)
for i in range(1,len(outputL)):
found = False
for j in range(1,len(varsL)):
if outputL[i] == varsL[j].name:
#print varsL[j].name+" is an output."
varsL[j].output = True
found = True
break
if not found:
cStr = cText.cSetFg(cText.RED)
cStr += "ERROR:"
cStr += cText.cSetAttr(cText.NONE)
print cStr+" "+outputL[i]+" was specified as an output in the .bins file, but wasn't found in the variable list."
sys.exit()
elif dmvcR.match(linesL[i]):
cLine = cleanLine(linesL[i])
dmvcL = spaceR.split(cLine)
outputL = spaceR.split(cLine)
for i in range(1,len(dmvcL)):
found = False
for j in range(1,len(varsL)):
if outputL[i] == varsL[j].name:
#print varsL[j].name+" is dmvc."
varsL[j].dmvc = True
found = True
break
if not found:
cStr = cText.cSetFg(cText.RED)
cStr += "ERROR:"
cStr += cText.cSetAttr(cText.NONE)
print cStr+" "+outputL[i]+" was specified as dmvc in the .bins file, but wasn't found in the variable list."
sys.exit()
elif rateSamplingR.match(linesL[i]):
rateSamplingL = spaceR.split(linesL[i])
rateSampling = int(rateSamplingL[1])
elif pathLengthR.match(linesL[i]):
pathLengthL = spaceR.split(linesL[i])
pathLength = int(pathLengthL[1])
elif minDelayValR.match(linesL[i]):
minDelayValL = spaceR.split(linesL[i])
minDelayVal = int(minDelayValL[1])
elif minRateValR.match(linesL[i]):
minRateValL = spaceR.split(linesL[i])
minRateVal = int(minDelayValL[1])
elif minDivisionValR.match(linesL[i]):
minDivisionValL = spaceR.split(linesL[i])
minDivisionVal = int(minDelayValL[1])
elif decPercentR.match(linesL[i]):
decPercentL = spaceR.split(linesL[i])
decPercent = int(decPercentL[1])
elif minVarValR.match(linesL[i]):
limitExists = True
cLine = cleanLine(linesL[i])
inputL = spaceR.split(cLine)
found = False
for i in range(1,len(varsL)):
if inputL[2] == varsL[i].name:
minVarValL[i] = inputL[1]
found = True
break
if not found:
cStr = cText.cSetFg(cText.RED)
cStr += "ERROR:"
cStr += cText.cSetAttr(cText.NONE)
print cStr+" "+inputL[2]+" was specified in a target for .minVarVal in the .bins file, but wasn't found in the variable list."
sys.exit()
elif maxVarValR.match(linesL[i]):
limitExists = True
cLine = cleanLine(linesL[i])
inputL = spaceR.split(cLine)
found = False
for i in range(1,len(varsL)):
if inputL[2] == varsL[i].name:
maxVarValL[i] = inputL[1]
found = True
break
if not found:
cStr = cText.cSetFg(cText.RED)
cStr += "ERROR:"
cStr += cText.cSetAttr(cText.NONE)
print cStr+" "+inputL[2]+" was specified in a target for .maxVarVal in the .bins file, but wasn't found in the variable list."
sys.exit()
else:
cStr = cText.cSetFg(cText.RED)
cStr += "ERROR:"
cStr += cText.cSetAttr(cText.NONE)
print cStr+" Unparseable dot option in the thresholds file: "+linesL[i]
sys.exit()
else:
numDivisions += 1
cLineL = cleanLine(linesL[i]).split(" ")
found = False
for j in range(1,len(varsL)):
if cLineL[0] == varsL[j].name:
divisionsStrL[j-1] = cLineL[1:]
found = True
break
if not found:
#cStr = cText.cSetFg(cText.RED)
cStr = "ERROR:"
#cStr += cText.cSetAttr(cText.NONE)
print cStr+" Variable not included in the data file."
print "Line: "+linesL[i]
sys.exit()
divisionsL = [[]]
for sL in divisionsStrL:
fL = []
for s in sL:
if (s.find("?") == -1):
fL.append(float(s))
else:
fL.append(s)
divisionsL.append(fL)
#print len(fL)
inputF.close()
if numDivisions != len(varsL)-1:
cStr = cText.cSetFg(cText.RED)
cStr += "WARNING:"
cStr += cText.cSetAttr(cText.NONE)
print cStr+" There is not a threshold for every variable in the dat file."
#sys.exit()
#print "divisionsL:"+str(divisionsL)
return divisionsL, tParam
##############################################################################
# Remove leading and trailing parantheses
##############################################################################
def cleanRow(row):
rowNS = re.sub(lParenR,"",row)
rowTS = re.sub(rParenR,"",rowNS)
return rowTS
##############################################################################
# Reorder the datL so each row is a list of data values for the ith
# variable. Also build a list of the extreme values for each
# variable.
##############################################################################
def reorderDatL(varsL):
datValsL = []
datValsExtremaL = []
for i in range(len(varsL)):
datValsL.append([])
datValsExtremaL.append([])
i = 1
while 0==0:
try:
datFile = "run-" + str(i) + ".tsd"
datL,numPoints = parseDatFile(datFile,varsL)
for j in range(len(varsL)):
for k in range(len(datL)):
datValsL[j].append(datL[k][j])
for j in range(1,len(varsL)):
datValsExtremaL[j] = (min(datValsL[j]),max(datValsL[j]))
except:
break
i += 1
return datValsL, datValsExtremaL
##############################################################################
# Explore a potential DVMC run. If the run is valid (currently this
# means long enough) then return the run. Else return None.
##############################################################################
def exploreRun(datL,i,j,tParam):
run = DMVCpart()
run.startPoint = i
run.varInd = j
run.valueL.append(datL[i][j])
while i+1 < len(datL) and tParam.epsilonEquiv(datL[run.startPoint][j],datL[i+1][j]):
run.valueL.append(datL[i+1][j])
i = i+1
#print "i:"+str(i)+" j:"+str(j)
run.endPoint = i
if not tParam.absoluteTime:
if ((run.endPoint-run.startPoint)+1) < tParam.length:
#print "Run is too short from "+str(run.startPoint)+" to "+str(run.endPoint)+" ["+str((run.endPoint-run.startPoint)+1)+"]"
return None, i
else:
#print "Found a run from "+str(run.startPoint)+" to "+str(run.endPoint)+"["+str((run.endPoint-run.startPoint)+1)+"]"
return run, i
else:
if run.calcDelay(datL) < tParam.time:
#print "Run is too short from "+str(run.startPoint)+" to "+str(run.endPoint)+" ["+str(run.calcDelay(datL))+"]"
return None, i
else:
#print "Found a run from "+str(run.startPoint)+" to "+str(run.endPoint)+" ["+str(run.calcDelay(datL))+"]"
return run, i
##############################################################################
# Determine which variables should be considered multi-valued
# continuous variables. Marks varsL[i].dmvc for DMVC variables and
# returns a list of valid DMVC runs varsL long. Empty lists exist for
# non-DMVC places and lists of valid runs are present for DMVC
# variables.
##############################################################################
def findDMVC(datL,varsL,tParam):
tempRun = None
prevRun = None
runL = []
for j in range(len(varsL)):
runL.append([])
if varsL[j].dmvc != False:
#print "Examining variable["+str(j)+"]: "+varsL[j].name
mark = 0
for i in range(len(datL)-1):
if i < mark:
continue
if tParam.epsilonEquiv(datL[i][j],datL[i+1][j]):
#print "Exploring from:"+str(i)
tempRun,mark = exploreRun(datL,i,j,tParam)
#print "Returning at:"+str(mark)
if tempRun != None:
if len(runL[j]) > 1:
prevRun.nextRun = tempRun
prevRun = tempRun
runL[j].append(tempRun)
#determine if a high enough percentage of the run is constant
if not tParam.absoluteTime:
numPoints = 0
for run in runL[j]:
#print "run:"+str(run)
#print "runDelay:"+str(run.calcDelay(datL))
numPoints += (run.endPoint-run.startPoint) + 1
if (numPoints/float(len(datL))) < tParam.percent:
#print "Clearing runs for "+varsL[j].name+" ["+str(numPoints/float(len(datL)))+"]"+str(numPoints)+"/"+str(len(datL))
runL[j] = [] #clear the runs if they don't meet the percentage requirement
else:
#print varsL[j].name+" is a DMVC. ["+str(numPoints/float(len(datL)))+"]"
varsL[j].dmvc = True
else:
absTime = 0.0
for run in runL[j]:
#print "run:"+str(run)
#print "runDelay:"+str(run.calcDelay(datL))
absTime += run.calcDelay(datL)
if (absTime/(datL[len(datL)-1][0]-datL[0][0])) < tParam.percent:
#print "Clearing runs for "+varsL[j].name+" ["+str(absTime/(datL[len(datL)-1][0]-datL[0][0]))+"]"+str(absTime)+"/"+str(datL[len(datL)-1][0]-datL[0][0])
runL[j] = []
else:
#print varsL[j].name+" is a DMVC. ["+str(absTime/(datL[len(datL)-1][0]-datL[0][0]))+"]"
varsL[j].dmvc = True
#return runL for processing during the graph building
return runL
##############################################################################
# Create an initial set of divisions based upon the number of bins and
# the extreme values for each variable. These initial bins are
# evenly spaced.
##############################################################################
def initDivisionsL(datValsExtremaL,varsL,divisionsL):
#divisionsL = []
#for i in range(len(varsL)):
# divisionsL.append([])
for i in range(1,len(varsL)):
print varsL[i]
#print "i:"+str(i)+" "+str(datValsExtremaL[i])
interval = float(abs(datValsExtremaL[i][1]-datValsExtremaL[i][0]) / (numThresholds+1))
#print "interval:"+str(interval)
for j in range(0,len(divisionsL[i])):
if (divisionsL[i][j] == "?"):
divisionsL[i][j] = datValsExtremaL[i][0]+(interval*j)
return divisionsL
##############################################################################
# Generate the bin encoding for each data point given the divisions.
##############################################################################
def genBins(datL,divisionsL):
#print "datL:"+str(datL)
#print "divisionsL:"+str(divisionsL)
binsL = create2Darray(len(divisionsL),len(datL[0]),-1)
for i in range(1,len(divisionsL)):
for j in range(len(datL[0])):
for k in range(len(divisionsL[i])):
if (datL[i][j] <= divisionsL[i][k]):
binsL[i][j] = k
break
else:
#handles the case when the datum is in the highest bin
#i.e. for 2 boundary numbers 3 bins are required
#print "binsL["+str(i)+"]["+str(j)+"] = "+str(k+1)
binsL[i][j] = k+1
#print "binsL:"+str(binsL)
return binsL
##############################################################################
# Determine if two bins are equivalent and return a Boolean.
##############################################################################
def equalBins(a,b,binsL,divisionsL):
for i in range(1,len(divisionsL)):
if binsL[i][a] != binsL[i][b]:
return False
return True
##############################################################################
# Generate the rates for each data point given the bin encodings.
##############################################################################
def genRates(divisionsL,datL,binsL):
#Function notes: Rates can be calculated based on transitions or places. If rates are calculated based on places they are calculated based on the change in the bin for the entire line. If rates are calculated based on transitions they are calculated based on the change in the bin for each variable. These two methods have different results and it appears that place based rates are more stable. To help "smooth" out the rates there are several ways to modify the rate calcualation. One way is to change the rateSampling variable. This variable determines how long the bin must remain constant before a rate is calculated for that bin. It can be a numerical value or "inf." The "inf" setting only calculates the rate once per bin change. You can invalidate bin changes of short length using the pathLength variable. Any run of consecutive bins shorter than pathLength will not have its rate calculated. The rate is also only calculated if the time values differ for the two points as I have seen examples where this is a problem.
ratesL = create2Darray(len(divisionsL),len(datL[0]),'-')
if placeRates:
#Place based rate calculation
if rateSampling == "inf":
mark = 0
for i in range(len(datL[0])):
if i < mark:
continue
while mark < len(datL[0]) and equalBins(i,mark,binsL,divisionsL):
mark += 1
if datL[0][mark-1] != datL[0][i] and (mark-i) >= pathLength:
for j in range(1,len(divisionsL)):
ratesL[j][i] = (datL[j][mark-1]-datL[j][i])/(datL[0][mark-1]-datL[0][i])
else:
for i in range(len(datL[0])-rateSampling):
calcRate = True
for k in range(rateSampling):
if not equalBins(i,i+k,binsL,divisionsL):
calcRate = False
break
if calcRate and datL[0][i+rateSampling] != datL[0][i]:
for j in range(1,len(divisionsL)):
ratesL[j][i] = (datL[j][i+rateSampling]-datL[j][i])/(datL[0][i+rateSampling]-datL[0][i])
else:
cStr = cText.cSetFg(cText.YELLOW)
cStr += "WARNING:"
cStr += cText.cSetAttr(cText.NONE)
print cStr+"this feature has not been tested."
#Transition based rate calculation
if rateSampling == "inf":
for j in range(1,len(divisionsL)):
mark = 0
for i in range(len(datL[0])):
if i < mark:
continue
while mark < len(datL[0]) and equalBins(i,mark,binsL,divisionsL):
mark = mark + 1
if datL[0][mark-1] != datL[0][i]:
ratesL[j][i] = (datL[j][mark-1]-datL[j][i])/(datL[0][mark-1]-datL[0][i])
else:
for i in range(len(datL[0])-rateSampling):
for j in range(1,len(divisionsL)):
calcRate = True
for k in range(rateSampling):
if not equalBins(i,i+k,binsL,divisionsL):
calcRate = False
break
if calcRate and datL[0][i+rateSampling] != datL[0][i]:
ratesL[j][i] = (datL[j][i+rateSampling]-datL[j][i])/(datL[0][i+rateSampling]-datL[0][i])
return ratesL
##############################################################################
# Return the minimum rate for a given rate list.
##############################################################################
def minRate(ratesL):
#Remove the characters from the list before doing the comparison
cmpL = []
for i in range(len(ratesL)):
if ratesL[i] != '-':
cmpL.append(ratesL[i])
if len(cmpL) > 0:
return min(cmpL)
else:
return "-"
##############################################################################
# Return the maximum rate for a given rate list.
##############################################################################
def maxRate(ratesL):
#Remove the characters from the list before doing the comparison
cmpL = []
for i in range(len(ratesL)):
if ratesL[i] != '-':
cmpL.append(ratesL[i])
if len(cmpL) > 0:
return max(cmpL)
else:
return "-"
##############################################################################
# Give a score for the even distribution of points for all
# variables. 0 is the optimal score.
##############################################################################
def pointDistCost(datValsL,divisionsL,resL=[],updateVar=-1):
total = 0
if updateVar == 0:
for i in range(len(divisionsL)):
resL.append(0)
#Fill up resL
for i in range(1,len(divisionsL)):
points = pointDistCostVar(datValsL[i],divisionsL[i])
total += points
resL[i] = points
elif updateVar > 0:
#Incrementally calculate a total change
resL[updateVar] = pointDistCostVar(datValsL[updateVar],
divisionsL[updateVar])
for i in resL:
total += i
else:
#Do a full calculation from scratch
for i in range(1,len(divisionsL)):
total += pointDistCostVar(datValsL[i],divisionsL[i])
return total
##############################################################################
# Give a score for the even distribution of points for an individual
# variable. 0 is the optimal score.
##############################################################################
def pointDistCostVar(datValsL,divisionsL):
optPointsPerBin = len(datValsL)/(len(divisionsL)+1)
#print "optPointsPerBin:"+str(optPointsPerBin)
pointsPerBinL = []
for i in range(len(divisionsL)+1):
pointsPerBinL.append(0)
for i in range(len(datValsL)):
top = True
for j in range(len(divisionsL)):
if datValsL[i] <= divisionsL[j]:
pointsPerBinL[j] += 1
top = False
break
if top:
pointsPerBinL[len(divisionsL)] += 1
#print "pointsPerBinL:"+str(pointsPerBinL)
score = 0
for points in pointsPerBinL:
score += abs(points - optPointsPerBin)
return score
##############################################################################
# Give a score for the range of rates for all variables. 0 is the
# optimal score.
##############################################################################
def rateRangeCost(datValsL,divisionsL,resL=[],updateVar=-1):
total = 0
binsL = genBins(datValsL,divisionsL)
ratesL = genRates(divisionsL,datValsL,binsL)
#print "ratesL:"+str(ratesL)
for i in range(1,len(divisionsL)):
maxR = maxRate(ratesL[i])
minR = minRate(ratesL[i])
total += abs(maxR-minR)
return total
##############################################################################
# Look for the optimal thresholds using a greedy algorithm.
##############################################################################
def greedyOpt(divisionsL,datValsL,datValsExtremaL,initDivL):
resL = [] #Used to keep partial results for cost functions
updateVar = 0 #The variable that was updated to help optimize cost function recalculation
bestDivisionsL = copy.deepcopy(divisionsL)
bestCost = costFunc(datValsL,divisionsL,resL,updateVar)
numMoves = 0
print "Starting optimization..."
while numMoves < iterations:
for i in range(1,len(divisionsL)):
for j in range(len(divisionsL[i])):
if (initDivL[i][j] != "?"):
#move left
if (j == 0):
if divisionsL[i][j] != "?":
distance = abs(divisionsL[i][j] - datValsExtremaL[i][0])/2
else:
distance = abs(divisionsL[i][j] - divisionsL[i][j-1])/2
else:
distance = abs(divisionsL[i][j] - divisionsL[i][j-1])/2
newDivisionsL = copy.deepcopy(divisionsL)
newDivisionsL[i][j] -= distance
newCost = costFunc(datValsL,newDivisionsL,resL,i)
numMoves += 1
if numMoves % 500 == 0:
print str(numMoves)+"/"+str(iterations)
if newCost < bestCost:
bestCost = newCost
divisionsL = newDivisionsL
else:
#move right
if j == len(divisionsL[i])-1:
distance = abs(datValsExtremaL[i][1] - divisionsL[i][j])/2
else:
distance = abs(divisionsL[i][j+1] - divisionsL[i][j])/2
newDivisionsL = copy.deepcopy(divisionsL)
newDivisionsL[i][j] += distance
newCost = costFunc(datValsL,newDivisionsL,resL,i)
numMoves += 1
if numMoves % 500 == 0:
print str(numMoves)+"/"+str(iterations)
if newCost < bestCost:
bestCost = newCost
divisionsL = newDivisionsL
if numMoves > iterations:
return divisionsL
return divisionsL
##############################################################################
# Look for the optimal thresholds using a greedy algorithm for the
##############################################################################
def writeBinsFile(varsL,divisionsL,binsFile):
outputF = open(binsFile, 'w')
flag = False
for i in range(len(varsL)):
if (varsL[i].dmvc == True):
if (flag == False):
outputF.write(".dmvc ")
flag = True
outputF.write(varsL[i].name + " ")
if (flag == True):
outputF.write("\n")
for i in range(1,len(varsL)):
if len(divisionsL[i]) > 0:
outputF.write(varsL[i].name)
for div in divisionsL[i]:
outputF.write(" "+str(div))
outputF.write("\n")
outputF.close()
##############################################################################
##############################################################################
def main():
global numThresholds
global iterations
global optFunc
global costFunc
usage = "usage: %prog [options] datFile1 ... datFileN"
parser = OptionParser(usage=usage)
parser.set_defaults(binsFile=None,numThresholds=None,costF="p",optF="g")
parser.add_option("-b", "--bins", action="store", dest="binsFile", help="The name of the .bins file to be created. If this is not provided the basename of the first input data file is used.")
parser.add_option("-t", "--thresholds", action="store", dest="numThresholds", help="The number of thresholds to create during autogeneration.")
parser.add_option("-i", "--iterations", action="store", dest="iterations", help="The number of iterations of the optimization algorithm to run.")
parser.add_option("-c", "--cost", action="store", dest="costF", help="The cost function to use: r - Minimize the distance between rates; p - Average the number of points in each bin.")
parser.add_option("-o", "--optimization", action="store", dest="optF", help="The optimization function to use: g - Greedy algorithm.")
(options, args) = parser.parse_args()
#if len(args) > 0:
# datFileL = args
#else:
# print "At least one data file is required."
# parser.print_help()
# sys.exit()
if not options.binsFile:
baseFileL = os.path.splitext(datFileL[0])
binsFile = baseFileL[0]+".bins"
else:
binsFile = options.binsFile
if options.numThresholds:
numThresholds = int(options.numThresholds)
if options.iterations:
iterations = int(options.iterations)
if options.optF == "g":
optFunc = greedyOpt
else:
cStr = cText.cSetFg(cText.RED)
cStr += "ERROR:"
cStr += cText.cSetAttr(cText.NONE)
print cStr + options.optFunc + " is not a valid option for the optimization function."
parser.print_help()
sys.exit()
if options.costF == "r":
costFunc = rateRangeCost
elif options.costF == "p":
costFunc = pointDistCost
else:
cStr = cText.cSetFg(cText.RED)
cStr += "ERROR:"
cStr += cText.cSetAttr(cText.NONE)
print cStr + options.costFunc + " is not a valid option for the cost function."
parser.print_help()
sys.exit()
varsL = extractVars("run-1.tsd")
datValsL, datValsExtremaL = reorderDatL(varsL)
if os.path.isfile(options.binsFile):
initDivL, tParam = parseBinsFile(options.binsFile,varsL)
dmvcRunL = findDMVC(datValsL,varsL,tParam)
divisionsL = initDivisionsL(datValsExtremaL,varsL,initDivL)
print "Iterations: "+str(iterations)
print "Optimization function: "+optFunc.func_name
print "Cost function: "+costFunc.func_name
print "Initial divisionsL:"+str(divisionsL)
print "Initial score:"+str(costFunc(datValsL,divisionsL))
divisionsL = optFunc(divisionsL,datValsL,datValsExtremaL,initDivL)
print "Final divisionsL:"+str(divisionsL)
print "Final score:"+str(costFunc(datValsL,divisionsL))
writeBinsFile(varsL,divisionsL,binsFile)
##############################################################################
##############################################################################
###########
# Globals #
###########
numThresholds = 2 #the default number of thresholds to create...it can be overridden from the command line
iterations = 10000 #the default number of iterations
rateSampling = "inf" #How many points should exist between the sampling of different rates..."inf" samples once/threshold
pathLength = 10 #For "inf" rate sampling the number of time points that a "run" must persist for the rate to be calculated. This is just another parameter to help with the data smoothing.
placeRates = True #When true the script calculates rates based on places. When false it calculates rates based on transitions although there is very little infrastructure for transition based rates and it isn't well tested.
optFunc = None #The name of the optimization function that will be used.
costFunc = None #The name of the cost function that will be used in the optimization function.
if __name__ == "__main__":
main()

69
bin/cText.py Executable file
View file

@ -0,0 +1,69 @@
#!/usr/bin/python
##############################################################################
## Copyright (c) 2007 by Scott R. Little
## University of Utah
##
## Permission to use, copy, modify and/or distribute, but not sell, this
## software and its documentation for any purpose is hereby granted
## without fee, subject to the following terms and conditions:
##
## 1. The above copyright notice and this permission notice must
## appear in all copies of the software and related documentation.
##
## 2. The name of University of Utah may not be used in advertising or
## publicity pertaining to distribution of the software without the
## specific, prior written permission of University of Utah.
##
## 3. THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
## EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
## WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
##
## IN NO EVENT SHALL UNIVERSITY OF UTAH OR THE AUTHORS OF THIS SOFTWARE BE
## LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES
## OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
## OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON
## ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE
## OR PERFORMANCE OF THIS SOFTWARE.
##
##############################################################################
#attributes for color selection
NONE = "00"
BOLD = "01"
DIM = "02"
UNDERLINE = "04"
BLINK = "05"
REVERSE = "07"
HIDDEN = "08"
#available colors for fg and bg
BLACK = 0
RED = 1
GREEN = 2
YELLOW = 3
BLUE = 4
MAGENTA = 5
CYAN = 6
WHITE = 7
def cSetAll(attr, fgColor, bgColor):
return "\033["+attr+";"+str(fgColor+30)+";"+str(bgColor+40)+"m"
def cSetAttr(attr):
return "\033["+attr+"m"
def cSetFg(fgColor):
return "\033["+str(fgColor+30)+"m"
def cSetBg(bgColor):
return "\033["+str(bgColor+40)+"m"
def cSetFgBg(fgColor,bgColor):
return "\033["+str(fgColor+30)+";"+str(bgColor+40)+"m"
def cSetAttrFg(attr, fgColor):
return "\033["+attr+";"+str(fgColor+30)+"m"
def cSetAttrBg(attr, bgColor):
return "\033["+attr+";"+str(bgColor+40)+"m"

BIN
bin/cText.pyc Normal file

Binary file not shown.

160
bin/checkHpn.pl Executable file
View file

@ -0,0 +1,160 @@
#!/usr/bin/perl
###############################################################################
##
## File Name : checkHpn.pl
## Author :
## E-mail : little@cs.utah.edu
## Date Created : 05/12/2004
##
## Description : A simple script to check results for the ATACS THPN
## analysis engine.
##
## Assumptions :
##
## ToDo :
##
###############################################################################
## CVS HOOKS
##
## $Source: /home/ming/cvsroot/BioSim/bin/Attic/checkHpn.pl,v $
###############################################################################
## $Id: checkHpn.pl,v 1.1 2010/02/16 18:11:26 myers Exp $
###############################################################################
use strict;
#the following 2 hashes give the current "correct" values for states
#and zones on the examples.
my %stateH =
(
"water" => 2,
"water2x" => 2,
"waterAMS" => 10,
"billiardsAMS" => 66,
"temperatureAMS" => 39,
"diode_noosc" => 14,
"diode_osc" => 17,
"2x2diode" => 4,
"3x3diode" => 6,
"4x4diode" => 16,
"naive_4x4noosc" => 12,
"naive_4x4osc" => 13,
"our_4x4noosc" => 15,
"our_4x4nooscprop" => 41,
# "our_4x4nooscprop2" => 37,
"our_4x4nooscprop4" => 14,
"our_4x4osc" => 14,
"our_4x4oscprop" => 22,
# "our_4x4oscprop2" => 17,
"our_4x4oscprop4" => 17,
"our_noosc" => 9,
"our_osc" => 13,
"pll2" => 27,
"pll3" => 20,
"pll_lite" => 5,
"vco" => 2,
"waterEI" => 11,
"billiardsEI" => 28,
"temperatureEI" => 23
);
my %zoneH =
(
"water" => 11,
"water2x" => 11,
"waterAMS" => 10,
"billiardsAMS" => 134,
"temperatureAMS" => 48,
"diode_noosc" => 3612,
"diode_osc" => 3343,
"2x2diode" => 57,
"3x3diode" => 522,
"4x4diode" => 13334,
"naive_4x4noosc" => 68,
"naive_4x4osc" => 101,
"our_4x4noosc" => 1473,
"our_4x4nooscprop" => 8479,
# "our_4x4nooscprop2" => 3829,
"our_4x4nooscprop4" => 3109,
"our_4x4osc" => 698,
"our_4x4oscprop" => 802,
# "our_4x4oscprop2" => 296,
"our_4x4oscprop4" => 2830,
"our_noosc" => 271,
# "our_osc" => 359,
"pll2" => 1497,
"pll3" => 615,
"pll_lite" => 11,
"vco" => 7,
"waterEI" => 14,
"billiardsEI" => 48,
"temperatureEI" => 37
);
my $file;
#grab the size of @ARGV
my $arg_size = scalar(@ARGV);
if($arg_size != 1) {
print "Wrong number of arguments to the script.\n";
exit(-1);
}
else {
$file = $ARGV[0];
}
my $foundWarning = 0;
my $foundZoneCnt = 0;
my $foundStateCnt = 0;
my $status = 0;
open(LOG, "$file.log");
print "$file: ";
my $ok = 1;
while(<LOG>) {
chomp;
my $line = $_;
if($line =~ /Warning:/ && !$foundWarning) {
if($line !~ /^Warning: Petri net contains/) {
print "Failed! A warning was given.\n";
$ok = 0;
$foundWarning = 1;
$status = 1;
}
}
if($line =~ /^States:/) {
$foundStateCnt = 1;
my @stateA = split / /, $line;
if($stateA[1] != $stateH{$file}) {
print "Failed! Wrong state count -- given $stateA[1] expected $stateH{$file}\n";
$ok = 0;
$status = 2;
}
}
if($line =~ /^Zones: \d+$/) {
$foundZoneCnt = 1;
my @zoneA = split / /, $line;
if($zoneA[1] != $zoneH{$file}) {
print "Failed! Wrong zone count -- given $zoneA[1] expected $zoneH{$file}\n";
$ok = 0;
$status = 3;
}
}
}
close LOG;
if($ok && $foundZoneCnt && $foundStateCnt) {
print "Ok\n";
}
if(!$foundZoneCnt) {
print "No zone count found!\n";
$status = 4;
}
if(!$foundStateCnt) {
print "No state count found!\n";
$status = 5;
}
exit($status);

139
bin/check_dot.pl Executable file
View file

@ -0,0 +1,139 @@
#!/usr/bin/perl
#This file writes the checked dot file.
if ($#ARGV == 1){
print "Normal Usage: ./check_dot.pl Unchecked_Dot, Master_Dot, Out_Dot\n";
print "Assumed usage: ./check_dot.pl Unchecked_Dot, [find the masterdot ] Out_Dot\n";
$assumed = $ARGV[1];
$assumed =~ s/(.*)\/(.*)\/(.*)\/([^\/]*).dot/$1\/$2\/$2.dot/;
if (not -e "$assumed"){
print "ERROR: Unable to find a master dot file $assumed from $ARGV[1]\n";
exit(1);
}
$unchecked = $ARGV[0];
$master_dot = $assumed;
$out = $ARGV[1];
}
elsif ($#ARGV != 2){
print "Usage: ./check_dot.pl Unchecked_Dot, Master_Dot, Out_Dot\n";
exit(1);
}
else{
$unchecked = $ARGV[0];
$master_dot = $ARGV[1];
$out = $ARGV[2];
}
if (not -e "$master_dot"){
print "ERROR: unable to check correctness for non exsistant? $master_dot\n";
exit(1);
}
if (not -e "$unchecked"){
print "ERROR: unable to check correctness for non exsistant? '$unchecked'\n";
exit(1);
}
open (IN1, "$master_dot") or die "I cannot check dot correctness for $master_dot\n";
open (IN2, "$unchecked") or die "I cannot check correctness for $filename\/method.dot\n";
open (CHECKED, ">$out") or die "I cannot write the checked file\n";
my @in1 = <IN1>;
my @in2 = <IN2>;
close IN1;
close IN2;
my $in1 = join ("",@in1);
my $in2 = join ("",@in2);
$in1 =~ s/sp_//g;
$in2 =~ s/sp_//g;
print CHECKED "digraph G {\n";
#generate the states in the corrected output
for (my $i = 0; $i <= $#in2; $i++){
if ($in2[$i] =~ m/shape=ellipse/){
print CHECKED $in2[$i];
}
}
#draw things acording to the following plan
# \ True
#Reported \ a r n
# \ ___________________________
# a | blue | red | black |
# | solid | dashed | dashed |
# | normal | tee | onormal |
# |-----------------|---------|
# r | blue | red | black |
# | dashed | solid | dashed |
# | normal | tee | obox |
# |-----------------|---------|
# n | blue | red | |
# | dotted | dotted | |
# | normal | tee | |
# -----------------------------
#
#Check the first 2 columns above
while ($in1 =~ m/s([0-9]+) -> s([0-9]+) (.+)arrowhead= *((vee|tee))/g){
my $state1 = $1;
my $state2 = $2;
my $mid = $3;
my $arc = $4;
# if ($mid =~ m/label=\"[-]*([0-9]+[.]*[0-9]*)/){
# my $num = $1;
# $num = (int (10000 * $num)) / 10000;
# if ($num < $green_level){
# $mid =~ s/color=\"[^\"]+/color=\"green/;
# }
# }
if ($in2 =~ m/s$state1 -> s$state2 (.*)arrowhead=$arc/){
$tmp = $1;
$arc =~ s/vee/normal/;
print CHECKED "s$state1 -> s$state2 $tmp arrowhead=$arc]\n";
}
elsif ($in2 =~ m/s$state1 -> s$state2 (.*)arrowhead=/){
$tmp = $1;
if ($tmp =~ m/blue/){
$tmp =~ s/blue/firebrick/;
}
else{
$tmp =~ s/firebrick/blue/;
}
$arc =~ s/vee/normal/;
print CHECKED "s$state1 -> s$state2 $tmp style=dashed, arrowhead=$arc]\n";
}
else{
$arc =~ s/vee/normal/;
#$mid =~ s/color=\"[^\"]+/color=\"gray/;
print CHECKED "s$state1 -> s$state2 $mid style=dotted, arrowhead=$arc]\n";
}
}
#Check the third column
while ($in2 =~ m/s([0-9]+) -> s([0-9]+) (.+)arrowhead=((vee|tee))/g){
my $state1 = $1;
my $state2 = $2;
my $mid = $3;
my $arc = $4;
if ($in1 =~ m/s$state1 -> s$state2 /){
#do nothing as this was already taken care of above
}
else{
$mid =~ s/color=\"[^\"]+/color=\"black/;
$arc =~ s/(vee|normal)/onormal/;
$arc =~ s/tee/obox/;
print CHECKED "s$state1 -> s$state2 $mid style=dashed, arrowhead=$arc]\n";
}
}
print CHECKED "\n}\n";
close CHECKED;

292
bin/cir2data.py Normal file
View file

@ -0,0 +1,292 @@
#!/usr/bin/python
##############################################################################
## Copyright (c) 2007 by Scott R. Little
## University of Utah
##
## Permission to use, copy, modify and/or distribute, but not sell, this
## software and its documentation for any purpose is hereby granted
## without fee, subject to the following terms and conditions:
##
## 1. The above copyright notice and this permission notice must
## appear in all copies of the software and related documentation.
##
## 2. The name of University of Utah may not be used in advertising or
## publicity pertaining to distribution of the software without the
## specific, prior written permission of University of Utah.
##
## 3. THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
## EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
## WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
##
## IN NO EVENT SHALL UNIVERSITY OF UTAH OR THE AUTHORS OF THIS SOFTWARE BE
## LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES
## OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
## OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON
## ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE
## OR PERFORMANCE OF THIS SOFTWARE.
##
##############################################################################
## DESCRIPTION: This script takes a circuit or SPICE output data and
## processes it in preparation for the data2lhpn script. Given a
## circuit file the script will run the specified simulations and
## conver the data. Given an ASCII SPICE RAW file the script will
## process the file.
##############################################################################
### TODO ###
#Add Spectre support?
#Add support for *.cir files to run multiple simulations
#clean-up code that modifies loop variables (b/c the modification isn't really working)
#allow blank lines in the .bins file
#check to see if ngspice/ngsconvert exist and return an nice error message if they don't
#Add gnuplot script generation
import re, os, sys
from optparse import OptionParser
#Regular expressions
ngsNumVarsR = re.compile("No. Variables: ")
ngsNumPointsR = re.compile("No. Points: ")
ngsVarsR = re.compile("Variables:")
ngsValsR = re.compile("Values:")
micaDataInitR = re.compile("Index ")
spaceR = re.compile("\s+")
lSpaceR = re.compile("^\s+")
tSpaceR = re.compile("\s+$")
newLR = re.compile("\n+")
lNumR = re.compile("^\d")
numR = re.compile("\d")
varCleanR = re.compile("\(|\)|\#|:")
##############################################################################
# Clean-up the given line by removing leading and trailing space as well as
# trailing new line characters.
##############################################################################
def cleanLine(line):
lineNS = re.sub(lSpaceR,"",line)
lineNL = re.sub(newLR,"",lineNS)
lineTS = re.sub(tSpaceR,"",lineNL)
return lineTS
##############################################################################
# Clean up variable names (to make them compatible w/ the .g file format of
# ATACS) by removing any parens.
##############################################################################
def cleanVarName(line):
lineNP = re.sub(varCleanR,"",line)
return lineNP
##############################################################################
# Convert ngspice data into the dat output format.
##############################################################################
def ngspiceConvert(asciiFile,datFile,nodesL):
print "Converting: "+asciiFile
numVars = -1
numPoints = -1
varNamesL = []
valsL = []
inputF = open(asciiFile, 'r')
outputF = open(datFile, 'w')
linesL = inputF.readlines()
for i in range(len(linesL)):
if ngsNumVarsR.match(linesL[i]):
varStrL = ngsNumVarsR.split(linesL[i])
numVars = int(varStrL[1])
print "Number of variables:"+str(numVars)
if ngsNumPointsR.match(linesL[i]):
pointStrL = ngsNumPointsR.split(linesL[i])
numPoints = int(pointStrL[1])
print "Number of points:"+str(numPoints)
if ngsVarsR.match(linesL[i]):
varHeaderL = spaceR.split(linesL[i])
if varHeaderL[1] != "0":
i = i+1
for j in range(numVars):
varName = linesL[i]
varNameNS = cleanLine(varName)
varNameL = spaceR.split(varNameNS)
i = i+1
if len(nodesL) > 1:
if j in nodesL:
if varNameL[1] == "0":
#print "varName["+str(j)+"]: "+varNameL[2]
varNamesL.append(cleanVarName(varNameL[2]))
else:
#print "varName["+str(j)+"]: "+varNameL[1]
varNamesL.append(cleanVarName(varNameL[1]))
else:
#print "varName: "+varNameL[1]
varNamesL.append(cleanVarName(varNameL[1]))
if ngsValsR.match(linesL[i]):
i = i+1
for j in range(numPoints):
varsL = []
for k in range(numVars):
#print "i: "+str(i)+" j: "+str(j)+" k: "+str(k)
varVal = linesL[i]
varValNS = cleanLine(varVal)
#print "k:"+str(k)
if k == 0:
#print "["+str(k)+"] "+"varValNS:"+varValNS
varValL = spaceR.split(varValNS)
valStr = varValL[1]
else:
valStr = varValNS
#print "nodesL:"+str(len(nodesL))+":"
#print nodesL
if len(nodesL) > 1:
if k in nodesL:
varsL.append(valStr)
else:
varsL.append(valStr)
i = i+1
#print "varsL:"
#print varsL
valsL.append(varsL)
#print "i:"+str(i)+" len(linesL):"+str(len(linesL))+" linesL[i+1]:"+str(linesL[i+1])
if (i < len(linesL)) and not(numR.search(linesL[i])):
#print "Empty line"
i = i+1 #account for the empty line
break
if len(nodesL) > 1:
if len(nodesL) <= numVars:
numVars = len(nodesL)
else:
print "Error: the number of variables is less than the number of nodes provided on the command line."
return
outputF.write("Variables: "+str(numVars)+"\n")
outputF.write("Points: "+str(numPoints)+"\n")
for name in varNamesL:
outputF.write(name+" ")
outputF.write("\n")
for valL in valsL:
for val in valL:
outputF.write(val+" ")
outputF.write("\n")
inputF.close()
outputF.close()
##############################################################################
# Convert mica data into the dat output format. This isn't really needed
# as Mica generates ASCII raw format which the standard script flow can read.
##############################################################################
def micaConvert(cirFile,datFile,nodesL):
numVars = -1
numPoints = -1
varNamesL = []
valsL = []
inputF = open(cirFile, 'r')
outputF = open(datFile, 'w')
linesL = inputF.readlines()
for i in range(len(linesL)):
if micaDataInitR.match(linesL[i]):
cleanLineStr = cleanLine(linesL[i])
tempVarNamesL = spaceR.split(cleanLineStr)
tempVarNamesL.pop(0)
print "varNames:"+str(varNamesL)
if len(nodesL) > 1:
for j in range(tempVarNamesL):
if j in nodesL:
varNamesL.append(tempVarNameL[j])
else:
varNamesL = tempVarNamesL
numVars = len(varNamesL)
numPoints = 0
i = i+2 #skip the final header line and position i at the
#beginning of the data
while lNumR.match(linesL[i]):
print "line["+str(i)+"]"+linesL[i]
newValsL = spaceR.split(linesL[i])
newValsL.pop(0) #remove the Index
if len(nodesL) > 1:
finalValsL = []
for j in range(newValsL):
if j in nodesL:
finalValsL.append(newValsL[j])
valsL.append(finalValsL)
else:
valsL.append(newValsL)
i = i + 1
numPoints = numPoints + 1
break
outputF.write("Variables: "+str(numVars)+"\n")
outputF.write("Points: "+str(numPoints)+"\n")
for name in varNamesL:
outputF.write(name+" ")
outputF.write("\n")
for valL in valsL:
for val in valL:
outputF.write(val+" ")
outputF.write("\n")
inputF.close()
outputF.close()
##############################################################################
##############################################################################
def main():
usage = "usage: %prog [options] file1 ... fileN"
parser = OptionParser(usage=usage)
parser.set_defaults(doSpice=False, doRawConvert=False, simType="ngspice", nodes="")
parser.add_option("-n", "--nodes", action="store", dest="nodes", help="A comma separated list of the nodes to output to the data file. Time is row 0 and always output.")
parser.add_option("-s", "--spice", action="store_true", dest="doSpice", help="Run ngspice on the provided file(s).")
parser.add_option("-r", "--rawconvert", action="store_true", dest="doRawConvert", help="Run ngsconvert on the provided file(s). Providing -s automatically enables -r.")
parser.add_option("-t", "--type", action="store", dest="simType", help="Select the type of simulator used.")
(options, args) = parser.parse_args()
if len(args) > 0:
fileL = args
else:
print "At least one data file is required."
parser.print_help()
sys.exit()
nodesStrL = options.nodes.split(',')
nodesL = []
if (options.nodes != ""):
for s in nodesStrL:
nodesL.append(int(s))
#Ensure that time gets output
if not(0 in nodesL):
nodesL.insert(0,0)
#print "nodesL:"+str(nodesL)
for i in range(len(fileL)):
baseFileL = os.path.splitext(fileL[i])
cirFile = fileL[i]
rawFile = baseFileL[0] + ".raw"
asciiFile = baseFileL[0] + ".ascii"
datFile = baseFileL[0] + ".dat"
if(options.doRawConvert or options.doSpice):
convertFile = asciiFile
else:
convertFile = fileL[i]
if(options.doSpice):
spiceCmd = spicePath + " -b -r " + rawFile + " " + cirFile
if(os.system(spiceCmd) != 0):
print "An error occured with the following SPICE command: " + spiceCmd
if(options.doRawConvert or options.doSpice):
rawConvertCmd = rawConvertPath + " b " + rawFile + " a " + asciiFile
if(os.system(rawConvertCmd) != 0):
print "An error occured with the following raw convert command: " + rawConvertCmd
if options.simType == "ngspice":
ngspiceConvert(convertFile,datFile,nodesL)
elif options.simType == "mica":
micaConvert(convertFile,datFile,nodesL)
##############################################################################
##############################################################################
###########
# Globals #
###########
spicePath = "ngspice"
rawConvertPath = "ngsconvert"
if __name__ == "__main__":
main()

2700
bin/data2lhpn.py Normal file

File diff suppressed because it is too large Load diff

65
bin/detect-java.sh Executable file
View file

@ -0,0 +1,65 @@
#!/bin/bash
# This script attempts to find an existing installation of Java that meets a minimum version
# requirement on a Linux machine. If it is successful, it will export a JAVA_HOME environment
# variable that can be used by another calling script.
#
# To specify the required version, set the REQUIRED_VERSION to the major version required,
# e.g. 1.3, but not 1.3.1.
REQUIRED_VERSION=1.7
# Transform the required version string into a number that can be used in comparisons
REQUIRED_VERSION=`echo $REQUIRED_VERSION | sed -e 's;\.;0;g'`
# Check JAVA_HOME directory to see if Java version is adequate
if [ $JAVA_HOME ]
then
JAVA_EXE=$JAVA_HOME/bin/java
$JAVA_EXE -version 2> tmp.ver
VERSION=`cat tmp.ver | grep "java version" | awk '{ print substr($3, 2, length($3)-2); }'`
rm tmp.ver
VERSION=`echo $VERSION | awk '{ print substr($1, 1, 3); }' | sed -e 's;\.;0;g'`
if [ $VERSION ]
then
if [ $VERSION -ge $REQUIRED_VERSION ]
then
JAVA_HOME=`echo $JAVA_EXE | awk '{ print substr($1, 1, length($1)-9); }'`
else
JAVA_HOME=
fi
else
JAVA_HOME=
fi
fi
# If the existing JAVA_HOME directory is adequate, then leave it alone
# otherwise, use 'locate' to search for other possible java candidates and
# check their versions.
if [ $JAVA_HOME ]
then
:
else
for JAVA_EXE in `locate bin/java | grep java$ | xargs echo`
do
if [ $JAVA_HOME ]
then
:
else
$JAVA_EXE -version 2> tmp.ver 1> /dev/null
VERSION=`cat tmp.ver | grep "java version" | awk '{ print substr($3, 2, length($3)-2); }'`
rm tmp.ver
VERSION=`echo $VERSION | awk '{ print substr($1, 1, 3); }' | sed -e 's;\.;0;g'`
if [ $VERSION ]
then
if [ $VERSION -ge $REQUIRED_VERSION ]
then
JAVA_HOME=`echo $JAVA_EXE | awk '{ print substr($1, 1, length($1)-9); }'`
fi
fi
fi
done
fi
# If the correct Java version is detected, then export the JAVA_HOME environment variable
if [ $JAVA_HOME ]
then
export JAVA_HOME
fi

1177
bin/gcm2sbml.pl Executable file

File diff suppressed because it is too large Load diff

28
bin/genBackgroundGCM.pl Executable file
View file

@ -0,0 +1,28 @@
#!/usr/bin/perl
open (IN, "run-1.tsd");
@in = <IN>;
close IN;
open (OUT, ">background.gcm");
$in = join("",@in);
@in = split (/\),\(/,$in);
$in = $in[0];
$in =~ s/^(.*?)\),\(/$1/;
$in =~ s/\"//g;
$in =~ s/\(|\)//g;
print "got '$in'\n";
@in = split (/,/,$in);
print OUT "diagraph G {\n";
for ($i = 1; $i <= $#in; $i++){
my $a = $in[$i];
print OUT "$a [ID=$a,Name=\"$a\",Type=normal,shape=ellipse,label=\"$a\"]\n";
}
print OUT "}\nGlobal {\n}\nPromoters {\n}\nSBML file=\"\"\n"

326
bin/gen_GeneNet_report.pl Executable file
View file

@ -0,0 +1,326 @@
#!/usr/bin/perl
$genenet_dir = $ARGV[0];
$reports_dir = $ARGV[1];
$file_name_to_use = $ARGV[2];
$out_name = $ARGV[3];
#remove the last / in dir
$reports_dir =~ s/\/$//;
sub main{
my @files = `ls $genenet_dir*/*/*/$file_name_to_use`;
print "Sorting dir\n";
@files = dir_sort(\@files);
print "Done sorting dir\n";
if ($#files < 1){
print "Error, no files found\n";
exit(1);
}
open (OUT, ">$reports_dir/$out_name") or die "Cannot open out file '$reports_dir/$out_name'\n";
print OUT ",,,,,GeneNet,,GeneNet,,,GeneNet Time,,,,,,,\n";
#print OUT "Name,# Genes,# Experiments,Sample Interval,Exp Duration,R,P,R,P,R/R,P/P, # Correct (R P), Total Arcs (R), Reported Arcs (P), # Correct (R P), Total Arcs (R), Reported Arcs (P),\n";
print OUT "Name,Genes,#Exp,S Size,Dur,R,P,# Correct (R P), Total Arcs (R), Reported Arcs (P),user,system,elapsed,CPU,major pagefaults,minor pagefaults, swaps\n";
my $exp_name = $files[0];
my @running_genenet;
for (my $i = 0; $i <= $#files; $i++){
$file = $files[$i];
$file =~ s/[.]dot//;
$file =~ s/\n//;
print "Checking $file\n";
if (not_matching($file,$exp_name)){
add_overview($exp_name);
$exp_name = $file;
print OUT ",,,,";
write_final(@running_genenet);
print OUT "\n";
undef @running_genenet;
}
@tmp1 = check_correctness("$file");
@running_genenet = addit(\@running_genenet,\@tmp1);
write_out_file($file);
write_initial(@tmp1);
if ($tmp1[0] != $tmp1[2]){
print OUT ",ERROR: $tmp1[0] $tmp1[2],$tmp1[1],$tmp1[3]";
}
else{
print OUT ",$tmp1[0],$tmp1[1],$tmp1[3]";
}
write_time();
print OUT "\n";
#print "Done with $file\n";
}
print "Adding overview\n";
add_overview($file);
print OUT ",,,,";
write_final(@running_genenet);
print OUT "\n\n";
print OUT "Overview:\n$overview\n\n";
}
sub add_overview{
my $exp_name = shift;
if ($exp_name =~ m/^.*\/([^\/]*)_[0-9]+\/[^\/]*_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)\//){
$overview = "$overview$1,$3,$4,$5,$6";
}
else{
$exp_name =~ s/.*?\/(.*?)\/.*/$1/;
$exp_name =~ s/[.]*//;
$overview = "$overview$exp_name,,,,";
}
}
sub not_matching{
my $a = shift;
my $b = shift;
if ($a =~ m/^(.*)_([0-9]+)\/[^\/]*_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)\//){
my @a = ($1,$2, $3, $4, $5,$6);
if ($b =~ m/^(.*)_([0-9]+)\/[^\/]*_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)\//){
my @b = ($1,$2, $3, $4, $5, $6);
if ($a[0] eq $b[0]){
my @cmp = (5,4,3);
for (my $i = 0; $i <= $#cmp; $i++){
my $ind = $cmp[$i];
if (not ($a[$ind] == $b[$ind])){
return 1;
}
}
return 0;
}
}
}
return 1;
}
sub addit{
$a1 = shift;
$a2 = shift;
@a1 = @$a1;
@a2 = @$a2;
for (my $i = 0; $i <= $#a2; $i++){
$a1[$i] += $a2[$i];
}
return @a1;
}
sub write_out_file{
my $file = shift;
if ($file =~ m/^.*\/(.*_[0-9]+)\/[^\/]*_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)\//){
my $name = $1;
my $num_genes = $2;
my $experiments = $3;
my $interval = $4;
my $ending_time = $5;
print OUT "$name,$num_genes,$experiments,$interval,$ending_time";
}
else{
#print "Error matching $file\n";
$file =~ s/.*?\/(.*?)\/.*/$1/;
print OUT "$file,,,,";
}
}
sub write_final{
my $a0 = shift;
my $a1 = shift;
my $a2 = shift;
my $a3 = shift;
$tmp_name = write_double($a0,$a1);
print OUT $tmp_name;
$overview = "$overview$tmp_name";
$tmp_name = write_double($a2,$a3);
print OUT $tmp_name;
$overview = "$overview$tmp_name\n";
print OUT "\n";
}
sub write_initial{
my $a0 = shift;
my $a1 = shift;
my $a2 = shift;
my $a3 = shift;
print OUT write_double($a0,$a1);
print OUT write_double($a2,$a3);
}
sub write_double{
my $a = shift;
my $b = shift;
if ($b != 0){
return ",=$a/$b";
}
else {
return ",u $a/$b";
}
}
sub write_time{
#0.51user 0.00system 0:00.52elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k
#0inputs+0outputs (0major+853minor)pagefaults 0swaps
my $f = "$file";
my $tmp = $file_name_to_use;
$tmp =~ s/(.*)[.].*/$1\_time.txt/;
$f =~ s/(.*)\/.*/$1\/$tmp/;
if (-e "$f"){
open (A, "$f") or die "Cannot open time file $f\n";
my @a = <A>;
close A;
my $a = join ("",@a);
$a =~ s/\n//g;
if ($a =~ m/([0-9]+[.]*[0-9]*)user ([0-9]+[.]*[0-9]*)system ([0-9]+[:][0-9]+[.:]*[0-9]*)elapsed ([0-9]+[.]*[0-9]*).CPU .0avgtext.0avgdata 0maxresident.k0inputs.0outputs .([0-9]+)major.([0-9]+)minor.pagefaults ([0-9]+)swaps/){
my $out = ",$1,$2,$3,$4,$5,$6,$7";
print OUT $out;
}
else{
print "Unable to match\n'$a'\n";
exit(1);
}
}
else{
print "ERROR: Cannot find time file '$f'\n";
exit(1);
}
}
sub check_correctness{
my $filename = shift;
$filename = "$filename.dot";
if (not -e "$filename"){
print "ERROR: unable to check correctness for non exsistant? file '$filename'\n";
exit(1);
}
open (IN, "$filename") or die "I cannot check correctness for $filename\n";
my @in = <IN>;
close IN;
my $in = join ("",@in);
$in =~ s/sp_//g;
my $not_found_arcs = 0;
my $correct_arcs = 0;
my $wrong_influence_arcs = 0;
my $extra_arcs = 0;
while ($in =~ m/s([0-9]+) -> s([0-9]+) (.*)/g){
my $left = $3;
#print "Matched with '$left'\n";
if ($left =~ m/black/){ #should not have been reported
$extra_arcs++;
#$precision_total++;
}
elsif ($left =~ m/dotted/){ #It is there, but not found
$not_found_arcs++;
#$recall_total++;
}
elsif ($left =~ m/dashed/){ #wrong influence type
print "Extra arcs";
$wrong_influence_arcs++;
#$precision_total++;
#$recall_total++;
}
else{ #there and reported
$correct_arcs++;
#$precision_correct++;
#$precision_total++;
#$recall_correct++;
#$recall_total++;
}
}
my $num_genes = 0;
while ($in =~ m/s[0-9]+ \[/g){
$num_genes++;
}
my $total_possible_arcs = $num_genes * ($num_genes-1);
my $total_influence_arcs = $not_found_arcs + $wrong_influence_arcs + $correct_arcs;
my $total_absent_arcs = $total_possible_arcs - $total_influence_arcs;
my $correct_absent_arcs = $total_absent_arcs - $extra_arcs;
my $r_c = $correct_arcs;
my $r_t = $total_influence_arcs;
my $p_c = $correct_arcs;
my $p_t = $correct_arcs + $wrong_influence_arcs + $extra_arcs;
return ($r_c,$r_t,$p_c,$p_t);
}
sub dir_sort_b{
my $a = shift;
my $b = shift;
if ($a =~ m/(.*?)_([0-9]+)_/){
my $n1 = $1;
my $i1 = $2;
if ($b =~ m/(.*?)_([0-9]+)_/){
my $n2 = $1;
my $i2 = $2;
if ($n1 eq $n2 and $1 != $i2){
return $i1 <=> $i2;
}
}
}
return $a cmp $b;
}
sub dir_sort_a{
#order is 0 5 4 3 1 - 2 is the # genes which should match
# cmp = = = =
my $a = shift;
my $b = shift;
if ($a =~ m/^(.*)_([0-9]+)\/[^\/]*_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)\//){
my @a = ($1,$2, $3, $4, $5,$6);
if ($b =~ m/^(.*)_([0-9]+)\/[^\/]*_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)\//){
my @b = ($1,$2, $3, $4, $5, $6);
if ($a[0] eq $b[0]){
my @cmp = (5,4,3,1);
for (my $i = 0; $i <= $#cmp; $i++){
my $ind = $cmp[$i];
if (not ($a[$ind] == $b[$ind])){
return $a[$ind] <=> $b[$ind];
}
}
return $a[2] <=> $b[2];
}
else{
return $a[0] cmp $b[0];
}
}
}
return dir_sort_b($a,$b);
}
sub dir_sort{
my $d = shift;
my @d = @$d;
@d = sort {dir_sort_a($a,$b)} (@d);
return @d;
}
main();

5
bin/iBioSim.bat Executable file
View file

@ -0,0 +1,5 @@
setlocal ENABLEDELAYEDEXPANSION
set CLASSPATH="%BIOSIM%\gui\dist\classes"
for /f %%a IN ('dir /b "%BIOSIM%\gui\lib\*.jar"') do call set CLASSPATH=!CLASSPATH!;"%BIOSIM%\gui\lib\%%a"
java -Xmx2048M -Xms2048M -XX:+UseSerialGC -classpath %CLASSPATH% main.Gui

11
bin/iBioSim.linux Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
export LD_LIBRARY_PATH=$BIOSIM/lib:$LD_LIBRARY_PATH
CLASSPATH=$BIOSIM/gui/dist/classes
for jarFile in $BIOSIM/gui/lib/*.jar
do
CLASSPATH=$CLASSPATH:$jarFile
done
exec java -Xmx2048M -Xms2048M -XX:+UseSerialGC -classpath $CLASSPATH main.Gui

12
bin/iBioSim.linux64 Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
export PATH=$BIOSIM/bin:$PATH
export LD_LIBRARY_PATH=$BIOSIM/lib64:$LD_LIBRARY_PATH
CLASSPATH=$BIOSIM/gui/dist/classes
for jarFile in $BIOSIM/gui/lib/*.jar
do
CLASSPATH=$CLASSPATH:$jarFile
done
exec java -Xmx2048M -Xms2048M -XX:+UseSerialGC -classpath $CLASSPATH main.Gui

12
bin/iBioSim.mac Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
#
# run-time wrapper for BioSim gui
export DYLD_LIBRARY_PATH=$BIOSIM/lib:$DYLD_LIBRARY_PATH
CLASSPATH=$BIOSIM/gui/dist/classes
for jarFile in $BIOSIM/gui/lib/*.jar
do
CLASSPATH=$CLASSPATH:$jarFile
done
exec java -Xmx2048M -Xms2048M -XX:+UseSerialGC -classpath $CLASSPATH -Dapple.laf.useScreenMenuBar=true -Xdock:name="iBioSim" -Xdock:icon=$BIOSIM/gui/icons/iBioSim.jpg main.Gui

BIN
bin/parg Executable file

Binary file not shown.

98
bin/prereqs.perl Executable file
View file

@ -0,0 +1,98 @@
# Script to extract URLs from HTML files.
# (c) 2002 Eric Robert Peskin
eval "set PATH=/usr/bin:/usr/local/bin:/Perl/bin:${PATH};exec perl -S $0"
if ''; #above line won't run if already in Perl
use English; # Allow the long names for perl's built-in variables.
use Getopt::Long; # To process GNU style --long options.
($progname = $PROGRAM_NAME) =~ s|.*/||; # Strip directory part.
###############################################################################
$usage = <<"EOH;";
Usage: $progname [<option>|<file>]...
or typically
g++ [option]... <filename>.c -M | $progname > <filename>.d
Expand prerequisite output from a copiler with the -M (or -MM) flag
such that the .d file will depend only on the prerequisite files that
currently exist, but the object file and the TAGS file will depend on
all the prequisites. This is a modification of the strategy at
info:make\#Automatic_Prerequisites or
http://www.gnu.org/manual/make/html_node/make_47.html#SEC51
In the modified form:
The practice we recommend for automatic prerequisite generation is to
have one makefile corresponding to each source file. For each source
file "name.c" there is a makefile "name.d" which lists what files the
object file "name.o" depends on. That way only the source files that
have changed need to be rescanned to produce the new prerequisites.
Here is the pattern rule to generate a file of prerequisites (i.e., a
makefile) called "name.d" from a C source file called "name.c":
%.d: %.c
\@set -e; rm -f \$@; \
\$(CC) -M \$(CPPFLAGS) \$< > \$@.\$\$\$\$; \
$progname \$@.\$\$\$\$ > \$@; \
rm -f \$@.\$\$\$\$
See section 10.5 Defining and Redefining Pattern Rules, for
information on defining pattern rules. The "-e" flag to the shell
causes it to exit immediately if the \$(CC) command (or any other
command) fails (exits with a nonzero status).
With the GNU C compiler, you may wish to use the "-MM" flag instead of
"-M". This omits prerequisites on system header files. See section
"Options Controlling the Preprocessor" in Using GNU CC, for details.
The purpose of the $progname command is to translate (for example):
main.o : main.c defs.h
into:
main_prereqs = main.c defs.h
main.o TAGS: \${main_prereqs}
main.d: \$(wildcard $PROGRAM_NAME \${main_prereqs})
This makes each ".d" file depend on the currently existing source and
header files that the corresponding ".o" file depends on. make then
knows it must regenerate the prerequisites whenever any of the source
or header files changes.
Once you havve defined the rule to remake the ".d" files, you then use
the include directive to read them all in. See section 3.3 Including
Other Makefiles. For example:
sources = foo.c bar.c
include \$(sources:.c=.d)
Options:
-h, --help Print this usage information and exit.
Questions? Comments? Bug reports? mailto:peskin\@vlsigroup.ece.utah.edu
EOH;
###############################################################################
$help = '';
GetOptions('help' => \$help) or die $usage;
if($help){
print $usage;
exit;
}
$OUTPUT_FIELD_SEPARATOR = "\n";
$OUTPUT_RECORD_SEPARATOR = "\n";
local $INPUT_RECORD_SEPARATOR;
<> =~ /(\S+)\.o\s*:\s*/ or die "Could not find prerequisites";
print "$1_prereqs=$POSTMATCH";
print "$1.o TAGS: \${$1_prereqs}";
print "$1.d: \$(wildcard $PROGRAM_NAME \${$1_prereqs})"

3
bin/printnet Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
open $1.dot

BIN
bin/reb2sac Executable file

Binary file not shown.

11
bin/remote.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
scp $2.xml $1:/tmp/.
scp $2.properties $1:/tmp/.
ssh $1 "reb2sac --target.encoding=$3 /tmp/$2.xml"
scp $1:"*.tsd" .
ssh $1 "rm *.tsd"
if [ "scp $1:sim-rep.txt ." ]; then
echo "No sim-rep.txt file"
else
ssh $1 "rm sim-rep.txt"
fi

6
bin/remoteATACS.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
scp $3.lpn $1:/tmp/.
ssh $1 "atacs $2 /tmp/$3.lpn"
scp $1:"atacs.log" .
scp $1:/tmp/$3.prg .
ssh $1 "rm /tmp/$3.prg"

6
bin/remoteTangATACS.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
scp $2.lpn tang.ece.utah.edu:/tmp/.
ssh tang.ece.utah.edu "/home/tang/myers/BioSim/bin/atacs $1 /tmp/$2.lpn"
scp tang.ece.utah.edu:"atacs.log" .
scp tang.ece.utah.edu:/tmp/$2.prg .
ssh tang.ece.utah.edu "rm /tmp/$2.prg"

11
bin/remoteTangSim.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
scp $1.xml tang.ece.utah.edu:/tmp/.
scp $1.properties tang.ece.utah.edu:/tmp/.
ssh tang.ece.utah.edu "setenv LD_LIBRARY_PATH /home/tang/myers/BioSim/lib64;/home/tang/myers/BioSim/bin/reb2sac --target.encoding=$2 /tmp/$1.xml"
scp tang.ece.utah.edu:"*.tsd" .
ssh tang.ece.utah.edu "rm *.tsd"
if [ "scp tang.ece.utah.edu:sim-rep.txt ." ]; then
echo "No sim-rep.txt file"
else
ssh tang.ece.utah.edu "rm sim-rep.txt"
fi