/// <summary> /// Gets the SBML identifier. /// </summary> /// <returns> /// The SBML identifier. /// </returns> /// <param name='model'> /// Model. /// </param> /// <param name='channel'> /// Channel. /// </param> /// <param name='type'> /// Type. /// </param> /// <param name='name'> /// Name. /// </param> static string GetSBMLId(CModel model, CPlotDataChannelSpec channel, out VariableType type, out string name) { var path = channel.getString(); var last = path.Substring(path.LastIndexOf(",", StringComparison.Ordinal) + 1); var first = path.Substring(0, path.LastIndexOf(",", StringComparison.Ordinal)); type = VariableType.Unknown; name = "unknown"; if (last.EndsWith("Rate") || last.EndsWith("ParticleNumber")) return null; if (model.getCN().getString() == first) { type = VariableType.Time; name = "Time"; return "time"; } for (int i = 0; i < model.getMetabolites().size(); i++) { var current = model.getMetabolite((uint)i); if (current.getCN().getString() == first) { type = VariableType.Species; name = current.getObjectDisplayName(); return current.getSBMLId(); } } for (int i = 0; i < model.getCompartments().size(); i++) { var current = model.getCompartment((uint)i); if (current.getCN().getString() == first) { type = VariableType.Compartment; name = current.getObjectDisplayName(); return current.getSBMLId(); } } for (int i = 0; i < model.getModelValues().size(); i++) { var current = model.getModelValue((uint)i); if (current.getCN().getString() == first) { type = VariableType.Parameter; name = current.getObjectDisplayName(); return current.getSBMLId(); } } for (int i = 0; i < model.getReactions().size(); i++) { var current = model.getReaction((uint)i); if (current.getCN().getString() == first) { type = VariableType.Reaction; name = current.getObjectDisplayName(); return current.getSBMLId(); } } return null; }