Skip to content

Commit

Permalink
Version 0.4.4
Browse files Browse the repository at this point in the history
- Removed a bug in the calculation of MCA
  • Loading branch information
charlesrocabert committed Dec 19, 2019
1 parent 5b80730 commit 290aa17
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 31 deletions.
12 changes: 7 additions & 5 deletions MetEvolSim.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: MetEvolSim
Version: 0.4.1
Version: 0.4.4
Summary: MetEvolSim (Metabolome Evolution Simulator) Python Package
Home-page: https://github.com/charlesrocabert/MetEvolSim
Author: Charles Rocabert, Gábor Boross, Balázs Papp
Expand All @@ -11,9 +11,11 @@ Description: <h1 align="center">MetEvolSim</h1>
<p align="center">
Python package dedicated to the evolution of metabolic concentrations
<br/><br/>
<a href="https://pypi.org/project/MetEvolSim/"><img src="https://img.shields.io/badge/pypi - 0.4.1-orange.svg" /></a>&nbsp;<a href="https://github.com/charlesrocabert/MetEvolSim/releases/latest"><img src="https://img.shields.io/badge/build - passing-green.svg" /></a>&nbsp;<a href="https://www.gnu.org/licenses/gpl-3.0"><img src="https://img.shields.io/badge/license-GPL v3-blue.svg" /></a>&nbsp;
<a href="https://pypi.python.org/pypi/MetEvolSim/"><img src="https://badge.fury.io/py/MetEvolSim.svg" /></a>
<a href="https://action-badges.now.sh/charlesrocabert/MetEvolSim"><img src="https://action-badges.now.sh/charlesrocabert/MetEvolSim" /></a>
<a href="https://github.com/charlesrocabert/MetEvolSim/LICENSE.html"><img src="https://img.shields.io/badge/License-GPLv3-blue.svg" /></a>
<br/>
<img src="https://github.com/charlesrocabert/MetEvolSim-development/raw/master/pic/metevolsim_logo.png" width=150>
<img src="https://github.com/charlesrocabert/MetEvolSim/raw/master/pic/metevolsim_logo.png" width=150>
</p>

-----------------
Expand All @@ -28,7 +30,7 @@ Description: <h1 align="center">MetEvolSim</h1>
</p>

<p align="center">
<img src="https://github.com/charlesrocabert/MetEvolSim-development/raw/master/pic/BRC_logo.png" height="100px"></a>&nbsp;&nbsp;&nbsp;<img src="https://github.com/charlesrocabert/MetEvolSim-development/raw/master/pic/MTA_logo.png" height="100px"></a>
<img src="https://github.com/charlesrocabert/MetEvolSim/raw/master/pic/BRC_logo.png" height="100px"></a>&nbsp;&nbsp;&nbsp;<img src="https://github.com/charlesrocabert/MetEvolSim/raw/master/pic/MTA_logo.png" height="100px"></a>
</p>

## Table of contents
Expand Down Expand Up @@ -110,7 +112,7 @@ Description: <h1 align="center">MetEvolSim</h1>

