diff --git a/bin/README.md b/bin/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/bin/measure-scaling-performance.sh b/bin/measure-scaling-performance.sh new file mode 100755 index 0000000..5da52f8 --- /dev/null +++ b/bin/measure-scaling-performance.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# # # # # +# +# Function to call the requisite Haskell and Python binary/script (respectively) +# which will generate the results data and figures presented in the paper. +# +# # # # # + +function using() +{ + ./bin/generate-timings $5 \ + --data "data-sets/$1.afasta" \ + --tree "data-sets/$1.tree" \ + --tcm "data-sets/tcm-${2}.tcm" \ + --output "$1-$2" \ + -n "$3" \ + -k "$4" + + python3 ./bin/plot-figure.py \ + "replicate-results/csv/${1}-${2}.preorder.csv" \ + "replicate-results/img/${1}-preorder.eps" + + python3 ./bin/plot-figure.py \ + "replicate-results/csv/${1}-${2}.postorder.csv" \ + "replicate-results/img/${1}-postorder.eps" +} + +"$@" diff --git a/plot-figure.py b/bin/plot-figure.py similarity index 99% rename from plot-figure.py rename to bin/plot-figure.py index e381532..32338f4 100644 --- a/plot-figure.py +++ b/bin/plot-figure.py @@ -1,3 +1,5 @@ +#!/bin/python3 + from mpl_toolkits import mplot3d import math import matplotlib.pyplot as plt diff --git a/cabal.project b/cabal.project index 63d8835..114d0a7 100644 --- a/cabal.project +++ b/cabal.project @@ -1,9 +1,8 @@ -allow-newer: - base, - Cabal, - ghc-prim, - template-haskell +installdir: ./bin + +install-method: copy packages: . with-compiler: ghc-9.2.1 + diff --git a/makefile b/makefile new file mode 100755 index 0000000..3e0ce25 --- /dev/null +++ b/makefile @@ -0,0 +1,69 @@ +# # # # # +# +# Script to reproduce the results of the paper from a clean environment. +# Installs all required dependencies. Builds the required binaries. +# Run the experimental algorithm on datasets to generate the empirical results. +# +# # # # # + +bin-dir := ./bin +data-dir := replicate-results +executable := $(bin-dir)/generate-timings +generate := $(bin-dir)/measure-scaling-performance.sh using +biological-scale := [1%1,1%2,1%4,1%8,1%16,1%32] +customized-scale := [1%1,1%2,1%4,1%8,1%16,1%32,1%64] +customized-nodes := [4,8,16,32,64,128,256] + + +# All synonyms for replicating the paper's results. +all: results + +replicate: results + +reproduce: results + +results: fungi metazoa pathological + + +# Install dependencies required to replicate results: +ensure-Haskell: $(bin-dir)/generate-timings + @command -v ghcup &> /dev/null || curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh + +ensure-Python: + @command -v python3 &> /dev/null || apt-get install python3 --yes + @command -v pip3 &> /dev/null || apt-get install python3-pip --yes + @pip3 show matplotlib &> /dev/null || pip3 install --upgrade matplotlib + +ensure-R: + command -v &> /dev/null || sudo apt install r-base + +compile-binaries: ensure-Haskell + @echo "Copiling binaries" + @ghcup run \ + --ghc 9.2.1 \ + --cabal 3.6.2.0 \ + -- cabal update && \ + cabal install \ + --installdir=$(bin-dir) \ + --install-method=copy + +ensure-workspace: + @mkdir -p $(data-dir)/csv + @mkdir -p $(data-dir)/data + @mkdir -p $(data-dir)/img + @mkdir -p $(data-dir)/taxa + @mkdir -p $(data-dir)/tree + +fungi: compile-binaries ensure-Python ensure-R ensure-workspace + $(generate) \ + 'fungi' '11' '[25,50,100,200,400,800,1553]' $(biological-scale) + +metazoa: compile-binaries ensure-Python ensure-R ensure-workspace + $(generate) \ + 'metazoa' '11' '[25,50,100,200,400,800,1766]' $(biological-scale) + +pathological: compile-binaries ensure-Python ensure-R ensure-workspace + $(generate) \ + 'pathological' '12' $(customized-nodes) $(customized-scale) + $(generate) \ + 'pathological' '31' $(customized-nodes) $(customized-scale) '--no-generate' diff --git a/replicate-results.sh b/replicate-results.sh index 93690f8..d467c40 100755 --- a/replicate-results.sh +++ b/replicate-results.sh @@ -1,65 +1,67 @@ #!/bin/bash -#Script to run implied alingment data sets -#load Haskell dependencies -which stack || curl -sSL https://get.haskellstack.org/ | sh -#load Python3 dependencies -which python3 || apt-get install python3 --yes -which pip3 || apt-get install python3-pip --yes -pip3 show matplotlib || pip3 install --upgrade matplotlib +# # # # # +# +# Script to reproduce the results of the paper from a clean environment. +# Installs all required dependencies. Builds the required binaries. +# Run the experimental algorithm on datasets to generate the empirical results. +# +# # # # # -#load R dependencies -which R || sudo apt install r-base -#build binaries -stack install +# Install dependencies required to replicate results: +# * Load Python3 dependencies +which python3 &> /dev/null || apt-get install python3 --yes +which pip3 &> /dev/null || apt-get install python3-pip --yes +pip3 show matplotlib &> /dev/null || pip3 install --upgrade matplotlib -#ensure target directories exist +# * Load R dependencies +which R &> /dev/null || sudo apt install r-base + +# * Load Haskell dependencies +which ghcup &> /dev/null || curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh + + +# Build binaries +ghcup run \ + --ghc 9.2.1 \ + --cabal 3.6.2.0 \ + -- cabal update && \ + cabal install \ + --installdir=./bin \ + --install-method=copy + + +# Ensure output directories exist to place results data mkdir -p replicate-results/csv mkdir -p replicate-results/data mkdir -p replicate-results/img mkdir -p replicate-results/taxa mkdir -p replicate-results/tree -#run data sets -./bin/generate-timings \ - --data data-sets/fungi.afasta \ - --tree data-sets/fungi.tree \ - --tcm data-sets/tcm-11.tcm \ - --output fungi-11 \ - -n [25,50,100,200,400,800,1553] \ - -k [1%1,1%2,1%4,1%8,1%16,1%32] -python3 plot-figure.py replicate-results/csv/fungi-11.preorder.csv replicate-results/img/fungi-preorder.eps -python3 plot-figure.py replicate-results/csv/fungi-11.postorder.csv replicate-results/img/fungi-postorder.eps -./bin/generate-timings \ - --data data-sets/metazoa.afasta \ - --tree data-sets/metazoa.tree \ - --tcm data-sets/tcm-11.tcm \ - --output metazoa-11 \ - -n [25,50,100,200,400,800,1766] \ - -k [1%1,1%2,1%4,1%8,1%16,1%32] -python3 plot-figure.py replicate-results/csv/metazoa-11.preorder.csv replicate-results/img/metazoa-preorder.eps -python3 plot-figure.py replicate-results/csv/metazoa-11.postorder.csv replicate-results/img/metazoa-postorder.eps +# Run data sets to produce the results data +function generate() +{ + ./bin/generate-timings $5 \ + --data "data-sets/$1.afasta" \ + --tree "data-sets/$1.tree" \ + --tcm "data-sets/tcm-${2}.tcm" \ + --output "$1-$2" \ + -n "$3" \ + -k "$4" + + python3 plot-figure.py \ + "replicate-results/csv/${1}-${2}.preorder.csv" \ + "replicate-results/img/${1}-preorder.eps" -./bin/generate-timings \ - --data data-sets/pathological.afasta \ - --tree data-sets/pathological.tree \ - --tcm data-sets/tcm-12.tcm \ - --output pathological-12 \ - -n [4,8,16,32,64,128,256] \ - -k [1%1,1%2,1%4,1%8,1%16,1%32,1%64] -python3 plot-figure.py replicate-results/csv/pathological-12.preorder.csv replicate-results/img/pathological-12-preorder.eps -python3 plot-figure.py replicate-results/csv/pathological-12.postorder.csv replicate-results/img/pathological-12-postorder.eps + python3 plot-figure.py \ + "replicate-results/csv/${1}-${2}.postorder.csv" \ + "replicate-results/img/${1}-postorder.eps" +} -./bin/generate-timings \ - --no-generate \ - --data data-sets/pathological.afasta \ - --tree data-sets/pathological.tree \ - --tcm data-sets/tcm-31.tcm \ - --output pathological-31 \ - -n [4,8,16,32,64,128,256] \ - -k [1%1,1%2,1%4,1%8,1%16,1%32,1%64] -python3 plot-figure.py replicate-results/csv/pathological-31.preorder.csv replicate-results/img/pathological-31-preorder.eps -python3 plot-figure.py replicate-results/csv/pathological-31.postorder.csv replicate-results/img/pathological-31-postorder.eps +generate 'fungi' '11' '[25,50,100,200,400,800,1553]' '[1%1,1%2,1%4,1%8,1%16,1%32]' +generate 'metazoa' '11' '[25,50,100,200,400,800,1766]' '[1%1,1%2,1%4,1%8,1%16,1%32]' +generate 'pathological' '12' '[4,8,16,32,64,128,256]' '[1%1,1%2,1%4,1%8,1%16,1%32,1%64]' +generate 'pathological' '31' '[4,8,16,32,64,128,256]' '[1%1,1%2,1%4,1%8,1%16,1%32,1%64]' '--no-generate'