libSBML C API  libSBML 5.20.2 C API
Loading...
Searching...
No Matches
addingEvidenceCodes_1.c

Adds controlled vocabulary terms to a reaction in a model.

Adds controlled vocabulary terms to a reaction in a model.

/**
* \file addingEvidenceCodes_1.c
* \brief adds controlled vocabulary terms to a reaction in a model
* \author Sarah Keating
*
* <!--------------------------------------------------------------------------
* This sample program is distributed under a different license than the rest
* of libSBML. This program uses the open-source MIT license, as follows:
*
* Copyright (c) 2013-2018 by the California Institute of Technology
* (California, USA), the European Bioinformatics Institute (EMBL-EBI, UK)
* and the University of Heidelberg (Germany), with support from the National
* Institutes of Health (USA) under grant R01GM070923. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Neither the name of the California Institute of Technology (Caltech), nor
* of the European Bioinformatics Institute (EMBL-EBI), nor of the University
* of Heidelberg, nor the names of any contributors, may be used to endorse
* or promote products derived from this software without specific prior
* written permission.
* ------------------------------------------------------------------------ -->
*/
#include <stdio.h>
#include <sbml/SBMLTypes.h>
int
main (int argc, char *argv[])
{
Model_t* m;
unsigned int errors, n;
if (argc != 3)
{
printf("\n"
" usage: addingEvidenceCodes_1 <input-filename> <output-filename>\n"
" Adds controlled vocabulary term to a reaction\n"
"\n");
return 2;
}
d = readSBML(argv[1]);
if (errors > 0)
{
printf("Read Error(s):\n");
printf("Correct the above and re-run.\n");
}
else
{
if (n <= 0)
{
printf( "Model has no reactions.\n Cannot add CV terms\n");
}
else
{
CVTerm_t *cv1, *cv2;
r = Model_getReaction(m, 0);
/* check that the reaction has a metaid
* no CVTerms will be added if there is no metaid to reference
*/
SBase_setMetaId((SBase_t*)r, "metaid_0000052");
CVTerm_addResource(cv1, "urn:miriam:obo.eco:ECO%3A0000183");
CVTerm_addResource(cv2, "urn:miriam:kegg.reaction:R00756");
CVTerm_addResource(cv2, "urn:miriam:reactome:REACT_736");
writeSBML(d, argv[2]);
}
}
return errors;
}
void CVTerm_free(CVTerm_t *term)
_tFrees_t _tthe_t _tgiven_t _tCVTerm_t_t _tstructure_t.
Definition CVTerm.cpp:713
CVTerm_t * CVTerm_createWithQualifierType(QualifierType_t type)
@_tendcond_t
Definition CVTerm.cpp:697
int CVTerm_addResource(CVTerm_t *term, const char *resource)
_tAdds_t _ta_t _tresource_t _tto_t _tthe_t _tCVTerm_t_t.
Definition CVTerm.cpp:829
int CVTerm_setBiologicalQualifierType(CVTerm_t *term, BiolQualifierType_t type)
_tSets_t _tthe_t #_tBiolQualifierType_t_t _tof_t _tthis_t CVTerm_t_t.
Definition CVTerm.cpp:798
Definition of a CVTerm_t class for adding annotations to a Model_t.
@ BQB_IS
Definition CVTerm.h:402
@ BQB_IS_DESCRIBED_BY
Definition CVTerm.h:429
@ BIOLOGICAL_QUALIFIER
Definition CVTerm.h:332
unsigned int Model_getNumReactions(const Model_t *m)
_tGet_t _tthe_t _tnumber_t _tof_t _tReaction_t_t _tstructures_t _tin_t _tthe_t _tgiven_t _tModel_t_t ...
Definition Model.cpp:8205
Reaction_t * Model_getReaction(Model_t *m, unsigned int n)
_tGet_t _tthe_t _tnth_t _tReaction_t_t _tstructure_t _tcontained_t _tin_t _tthe_t _tgiven_t _tModel_t...
Definition Model.cpp:8078
void SBMLDocument_printErrors(SBMLDocument_t *d, FILE *stream)
_tPrints_t _tto_t _tthe_t _tgiven_t _toutput_t _tstream_t _tall_t _tthe_t _terrors_t _tor_t _twarning...
Definition SBMLDocument.cpp:2525
unsigned int SBMLDocument_getNumErrors(const SBMLDocument_t *d)
_tReturns_t _tthe_t _tnumber_t _tof_t _terrors_t _tor_t _twarnings_t _tencountered_t _tduring_t _tpar...
Definition SBMLDocument.cpp:2510
void SBMLDocument_free(SBMLDocument_t *d)
_tFrees_t _tthe_t _tgiven_t _tSBMLDocument_t_t _tstructure_t.
Definition SBMLDocument.cpp:2248
Model_t * SBMLDocument_getModel(SBMLDocument_t *d)
_tReturns_t _tthe_t _tModel_t_t _tstructure_t _tstored_t _tin_t _tthis_t _tSBMLDocument_t_t _tstructu...
Definition SBMLDocument.cpp:2290
SBMLDocument_t * readSBML(const char *filename)
@_tcopydoc_t _tdoc_readsbmlfromfile_t
Definition SBMLReader.cpp:446
Include all SBML types in a single header file.
int writeSBML(const SBMLDocument_t *d, const char *filename)
_tWrites_t _tthe_t _tgiven_t _tSBML_t _tdocument_t @_tp_t _td_t _tto_t _tthe_t _tfile_t _tnamed_t _tb...
Definition SBMLWriter.cpp:440
int SBase_setMetaId(SBase_t *sb, const char *metaid)
_tSets_t _tthe_t _tvalue_t _tof_t _tthe_t "_tmetaid_t" _tattribute_t _tof_t _tthe_t _tgiven_t _tstruc...
Definition SBase.cpp:7645
int SBase_isSetMetaId(const SBase_t *sb)
_tPredicate_t _treturning_t @_tc_t _t1_t (_ttrue_t) _tor_t @_tc_t _t0_t (_tfalse_t) _tdepending_t _to...
Definition SBase.cpp:7597
int SBase_addCVTerm(SBase_t *sb, CVTerm_t *term)
@_tendcond_t
Definition SBase.cpp:7373