Skip to content

Instantly share code, notes, and snippets.

@fbergmann
fbergmann / print_stoichiometries.py
Created Jul 6, 2021
python script, extracting stoichiometries form SBML file, printing as LP
View print_stoichiometries.py
# -*- coding: utf-8 -*-
"""
Basic example program reading an SBML file going through the reactions
and printing the stoichiometries as constraints in LP format.
Created on Thu Apr 14 19:12:41 2016
@author: fbergmann
"""
View log.txt
==68052== Invalid write of size 8
==68052== at 0xCE09A4: CMathContainer::analyzeRoots() (CMathContainer.cpp:2721)
==68052== by 0xCDACFD: CMathContainer::compile() (CMathContainer.cpp:1405)
==68052== by 0x97E318: CModel::compile() (CModel.cpp:510)
==68052== by 0x97E946: CModel::compileIfNecessary(CProcessReport*) (CModel.cpp:602)
==68052== by 0xA848A6: SBMLImporter::createCModelFromSBMLDocument(SBMLDocument*, std::map<CDataObject const*, SBase*, std::less<CDataObject const*>, std::allocator<std::pair<CDataObject const* const, SBase*> > >&) (SBMLImporter.cpp:1558)
==68052== by 0xA9105C: SBMLImporter::parseSBML(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, CFunctionDB*, SBMLDocument*&, std::map<CDataObject const*, SBase*, std::less<CDataObject const*>, std::allocator<std::pair<CDataObject const* const, SBase*> > >&, CListOfLayouts*&, CDataModel*) (SBMLImporter.cpp:3744)
View test.patch
--- a/COPASI.R
+++ b/COPASI.R
@@ -94,7 +94,9 @@ function(name, .values, where = topenv(parent.frame()), suffix = "Value")
enumToInteger <- function(name,type)
{
if (is.character(name)) {
- ans <- as.integer(get(paste(".__E__", type, sep = ""))[name])
+ gettype <- paste(".__E__", type, sep = "")
+ if (!exists(gettype)) gettype <- paste(".__E__", substr(type, 3, nchar(type)), sep = "")
+ ans <- as.integer(get(gettype)[name])
View CMakeLists.txt
# example script using the copasi cmake config file
# that is usually installed into lib/cmake
cmake_minimum_required(VERSION 2.8.11)
project (example_copasi_program)
# this searches for the libcopasi-static-config.cmake file
# that is exported by COPASI and will figure out all the
# dependent libraries
find_package(libCOPASISE-static CONFIG REQUIRED)