pyneuroml.annotations module#
Methods related to annotations
File: pyneuroml/annotations.py
Copyright 2024 NeuroML contributors
- pyneuroml.annotations.create_annotation(subject, title=None, abstract=None, annotation_style: Literal['miriam', 'biosimulations'] = 'biosimulations', description: str | None = None, keywords: List[str] | None = None, thumbnails: List[str] | None = None, organisms: Dict[str, str] | None = None, encodes_other_biology: Dict[str, str] | None = None, has_version: Dict[str, str] | None = None, is_version_of: Dict[str, str] | None = None, has_part: Dict[str, str] | None = None, is_part_of: Dict[str, str] | None = None, has_property: Dict[str, str] | None = None, is_property_of: Dict[str, str] | None = None, sources: Dict[str, str] | None = None, is_instance_of: Dict[str, str] | None = None, has_instance: Dict[str, str] | None = None, predecessors: Dict[str, str] | None = None, successors: Dict[str, str] | None = None, see_also: Dict[str, str] | None = None, references: Dict[str, str] | None = None, other_ids: Dict[str, str] | None = None, citations: Dict[str, str] | None = None, authors: Dict[str, str] | None = None, contributors: Dict[str, str] | None = None, license: Dict[str, str] | None = None, funders: Dict[str, str] | None = None, creation_date: str | None = None, modified_dates: List[str] | None = None, serialization_format: str = 'pretty-xml', write_to_file: str | None = None)#
Create an RDF annotation from the provided fields
Added in version 1.2.10.
This can be used to create an RDF annotation for a subject—a model or a file like an OMEX archive file. It supports most qualifiers and will be continuously updated to support more as they are added.
It merely uses rdflib to make life easier for users to create annotations by coding in the various predicates for each subject.
For information on the specifications, see:
COMBINE specifications: combine-org/combine-specifications
Biosimulations guidelines: https://docs.biosimulations.org/concepts/conventions/simulation-project-metadata/
MIRIAM guidelines: https://drive.google.com/file/d/1JqjcH0T0UTWMuBj-scIMwsyt2z38A0vp/view
Note that:
not all qualifiers have been included yet
the qualifiers and their representations may change in the future
For any arguments here that take a dictionary of strings, the key is the resource reference URI, and the value is the string label. For example:
encodes_other_biology={ "http://identifiers.org/GO:0009653": "anatomical structure morphogenesis", "http://identifiers.org/kegg:ko04111": "Cell cycle - yeast", }
- Parameters:
subject (str) – subject/target of the annotation could be a file, a mode component
title (str) – title of annotation This is required for publishing models on biosimulations.org
abstract (str) – an abstract
annotation_style (str) –
type of annotation: either “miriam” or “biosimulations” (default).
There’s a difference in the annotation “style” suggested by MIRIAM and Biosimulations. MIRIAM suggests the use of RDF containers (bags) wherewas Biosimulations does not. This argument allows the user to select what style they want to use for the annotation.
description (str) – a longer description
keywords (list(str)) – keywords
thumbnails (list(str)) – thumbnails
organisms (dict(str, str)) – of organisms
encodes_other_biology (dict(str, str)) – other biological entities
has_version (dict(str, str)) – other versions
is_version_of (dict(str, str)) – is a version of
has_part (dict(str, str)) – includes another as a part
is_part_of (dict(str, str)) – is a part of another entity
has_property (dict(str, str)) – has a property
is_property_of (dict(str, str)) – is a property of another entity
sources (dict(str, str)) – links to sources (on GitHub and so on)
is_instance_of (dict(str, str)) – is an instance of
has_instance (dict(str, str)) – has instance of another entity
predecessors (dict(str, str)) – predecessors of this entity
successors (dict(str, str)) – successors of this entity
see_also (dict(str, str)) – more information
references (dict(str, str)) – references
other_ids (dict(str, str)) – other IDs
citations (dict(str, str)) – related citations
authors (dict(str, str)) – authors
contributors (dict(str, str)) – other contributors
license (dict(str, str)) – license
funders (dict(str, str)) – funders
creation_date (str) – date in YYYY-MM-DD format when this was created (eg: 2024-04-19)
modified_dates (list(str)) – dates in YYYY-MM-DD format when modifications were made
serialization_format (str) – format to serialize in using rdflib.serialize
write_to_file (str) – path to file to write to
- Returns:
the annotation string in the requested format.
- pyneuroml.annotations.extract_annotations(nml2_file: str) None #
Extract and print annotations from a NeuroML 2 file.
- Parameters:
nml2_file (str) – name of NeuroML2 file to parse