Skip to content

Commit 8583733

Browse files
committed
GapFillpy with results
1 parent b769fa6 commit 8583733

File tree

3 files changed

+2540
-0
lines changed

3 files changed

+2540
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# For using this module, you have to create a virtual environment.
2+
# Once created, you run the following command:
3+
# pip install git+https://github.com/zhanglab/psamm-import.git
4+
#
5+
# Or you can follow this tutorial (useful for further information):
6+
# https://psamm.readthedocs.io/en/latest/index.html
7+
#
8+
# If attribute error due to fractions has no attribute "gcd", then modify the file
9+
# fractions.py importing gcd as follows:
10+
# from math import gcd
11+
#
12+
# Author: Sergio Pachón Dotor
13+
# Github: https://github.com/SergioPachonDotor
14+
15+
import os
16+
17+
model_name = 'iAF1260_mutant_delta_f6p_c'
18+
model_path_sbml = f'./genome/Mutants/{model_name}.xml'
19+
model_path_yaml= f'./genome/{model_name}_yaml/'
20+
results_path= f'../../results/{model_name}/'
21+
22+
def import_existing_model(ex_model_path=model_path_sbml, destination_path=model_path_yaml):
23+
os.system(f'psamm-import sbml --source {ex_model_path} --dest {destination_path}')
24+
25+
26+
def gapfind_and_gapcheck(solver='gurobi', model_path=model_path_yaml, deep_check=False, results_path=results_path, file_name='gapcheck', file_extension='txt'):
27+
28+
os.chdir(model_path)
29+
30+
if deep_check == True:
31+
os.system(f'psamm-model gapcheck --method prodcheck --solver name={solver} > {results_path}{model_name}_{file_name}_prodcheck.{file_extension}', objective= 'thr__L_c')
32+
os.system(f'psamm-model gapcheck --method sinkcheck --unrestricted-exchange --solver name={solver} > {results_path}{model_name}_{file_name}_sinkcheck_unrestricted-exchange.{file_extension}')
33+
os.system(f'psamm-model gapcheck --method gapfind --unrestricted-exchange --solver name={solver} > {results_path}{model_name}_{file_name}_gapfind_unrestricted-exchange.{file_extension}')
34+
35+
if deep_check == False:
36+
os.system(f'psamm-model gapcheck --method gapfind --unrestricted-exchange --solver name={solver} > {results_path}{model_name}_{file_name}_gapfind_unrestricted-exchange.{file_extension}')
37+
38+
39+
def gapfill_psamm(model_path=model_path_yaml, solver='gurobi', results_path=results_path, file_name='gapcheck', file_extension='txt'):
40+
os.chdir(model_path)
41+
os.system(f'psamm-model gapfill --solver name={solver} --epsilon 0.0001 --compound thr__L_c > {results_path}{model_name}_{file_name}_gapfill.{file_extension}')
42+
43+
def export_model():
44+
pass
45+
46+
47+
if __name__ == '__main__':
48+
# import_existing_model()
49+
# gapfind_and_gapcheck()
50+
# gapfill_psamm()
51+
pass

0 commit comments

Comments
 (0)