Update bin directory

This commit is contained in:
Chris Myers 2017-09-14 12:11:39 -06:00
parent 8d7e8fc8af
commit 9a4ae714ce
12 changed files with 1849 additions and 1 deletions

1
.gitignore vendored
View file

@ -1,7 +1,6 @@
/dist/
/target/
jsbml.log
/bin/
**/.DS_Store
**/.classpath
.settings/

BIN
bin/GeneNet Executable file

Binary file not shown.

BIN
bin/GeneNet.mac64 Executable file

Binary file not shown.

115
bin/apply_post_filter.pl Executable file
View file

@ -0,0 +1,115 @@
#!/usr/bin/perl
#*******************************************************************************
#
# This file is part of iBioSim. Please visit <http://www.async.ece.utah.edu/ibiosim>
# for the latest version of iBioSim.
#
# Copyright (C) 2017 University of Utah
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the Apache License. A copy of the license agreement is provided
# in the file named "LICENSE.txt" included with this software distribution
# and also available online at <http://www.async.ece.utah.edu/ibiosim/License>.
#
#*******************************************************************************
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);
}

152
bin/check_dot.pl Executable file
View file

@ -0,0 +1,152 @@
#!/usr/bin/perl
#*******************************************************************************
#
# This file is part of iBioSim. Please visit <http://www.async.ece.utah.edu/ibiosim>
# for the latest version of iBioSim.
#
# Copyright (C) 2017 University of Utah
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the Apache License. A copy of the license agreement is provided
# in the file named "LICENSE.txt" included with this software distribution
# and also available online at <http://www.async.ece.utah.edu/ibiosim/License>.
#
#*******************************************************************************
#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;

1190
bin/gcm2sbml.pl Executable file

File diff suppressed because it is too large Load diff

41
bin/genBackgroundGCM.pl Executable file
View file

@ -0,0 +1,41 @@
#!/usr/bin/perl
#*******************************************************************************
#
# This file is part of iBioSim. Please visit <http://www.async.ece.utah.edu/ibiosim>
# for the latest version of iBioSim.
#
# Copyright (C) 2017 University of Utah
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the Apache License. A copy of the license agreement is provided
# in the file named "LICENSE.txt" included with this software distribution
# and also available online at <http://www.async.ece.utah.edu/ibiosim/License>.
#
#*******************************************************************************
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"

339
bin/gen_GeneNet_report.pl Executable file
View file

@ -0,0 +1,339 @@
#!/usr/bin/perl
#*******************************************************************************
#
# This file is part of iBioSim. Please visit <http://www.async.ece.utah.edu/ibiosim>
# for the latest version of iBioSim.
#
# Copyright (C) 2017 University of Utah
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the Apache License. A copy of the license agreement is provided
# in the file named "LICENSE.txt" included with this software distribution
# and also available online at <http://www.async.ece.utah.edu/ibiosim/License>.
#
#*******************************************************************************
$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();

12
bin/iBioSim Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
#
# run-time wrapper for BioSim gui
export DYLD_LIBRARY_PATH=$BIOSIM/lib64:$DYLD_LIBRARY_PATH
CLASSPATH=$BIOSIM/gui/dist/classes:$BIOSIM/gui
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/iBioSim.jar Normal file

Binary file not shown.

BIN
bin/reb2sac Executable file

Binary file not shown.

BIN
bin/reb2sac.mac64 Executable file

Binary file not shown.