forked from GeomScale/dingo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
198 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# dingo : a python library for metabolic networks sampling and analysis | ||
# dingo is part of GeomScale project | ||
|
||
# Copyright (c) 2021 Vissarion Fisikopoulos | ||
|
||
# Licensed under GNU LGPL.3, see LICENCE file | ||
|
||
name: dingo-ubuntu | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
#python-version: [2.7, 3.5, 3.6, 3.7, 3.8] | ||
python-version: [3.8] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Load submodules | ||
run: | | ||
git submodule update --init; | ||
- name: Download and unzip the boost library | ||
run: | | ||
wget -O boost_1_76_0.tar.bz2 https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2; | ||
tar xjf boost_1_76_0.tar.bz2; | ||
rm boost_1_76_0.tar.bz2; | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get install libsuitesparse-dev; | ||
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -; | ||
source $HOME/.poetry/env; | ||
export POETRY_VIRTUALENVS_PATH=/home/runner/.cache/pypoetry/virtualenvs | ||
poetry config virtualenvs.create false --local | ||
#source $(dirname $(poetry run which python))/activate | ||
poetry install; | ||
#pip3 install numpy scipy; | ||
- name: Run tests | ||
run: | | ||
#python3 tests/fba.py; | ||
#python3 tests/full_dimensional.py; | ||
python3 tests/max_ball.py; | ||
#python3 tests/scaling.py; | ||
#run all tests | ||
#python -m unittest discover test | ||
#TODO: use pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# dingo : a python library for metabolic networks sampling and analysis | ||
# dingo is part of GeomScale project | ||
|
||
# Copyright (c) 2021 Apostolos Chalkis | ||
|
||
# Licensed under GNU LGPL.3, see LICENCE file | ||
|
||
import unittest | ||
import os | ||
import scipy | ||
import numpy as np | ||
from dingo import MetabolicNetwork, PolytopeSampler | ||
from dingo.inner_ball import slow_inner_ball | ||
from dingo.scaling import gmscale | ||
|
||
|
||
class TestFba(unittest.TestCase): | ||
|
||
def test_ecoli(self): | ||
|
||
current_directory = os.getcwd() | ||
input_file_json = current_directory + "/ext_data/e_coli_core.json" | ||
|
||
model = MetabolicNetwork.from_json(input_file_json) | ||
model.set_slow_mode() | ||
|
||
res = model.fba() | ||
|
||
self.assertTrue(abs(res[1] - 0.8739215067486387) < 1e-03) | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# dingo : a python library for metabolic networks sampling and analysis | ||
# dingo is part of GeomScale project | ||
|
||
# Copyright (c) 2021 Apostolos Chalkis | ||
# Copyright (c) 2021 Vissarion Fisikopoulos | ||
|
||
# Licensed under GNU LGPL.3, see LICENCE file | ||
|
||
import unittest | ||
import os | ||
import scipy | ||
import numpy as np | ||
from dingo import MetabolicNetwork, PolytopeSampler | ||
from dingo.inner_ball import slow_inner_ball | ||
from dingo.scaling import gmscale | ||
|
||
|
||
class TestFullDim(unittest.TestCase): | ||
|
||
def test_ecoli(self): | ||
|
||
current_directory = os.getcwd() | ||
input_file_json = current_directory + "/ext_data/e_coli_core.json" | ||
|
||
model = MetabolicNetwork.from_json(input_file_json) | ||
sampler = PolytopeSampler(model) | ||
sampler.set_slow_mode() | ||
sampler.get_polytope() | ||
|
||
self.assertEqual(sampler.A.shape[0], 175) | ||
self.assertEqual(sampler.A.shape[1], 24) | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# dingo : a python library for metabolic networks sampling and analysis | ||
# dingo is part of GeomScale project | ||
|
||
# Copyright (c) 2021 Apostolos Chalkis | ||
# Copyright (c) 2021 Vissarion Fisikopoulos | ||
|
||
# Licensed under GNU LGPL.3, see LICENCE file | ||
|
||
import unittest | ||
import os | ||
import scipy | ||
import numpy as np | ||
from dingo import MetabolicNetwork, PolytopeSampler | ||
from dingo.inner_ball import slow_inner_ball | ||
from dingo.scaling import gmscale | ||
|
||
|
||
class TestMaxBall(unittest.TestCase): | ||
|
||
def test_simple(self): | ||
m = 2 | ||
n = 5 | ||
A = np.zeros((2 * n, n), dtype="float") | ||
A[0:n] = np.eye(n) | ||
A[n:] -= np.eye(n, n, dtype="float") | ||
b = np.ones(2 * n, dtype="float") | ||
|
||
max_ball = slow_inner_ball(A, b) | ||
|
||
self.assertTrue(abs(max_ball[1] - 1) < 1e-04) | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# dingo : a python library for metabolic networks sampling and analysis | ||
# dingo is part of GeomScale project | ||
|
||
# Copyright (c) 2021 Apostolos Chalkis | ||
# Copyright (c) 2021 Vissarion Fisikopoulos | ||
|
||
# Licensed under GNU LGPL.3, see LICENCE file | ||
|
||
import unittest | ||
import os | ||
import scipy | ||
import numpy as np | ||
from dingo import MetabolicNetwork, PolytopeSampler | ||
from dingo.inner_ball import slow_inner_ball | ||
from dingo.scaling import gmscale | ||
|
||
|
||
class TestScaling(unittest.TestCase): | ||
|
||
def test_ecoli(self): | ||
|
||
current_directory = os.getcwd() | ||
input_file_json = current_directory + "/ext_data/e_coli_core.json" | ||
|
||
model = MetabolicNetwork.from_json(input_file_json) | ||
|
||
res = gmscale(model.S, 0.99) | ||
|
||
self.assertTrue(abs(scipy.linalg.norm(res[0]) - 15.285577732002883) < 1e-03) | ||
self.assertTrue(abs(scipy.linalg.norm(res[1]) - 23.138373030721855) < 1e-03) | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |