Skip to content

Commit f0de36b

Browse files
Merge pull request #390 from NeuroML/feat/annotations-is
Add `bqbiol.is`
2 parents e90c02f + 87ccc69 commit f0de36b

File tree

2 files changed

+132
-3
lines changed

2 files changed

+132
-3
lines changed

pyneuroml/annotations.py

Lines changed: 131 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def __init__(self):
9393
"description": DC.description,
9494
"keywords": PRISM.keyword,
9595
"thumbnails": COLLEX.thumbnail,
96+
"is_": BQBIOL.Is,
9697
"organisms": BQBIOL.hasTaxon,
9798
"encodes_other_biology": BQBIOL.encodes,
9899
"has_version": BQBIOL.hasVersion,
@@ -129,6 +130,7 @@ def create_annotation(
129130
xml_header: bool = True,
130131
indent: int = 12,
131132
description: typing.Optional[str] = None,
133+
is_: typing.Optional[typing.List[str]] = None,
132134
keywords: typing.Optional[typing.List[str]] = None,
133135
thumbnails: typing.Optional[typing.List[str]] = None,
134136
organisms: typing.Optional[typing.Dict[str, str]] = None,
@@ -219,6 +221,8 @@ def create_annotation(
219221
:type indent: int
220222
:param description: a longer description
221223
:type description: str
224+
:param is_: biological entity represented by the model
225+
:type is_: dict(str, str)
222226
:param keywords: keywords
223227
:type keywords: list(str)
224228
:param thumbnails: thumbnails
@@ -819,12 +823,136 @@ def _URIRef_or_Literal(astr: str) -> typing.Union[URIRef, Literal]:
819823
def create_annotation(*args, **kwargs):
820824
"""Wrapper around the Annotations.create_annotation method.
821825
826+
.. versionadded:: 1.2.13
827+
822828
Please see :py:func:`pyneuroml.annotations.Annotation.create_annotation` for detailed
823-
documentation.
829+
documentation. The doc string is pasted below for convenience:
824830
825-
.. versionadded:: 1.2.13
831+
This can be used to create an RDF annotation for a subject---a model or a
832+
file like an OMEX archive file. It supports most qualifiers and will be
833+
continuously updated to support more as they are added.
834+
835+
It merely uses rdflib to make life easier for users to create annotations
836+
by coding in the various predicates for each subject.
837+
838+
For information on the specifications, see:
839+
840+
- COMBINE specifications: https://github.com/combine-org/combine-specifications/blob/main/specifications/qualifiers-1.1.md
841+
- Biosimulations guidelines: https://docs.biosimulations.org/concepts/conventions/simulation-project-metadata/
842+
- MIRIAM guidelines: https://drive.google.com/file/d/1JqjcH0T0UTWMuBj-scIMwsyt2z38A0vp/view
843+
844+
845+
Note that:
846+
847+
- not all qualifiers have been included yet
848+
- the qualifiers and their representations may change in the future
849+
850+
For any arguments here that take a dictionary of strings, the key is the
851+
resource reference URI, and the value is the string label. For example:
852+
853+
.. code-block:: python
854+
855+
encodes_other_biology={
856+
"http://identifiers.org/GO:0009653": "anatomical structure morphogenesis",
857+
"http://identifiers.org/kegg:ko04111": "Cell cycle - yeast",
858+
}
826859
827-
:returns: annotation string
860+
:param subject: subject/target of the annotation
861+
could be a file, a mode component
862+
:type subject: str
863+
:param title: title of annotation
864+
This is required for publishing models on biosimulations.org
865+
:type title: str
866+
:param abstract: an abstract
867+
:type abstract: str
868+
:param annotation_style: type of annotation: either "miriam" or
869+
"biosimulations" (default).
870+
871+
There's a difference in the annotation "style" suggested by MIRIAM and
872+
Biosimulations. MIRIAM suggests the use of RDF containers (bags)
873+
wherewas Biosimulations does not. This argument allows the user to
874+
select what style they want to use for the annotation.
875+
:type annotation_style: str
876+
:param serialization_format: format to serialize in using `rdflib.serialize`
877+
878+
See: https://rdflib.readthedocs.io/en/stable/plugin_serializers.html
879+
880+
:type serialization_format: str
881+
:param xml_header: toggle inclusion of xml header if serializing in xml format
882+
:type xml_header: bool
883+
:param indent: number of spaces to use to indent the annotation block
884+
:type indent: int
885+
:param description: a longer description
886+
:type description: str
887+
:param is_: biological entity represented by the model
888+
:type is_: dict(str, str)
889+
:param keywords: keywords
890+
:type keywords: list(str)
891+
:param thumbnails: thumbnails
892+
:type thumbnails: list(str)
893+
:param organisms: of organisms
894+
:type organisms: dict(str, str)
895+
:param encodes_other_biology: other biological entities
896+
:type encodes_other_biology: dict(str, str)
897+
:param has_version: other versions
898+
:type has_version: dict(str, str)
899+
:param is_version_of: is a version of
900+
:type is_version_of: dict(str, str)
901+
:param has_part: includes another as a part
902+
:type has_part: dict(str, str)
903+
:param is_part_of: is a part of another entity
904+
:type is_part_of: dict(str, str)
905+
:param has_property: has a property
906+
:type has_property: dict(str, str)
907+
:param is_property_of: is a property of another entity
908+
:type is_property_of: dict(str, str)
909+
:param sources: links to sources (on GitHub and so on)
910+
:type sources: dict(str, str)
911+
:param is_instance_of: is an instance of
912+
:type is_instance_of: dict(str, str)
913+
:param has_instance: has instance of another entity
914+
:type has_instance: dict(str, str)
915+
:param predecessors: predecessors of this entity
916+
:type predecessors: dict(str, str)
917+
:param successors: successors of this entity
918+
:type successors: dict(str, str)
919+
:param see_also: more information
920+
:type see_also: dict(str, str)
921+
:param references: references
922+
:type references: dict(str, str)
923+
:param other_ids: other IDs
924+
:type other_ids: dict(str, str)
925+
:param citations: related citations
926+
:type citations: dict(str, str)
927+
:param authors: authors
928+
929+
This can either be:
930+
931+
- a set: :code:`{"Author A", "Author B"}`
932+
- a dictionary where the keys are author names and values are
933+
dictionaries of more metadata:
934+
935+
:code:`{"Author A": {"https://../": "accountname", "..": ".."}}`
936+
937+
The inner dictionary should have the reference or literal as key, and
938+
can take a "label", which can be any of the FOAF attributes:
939+
940+
http://xmlns.com/foaf/spec/#sec-glance
941+
942+
:type authors: dict(str, dict(str, str) or set
943+
:param contributors: other contributors, follows the same format as authors
944+
:type contributors: dict(str, dict(str, str) or set
945+
:param license: license
946+
:type license: dict(str, str)
947+
:param funders: funders
948+
:type funders: dict(str, str)
949+
:param creation_date: date in YYYY-MM-DD format when this was created (eg: 2024-04-19)
950+
:type creation_date: str
951+
:param modified_dates: dates in YYYY-MM-DD format when modifications were made
952+
:type modified_dates: list(str)
953+
:param write_to_file: path to file to write to
954+
:type write_to_file: str
955+
:returns: the annotation string in the requested format.
828956
829957
"""
830958
new_annotation = Annotation()

tests/test_annotations.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class TestAnnotations(BaseTestCase):
3232
"organisms": {
3333
"http://identifiers.org/taxonomy/4896": "Schizosaccharomyces pombe"
3434
},
35+
"is_": {"http://uri.neuinfo.org/nif/nifstd/nifext_2511": "An ion channel"},
3536
"encodes_other_biology": {
3637
"http://identifiers.org/GO:0009653": "anatomical structure morphogenesis",
3738
"http://identifiers.org/kegg:ko04111": "Cell cycle - yeast",

0 commit comments

Comments
 (0)