Skip to content

annotator

Annotation of SBML models.

Handle the XML annotations and notes in SBML. Annotate models from information in annotation csv files. Thereby a model can be fully annotated from information stored in a separate annotation store.

Annotation is performed via searching for ontology terms which describe the model and model components. A standard workflow is looking up the components for instance in things like OLS ontology lookup service.

ExternalAnnotation

ExternalAnnotation(d)

Class for handling SBML annotations defined in external source.

This corresponds to a single entry in the external annotation file. Allows to handle more complex annotation scenarios, e.g. patterns for identifiers.

The columns are

pattern sbml_type annotation_type qualifier resource name

Initialize ExternalAnnotation.

Parameters:

Name Type Description Default
d dict[str, Any]

one row of the annotation file, pattern, sbml_type, annotation_type and resource are required, qualifier and name are optional.

required

Raises:

Type Description
KeyError

if a required column is missing

ValueError

if a value is not one of the supported choices

check

check()

Check for valid choices.

:raise: ValueError

ModelAnnotator

ModelAnnotator(doc, annotations)

Helper class for annotating SBML models.

Initialize ModelAnnotator.

:param doc: SBMLDocument :param annotations: iterable of ModelAnnotation

annotate_model

annotate_model()

Annotate the model with the given annotations.

get_SBMLQualifier staticmethod

get_SBMLQualifier(qualifier_str, qualifier_type)

Lookup of SBMLQualifier for given qualifier string.

:param qualifier_type: BQB or BQM :return: SBML qualifier string

annotate_sbase staticmethod

annotate_sbase(sbase, annotation)

Annotate SBase based on given annotation data.

:param sbase: libsbml.SBase :param annotation: Annotation :return:

read_annotations_df staticmethod

read_annotations_df(file_path, file_format='*')

Read annotations from given file into DataFrame.

Supports "xlsx", "tsv", "csv", "json", "*"

:param file_path: either path to file, or data in dict format :param file_format: annotation file format :return: pandas.DataFrame

read_annotations staticmethod

read_annotations(file_path, file_format='*')

Read annotations from given file into DataFrame.

Supports "xlsx", "tsv", "csv", "json", "*"

:param file_path: either path to file, or data in dict format :param file_format: annotation file format :return: list of annotation objects

annotate_sbml

annotate_sbml(source, annotations_path, filepath)

Annotate a given SBML file with the provided annotations.

:param source: SBML to annotation :param annotations_path: external file with annotations :param filepath: annotated SBML file :return: annotated SBMLDocument

annotate_sbml_doc

annotate_sbml_doc(doc, external_annotations)

Annotates given SBML document using the annotations file.

:param doc: SBMLDocument :param external_annotations: ModelAnnotations :return: annotated SBMLDocument