Package: incawrapper
incawrapperincawrapper is a Python package which wraps for the matlab application INCA. INCA is a tool for
13C metabolic flux analysis. The incawrapper package allows to import data,
setup the model and run INCA all from within Python. The results can be exported
back to Python for further analysis and simply saved as .csv files. Furthermore, it is possible to
export results from INCA runs entirely done through the GUI to Python.What can the incawrapper do for me?Provide a Python interface to use INCA 100% independent of the INCA GUIProvide a data structure that can be imported to INCAProvide methods for exporting results from INCA to PythonProvide methods for plotting results from INCA in PythonProvide methods for creating INCA models with data, which can then be used in the INCA GUIRun both Isotopically Non-Stationary (INS) and Isotopically Stationary (IS) 13C-MFAEstimate fluxes and confidence intervals through the following INCA algorithms: estimate, parameter continuation, and Monte Carlo samplingWhat can the incawrapper NOT do for me?Integration of NMR dataSimulation of experimentsOptimization of experimental designHow to use it?This is an extremely quick show case of the incawrapper for more extensive examples please see our documentation page.First, load your data typically atom mapped reactions, tracers information, flux measurements and MS measurements into pandas dataframes.importpandasaspdtracers_data=pd.read_csv("tracers.csv",converters={'atom_mdv':ast.literal_eval,'atom_ids':ast.literal_eval}# a trick to read lists from csv)reactions_data=pd.read_csv("reactions.csv")flux_data=pd.read_csv("flux_measurements.csv")ms_data=pd.read_csv("ms_measurements.csv",converters={'labelled_atom_ids':ast.literal_eval}# a trick to read lists from csv)Then create the inca script and specify the options and which INCA algorithms to execute.importincawrapperoutput_file="name/of/results/file.mat"script=incawrapper.create_inca_script_from_data(reactions_data,tracers_data,flux_data,ms_data,experiment_ids=["exp1"])script.add_to_block("options",incawrapper.define_options(fit_starts=5,sim_na=False))script.add_to_block("runner",incawrapper.define_runner(output_file,run_estimate=True,run_simulation=True,run_continuation=True))Now you are ready to run the inca script.fromincawrapperimportrun_incainca_directory="path/to/inca/installation"run_inca(script,INCA_base_directory=inca_directory)INCA will now run in the background and execute the specified algorithms and store the results in theoutput_file. This file can be open in the INCA GUI (using Open Flux Map) or imported into Python:res=incawrapper.INCAResults(output_file)res.fitdata.fitted_parameters.head()typeideqnvalstdlbubfree...0Net fluxR1A -> B101e-059.99998100...1Net fluxR2 netB <-> D6.084150.06800215.94776.21821...2Exch fluxR2 exchB <-> D6.620230.3306346.001077.352861...3Net fluxR3B -> C + E1.957920.03400111.89092.026151...4Net fluxR4B + C -> D + E + E1.957920.03400111.89092.026150...InstallationFor now, in order to install the incawrapper package,clone this repositoryonto your machine. Once ready, find the path to the base folder of your incawrapper clone and pip install the package like this>>> cd /path/to/incawrapper/base/folder>>> pip install ".[matlab]"Once released, incawrapper will be pip-installable. In a terminal, write>>> pip install incawrapper[matlab]Supported Matlab and INCA versionsBoth Matlab and INCA requires licenses which makes it difficult to automate testing of verison compatibility. For that reason will we only ensure compatibility with one INCA and one Matlab version.Currently supporting:Matlab 2023a, andINCA v2.2.Documentation and examplesExample use cases and a description of the API can be found inour documentation(not uploaded yet).ContributingWe welcome all contributions.  Please follow the guidelines below when contributing code.Quick startFork the repositoryClone the repositoryMake a new branch fromdevelop(see git model below) with your feature or fixSubmit a pull requestGit modelPlease use theGitFlow modelDocumentationPlease use theNumpy docstringsformatCommit messagesPlease use the following standard for commit messagesfix: ...for all commits that deal with fixing an issuefeat: ...for all commits that deal with adding a new featuretests:...for all commits that deal with unit testingbuild:...for all commits that deal with the CI infrastructure and deploymentPull requestsPlease use the following PR title and description standards:The PR title should be short and descriptive.  Work in progress reviews should be titled asWIP:...and all other should follow the above for commit messages.The PR description should describe 1) new features, 2) fixes, and 3) other changesPR acceptance rulesIn order to accept a PR, the following must be satisfied:All new functions and classes have corresponding unit testsAll new functions and classes are documented using the correct styleAll unit tests, linting tests, and integration tests passAll new code is reviewed and approved by a repository maintainer