Skip to content

Instantly share code, notes, and snippets.

View paulflang's full-sized avatar

Paul Lang paulflang

View GitHub Profile
@paulflang
paulflang / case23_structural_simplify_issue.jl
Created June 6, 2022 22:06
structural_simplify complains about extra variables despite ODEProblem does just fine, even when checkl_length_true
using Downloads, SBMLToolkit#pl-refactor_v0.1.13
using OrdinaryDiffEq, ModelingToolkit
case = "00023"
sbml_url = "https://raw.githubusercontent.com/sbmlteam/sbml-test-suite/master/cases/semantic/$case/$case"*"-sbml-l3v2.xml"
sbml = String(take!(Downloads.download(sbml_url, IOBuffer())))
ml = readSBMLFromString(sbml, doc -> begin
set_level_and_version(3, 2)(doc)
convert_simplify_math(doc)
@paulflang
paulflang / mwe_fix_unassigned_nonconstant_par_to_init.jl
Created June 1, 2022 22:18
MWE to illustrate the requirement for fix_unassigned_nonconstant_par_to_init (without it I get: ERROR: ExtraVariablesSystemException: The system is unbalanced. There are 4 highest order derivative variables and 3 equations.)
using SBMLToolkit
using SBML
using Catalyst
using Downloads
case = "00170"
function read_case(case)
base_url = "https://raw.githubusercontent.com/sbmlteam/sbml-test-suite/master/cases/semantic/$case/$case"
sbml_url = base_url*"-sbml-l3v2.xml"
@paulflang
paulflang / mwe_case_00375.jl
Created May 23, 2022 12:06
mwe for sbml test suite case 00375
################################################
# Critical dependencies from Manifest.toml:
# [[SBML]]
# deps = ["DocStringExtensions", "IfElse", "Libdl", "SBML_jll", "SparseArrays", "Symbolics", "Unitful"]
# git-tree-sha1 = "79cff18661b3a649ba852e23d70c8e9415f933f3"
# repo-rev = "pl-extensivemath_compID"
# repo-url = "https://github.com/paulflang/SBML.jl.git"
# uuid = "e5567a89-2604-4b09-9718-f5f78e97c3bb"
# version = "0.10.1"
@paulflang
paulflang / states_neq_eqs.xml
Created May 14, 2022 18:05
Two enzyme catalysed reactions. Enzymes E1 and E2 appear on both sides of reaction and are boundaryCondition=false, constant=false. E2 is determined by an asssignmentRule
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created by COPASI version 4.27 (Build 217) on 2022-05-14 11:57 with libSBML version 5.18.0. -->
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:layout="http://www.sbml.org/sbml/level3/version1/layout/version1" xmlns:render="http://www.sbml.org/sbml/level3/version1/render/version1" level="3" version="1" layout:required="false" render:required="false">
<model metaid="COPASI0" id="New_Model" name="New Model" substanceUnits="substance" timeUnits="time" volumeUnits="volume" areaUnits="area" lengthUnits="length" extentUnits="substance">
<annotation>
<COPASI xmlns="http://www.copasi.org/static/sbml">
<rdf:RDF xmlns:dcterms="http://purl.org/dc/terms/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="#COPASI0">
<dcterms:created>
<rdf:Description>
@paulflang
paulflang / species_gt_eqs.xml
Created May 8, 2022 21:55
Valid SBML failing in convert(ODESystem, rs)
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created by COPASI version 4.27 (Build 217) on 2022-05-08 22:12 with libSBML version 5.18.0. -->
<sbml xmlns="http://www.sbml.org/sbml/level2/version4" level="2" version="4">
<model metaid="COPASI0" id="New_Model" name="New Model">
<annotation>
<COPASI xmlns="http://www.copasi.org/static/sbml">
<rdf:RDF xmlns:dcterms="http://purl.org/dc/terms/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="#COPASI0">
<dcterms:created>
<rdf:Description>