### Evolution experiments:
<p align="center">
<img src="https://github.com/charlesrocabert/MetEvolSim-development/raw/master/pic/mcmc_algorithm.png" height="200px">
<img src="https://github.com/charlesrocabert/MetEvolSim/raw/master/pic/mcmc_algorithm.png" height="200px">
</p>
<p align="justify">
<strong>Algorithm overview:</strong> <strong>A.</strong> The model of interest is loaded as a wild-type from a SBML file (kinetic equations, kinetic parameter values and initial metabolic concentrations must be specified). <strong>B.</strong> At each iteration <em>t</em>, a single kinetic parameter is selected at random and mutated through a log10-normal distribution of standard deviation &sigma;. <strong>C.</strong> The new steady-state is computed using Copasi software, and the MOMA distance <em>z</em> between the mutant and the wild-type target fluxes is computed. <strong>D.</strong> If <em>z</em> is under a given selection threshold &omega;, the mutation is accepted. Else, the mutation is discarded. <strong>E.</strong> A new iteration <em>t+1</em> is computed.
Expand Down
Binary file added dist/MetEvolSim-0.4.4-py3-none-any.whl
Binary file not shown.
Binary file added dist/MetEvolSim-0.4.4.tar.gz
Binary file not shown.
57 changes: 32 additions & 25 deletions metevolsim/metevolsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ def edit_WT_cps_file( self, task ):
elif task == "MCA":
edited_file += ' <ListOfTasks>\n'
edited_file += ' <Task key="Task_14" name="Steady-State" type="steadyState" scheduled="false" updateModel="false">\n'
edited_file += ' <Report reference="Report_10" target="test.txt" append="1" confirmOverwrite="1"/>\n'
edited_file += ' <Report reference="Report_10" target="" append="1" confirmOverwrite="1"/>\n'
edited_file += ' <Problem>\n'
edited_file += ' <Parameter name="JacobianRequested" type="bool" value="1"/>\n'
edited_file += ' <Parameter name="StabilityAnalysisRequested" type="bool" value="1"/>\n'
Expand All @@ -879,7 +879,7 @@ def edit_WT_cps_file( self, task ):
edited_file += ' </Method>\n'
edited_file += ' </Task>\n'
edited_file += ' <Task key="Task_20" name="Metabolic Control Analysis" type="metabolicControlAnalysis" scheduled="true" updateModel="false">\n'
edited_file += ' <Report reference="Report_14" target="test.txt" append="1" confirmOverwrite="1"/>\n'
edited_file += ' <Report reference="Report_14" target="WT_output.txt" append="1" confirmOverwrite="1"/>\n'
edited_file += ' <Problem>\n'
edited_file += ' <Parameter name="Steady-State" type="key" value="Task_14"/>\n'
edited_file += ' </Problem>\n'
Expand Down Expand Up @@ -920,7 +920,7 @@ def edit_mutant_cps_file( self, task ):
if task == "STEADY_STATE":
edited_file += ' <ListOfTasks>\n'
edited_file += ' <Task key="Task_14" name="Steady-State" type="steadyState" scheduled="true" updateModel="false">\n'
edited_file += ' <Report reference="Report_9" target="WT_output.txt" append="1" confirmOverwrite="1"/>\n'
edited_file += ' <Report reference="Report_9" target="mutant_output.txt" append="1" confirmOverwrite="1"/>\n'
edited_file += ' <Problem>\n'
edited_file += ' <Parameter name="JacobianRequested" type="bool" value="1"/>\n'
edited_file += ' <Parameter name="StabilityAnalysisRequested" type="bool" value="1"/>\n'
Expand All @@ -941,7 +941,7 @@ def edit_mutant_cps_file( self, task ):
elif task == "MCA":
edited_file += ' <ListOfTasks>\n'
edited_file += ' <Task key="Task_14" name="Steady-State" type="steadyState" scheduled="false" updateModel="false">\n'
edited_file += ' <Report reference="Report_10" target="test.txt" append="1" confirmOverwrite="1"/>\n'
edited_file += ' <Report reference="Report_10" target="" append="1" confirmOverwrite="1"/>\n'
edited_file += ' <Problem>\n'
edited_file += ' <Parameter name="JacobianRequested" type="bool" value="1"/>\n'
edited_file += ' <Parameter name="StabilityAnalysisRequested" type="bool" value="1"/>\n'
Expand All @@ -959,7 +959,7 @@ def edit_mutant_cps_file( self, task ):
edited_file += ' </Method>\n'
edited_file += ' </Task>\n'
edited_file += ' <Task key="Task_20" name="Metabolic Control Analysis" type="metabolicControlAnalysis" scheduled="true" updateModel="false">\n'
edited_file += ' <Report reference="Report_14" target="test.txt" append="1" confirmOverwrite="1"/>\n'
edited_file += ' <Report reference="Report_14" target="mutant_output.txt" append="1" confirmOverwrite="1"/>\n'
edited_file += ' <Problem>\n'
edited_file += ' <Parameter name="Steady-State" type="key" value="Task_14"/>\n'
edited_file += ' </Problem>\n'
Expand Down Expand Up @@ -1068,6 +1068,7 @@ def parse_copasi_output( self, filename, task ):
rownames = []
unscaled = []
scaled = []
N = 0
f = open(filename, "r")
l = f.readline()
while l:
Expand All @@ -1077,21 +1078,24 @@ def parse_copasi_output( self, filename, task ):
l = f.readline()
l = f.readline()
colnames = l.strip("\n\t").split("\t")
N = len(colnames)
l = f.readline()
for i in range(len(colnames)):
colnames[i] = colnames[i].strip("()")
while l != "\n":
l = l.strip("\n\t").split("\t")
N = len(l)
rownames.append(l[0].strip("()"))
unscaled.append(l[1:N])
rownames.append(l[0])
unscaled.append(l[1:(N+1)])
l = f.readline()
if l.startswith("Scaled concentration control coefficients"):
l = f.readline()
l = f.readline()
l = f.readline()
l = f.readline()
l = f.readline()
while l != "\n":
l = l.strip("\n\t").split("\t")
N = len(l)
scaled.append(l[1:N])
scaled.append(l[1:(N+1)])
l = f.readline()
break
l = f.readline()
Expand Down Expand Up @@ -1300,27 +1304,30 @@ def compute_WT_metabolic_control_analysis( self ):
rownames, colnames, unscaled, scaled = self.parse_copasi_output("./output/WT_output.txt", "MCA")

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# 3) Write control coefficients matrices #
# 3) Write control coefficients data #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
f = open("./output/WT_MCA_unscaled.txt", "w")
for colname in colnames:
f.write(" "+colname)
f.write("\n")
f.write("species_id species_value flux_id flux_value control_coef\n")
for i in range(len(rownames)):
f.write(rowname)
for elmt in unscaled[i]:
f.write(" "+elmt)
f.write("\n")
for j in range(len(colnames)):
species_id = rownames[i]
flux_id = colnames[j]
print(species_id, flux_id)
species_value = self.species[species_id]["WT_value"]
flux_value = self.reactions[flux_id]["WT_value"]
control_coef = unscaled[i][j]
f.write(species_id+" "+str(species_value)+" "+flux_id+" "+str(flux_value)+" "+control_coef+"\n")
f.close()
f = open("./output/WT_MCA_scaled.txt", "w")
for colname in colnames:
f.write(" "+colname)
f.write("\n")
f.write("species_id species_value flux_id flux_value control_coef\n")
for i in range(len(rownames)):
f.write(rowname)
for elmt in scaled[i]:
f.write(" "+elmt)
f.write("\n")
for j in range(len(colnames)):
species_id = rownames[i]
flux_id = colnames[j]
species_value = self.species[species_id]["WT_value"]
flux_value = self.reactions[flux_id]["WT_value"]
control_coef = scaled[i][j]
f.write(species_id+" "+str(species_value)+" "+flux_id+" "+str(flux_value)+" "+control_coef+"\n")
f.close()

### Compute mutant metabolic control analysis (MCA) ###
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

setup(
name = "MetEvolSim",
version = "0.4.3",
version = "0.4.4",
license = "GNU General Public License v3 (GPLv3)",
description = "MetEvolSim (Metabolome Evolution Simulator) Python Package",
long_description = long_description,
Expand Down

0 comments on commit 290aa17

Please sign in to comment.