Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All objects that have comments field inherit from CommentedIsaBase. #50

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 21 additions & 35 deletions mars-cli/mars_lib/models/isa_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ class Comment(IsaBase):
value: Optional[str] = None


class OntologySourceReference(IsaBase):
class CommentedIsaBase(IsaBase):
comments: List[Comment] = []


class OntologySourceReference(CommentedIsaBase):
description: Optional[str] = None
file: Optional[str] = None
name: Optional[str] = None
Expand All @@ -35,9 +38,8 @@ class DataTypeEnum(str, Enum):
FREE_INDUCTION_DECAY_FILE = "Free Induction Decay File" # TODO: QUESTION: This is not mentioned in the specs (https://isa-specs.readthedocs.io/)


class Data(IsaBase):
class Data(CommentedIsaBase):
id: Optional[str] = Field(alias="@id", default=None)
comments: List[Comment] = []
name: Optional[str] = None
type: Optional[DataTypeEnum] = None

Expand All @@ -48,32 +50,28 @@ def apply_enum(cls, v: str) -> str:
return v


class OntologyAnnotation(IsaBase):
class OntologyAnnotation(CommentedIsaBase):
id: Optional[str] = Field(alias="@id", default=None)
annotationValue: Union[Optional[str], Optional[float], Optional[int]] = Field(
default=None
)
comments: List[Comment] = []
termAccession: Optional[str] = None
termSource: Optional[str] = Field(
description="The abbreviated ontology name. It should correspond to one of the sources as specified in the ontologySourceReference section of the Investigation.",
default=None,
)


class MaterialAttributeValue(IsaBase):
# TODO: QUESTION: comments field is not mentioned in the specs (https://isa-specs.readthedocs.io/en/latest/isajson.html#material-attribute-value-schema-json)
class MaterialAttributeValue(CommentedIsaBase):
id: Optional[str] = Field(alias="@id", default=None)
category: Optional[MaterialAttribute] = None
value: Union[str, float, int, OntologyAnnotation, None] = None
unit: Optional[OntologyAnnotation] = None
comments: List[Comment] = Field(
default=[]
) # TODO: QUESTION: This is not mentioned in the specs (https://isa-specs.readthedocs.io/en/latest/isajson.html#material-attribute-value-schema-json)


class Factor(IsaBase):
class Factor(CommentedIsaBase):
id: Optional[str] = Field(alias="@id", default=None)
comments: List[Comment] = []
factorName: Optional[str] = None
factorType: Optional[OntologyAnnotation] = None

Expand All @@ -85,24 +83,20 @@ class FactorValue(IsaBase):
unit: Optional[OntologyAnnotation] = None


class Source(IsaBase):
# TODO: QUESTION: comments field is not mentioned in the specs (https://isa-specs.readthedocs.io/en/latest/isajson.html#material-attribute-value-schema-json)
class Source(CommentedIsaBase):
id: Optional[str] = Field(alias="@id", default=None)
characteristics: List[MaterialAttributeValue] = []
name: Optional[str] = None
comments: List[Comment] = Field(
default=[]
) # TODO: QUESTION: This is not mentioned in the specs (https://isa-specs.readthedocs.io/en/latest/isajson.html#source-schema-json)


class Sample(IsaBase):
# TODO: QUESTION: comments field is not mentioned in the specs (https://isa-specs.readthedocs.io/en/latest/isajson.html#material-attribute-value-schema-json)
class Sample(CommentedIsaBase):
id: Optional[str] = Field(alias="@id", default=None)
name: Optional[str] = None
characteristics: List[MaterialAttributeValue] = []
factorValues: List[FactorValue] = []
derivesFrom: List[Source] = []
comments: List[Comment] = Field(
default=[]
) # TODO: QUESTION: This is not mentioned in the specs (https://isa-specs.readthedocs.io/en/latest/isajson.html#sample-schema-json)


class ProtocolParameter(IsaBase):
Expand All @@ -122,9 +116,8 @@ class Component(IsaBase):
componentType: Optional[OntologyAnnotation] = None


class Protocol(IsaBase):
class Protocol(CommentedIsaBase):
id: Optional[str] = Field(alias="@id", default=None)
comments: List[Comment] = []
components: List[Component] = []
description: Optional[str] = None
name: Optional[str] = None
Expand All @@ -142,10 +135,9 @@ class MaterialTypeEnum(str, Enum):
LIBRARY_NAME = "library name" # TODO: QUESTION: This is not mentioned in the specs (https://isa-specs.readthedocs.io/en/latest/isajson.html#material-schema-json) but was found in DataHub ISA-JSON and ARC ISA-JSON.


class Material(IsaBase):
class Material(CommentedIsaBase):
id: Optional[str] = Field(alias="@id", default=None)
characteristics: List[MaterialAttributeValue] = []
comments: List[Comment] = []
name: Optional[str] = None
type: Optional[str] = None
derivesFrom: List[Material] = []
Expand All @@ -157,9 +149,8 @@ def apply_enum(cls, v: str) -> str:
return v


class Process(IsaBase):
class Process(CommentedIsaBase):
id: Optional[str] = Field(alias="@id", default=None)
comments: List[Comment] = []
date: Optional[str] = None
executesProtocol: Optional[Protocol] = None
inputs: Optional[Union[List[Source], List[Sample], List[Material], list[Data]]] = []
Expand All @@ -179,10 +170,9 @@ class AssayMaterialType(IsaBase):
otherMaterials: List[Material] = []


class Assay(IsaBase):
class Assay(CommentedIsaBase):
id: Optional[str] = Field(alias="@id", default=None)
characteristicCategories: List[MaterialAttribute] = []
comments: List[Comment] = []
dataFiles: List[Data] = []
filename: Optional[str] = None
materials: Optional[AssayMaterialType] = None
Expand Down Expand Up @@ -212,11 +202,10 @@ def detect_target_repo_comments(cls, v: List[Comment]) -> Optional[List[Comment]
)


class Person(IsaBase):
class Person(CommentedIsaBase):
id: Optional[str] = Field(alias="@id", default=None)
address: Optional[str] = None
affiliation: Optional[str] = None
comments: List[Comment] = []
email: Optional[str] = None
fax: Optional[str] = None
firstName: Optional[str] = None
Expand All @@ -226,9 +215,8 @@ class Person(IsaBase):
roles: List[OntologyAnnotation] = []


class Publication(IsaBase):
class Publication(CommentedIsaBase):
authorList: Optional[str] = None
comments: List[Comment] = []
doi: Optional[str] = None
pubMedID: Optional[str] = None
status: Optional[OntologyAnnotation] = None
Expand All @@ -246,11 +234,10 @@ class MaterialAttribute(IsaBase):
characteristicType: Optional[OntologyAnnotation] = None


class Study(IsaBase):
class Study(CommentedIsaBase):
id: Optional[str] = Field(alias="@id", default=None)
assays: List[Assay] = []
characteristicCategories: List[MaterialAttribute] = []
comments: List[Comment] = []
description: Optional[str] = None
factors: List[Factor] = []
filename: Optional[str] = None
Expand All @@ -267,9 +254,8 @@ class Study(IsaBase):
unitCategories: List[OntologyAnnotation] = []


class Investigation(IsaBase):
class Investigation(CommentedIsaBase):
id: Optional[str] = Field(alias="@id", default=None)
comments: List[Comment] = []
description: Optional[str] = None
filename: Optional[str] = None
identifier: Optional[str] = None
Expand Down