Skip to content

Commit 778d6e6

Browse files
author
oerc0042
committed
fix to isa model to enable serialization of @id for key objects, fixing associated tests, tweaks to json-ld context files
1 parent b8dd9a1 commit 778d6e6

22 files changed

Lines changed: 534 additions & 389 deletions

isa-cookbook/content/notebooks/isa-api-programmatic-rebuild-of-BII-S-3.ipynb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
"### Loading the ISA-API"
88
]
99
},
10+
{
11+
"cell_type": "code",
12+
"execution_count": null,
13+
"metadata": {},
14+
"outputs": [],
15+
"source": [
16+
"!pip install -e ."
17+
]
18+
},
1019
{
1120
"cell_type": "code",
1221
"execution_count": null,

isa-cookbook/content/notebooks/isa-json-conversion-to-rdf-linked-data.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@
4444
"metadata": {},
4545
"outputs": [],
4646
"source": [
47-
"#!pip install -e .\n",
48-
"!pwd"
47+
"!pip install -e .\n"
4948
]
5049
},
5150
{

isa-cookbook/content/notebooks/output/BII-S-3-synth/BII-S-3-isa.json

Lines changed: 265 additions & 265 deletions
Large diffs are not rendered by default.

isa-cookbook/content/notebooks/output/BII-S-3-synth/i_investigation.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ Study Factor Type chemical substance dose time
6161
Study Factor Type Term Accession Number http://purl.obolibrary.org/obo/CHEBI_59999 http://www.ebi.ac.uk/efo/EFO_0000428 http://purl.obolibrary.org/obo/PATO_0000165
6262
Study Factor Type Term Source REF CHEBI EFO PATO
6363
STUDY ASSAYS
64-
Study Assay File Name a_gilbert-assay-Gx.txt a_gilbert-assay-Tx.txt a_gilbert-assay-Gx.txt a_gilbert-assay-Tx.txt
65-
Study Assay Measurement Type metagenome sequencing transcription profiling metagenome sequencing transcription profiling
66-
Study Assay Measurement Type Term Accession Number http://purl.obolibrary.org/obo/OBI_0002623 http://purl.obolibrary.org/obo/OBI_0000424 http://purl.obolibrary.org/obo/OBI_0002623 http://purl.obolibrary.org/obo/OBI_0000424
67-
Study Assay Measurement Type Term Source REF OBI OBI OBI OBI
68-
Study Assay Technology Type nucleotide sequencing nucleotide sequencing nucleotide sequencing nucleotide sequencing
69-
Study Assay Technology Type Term Accession Number http://purl.obolibrary.org/obo/OBI_0000626 http://purl.obolibrary.org/obo/OBI_0000626 http://purl.obolibrary.org/obo/OBI_0000626 http://purl.obolibrary.org/obo/OBI_0000626
70-
Study Assay Technology Type Term Source REF OBI OBI OBI OBI
71-
Study Assay Technology Platform
64+
Study Assay File Name a_gilbert-assay-Gx.txt a_gilbert-assay-Tx.txt
65+
Study Assay Measurement Type metagenome sequencing transcription profiling
66+
Study Assay Measurement Type Term Accession Number http://purl.obolibrary.org/obo/OBI_0002623 http://purl.obolibrary.org/obo/OBI_0000424
67+
Study Assay Measurement Type Term Source REF OBI OBI
68+
Study Assay Technology Type nucleotide sequencing nucleotide sequencing
69+
Study Assay Technology Type Term Accession Number http://purl.obolibrary.org/obo/OBI_0000626 http://purl.obolibrary.org/obo/OBI_0000626
70+
Study Assay Technology Type Term Source REF OBI OBI
71+
Study Assay Technology Platform
7272
STUDY PROTOCOLS
7373
Study Protocol Name sample collection aliquoting-0 nucleic acid extraction mRNA extraction - standard procedure 3 genomic DNA extraction - standard procedure 4 reverse transcription - standard procedure 5 library construction nucleic acid sequencing sequence analysis - standard procedure 7
7474
Study Protocol Type sample collection sample collection nucleic acid extraction labeling nucleic acid extraction reverse transcription library construction nucleic acid sequencing data transformation
Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
query introspection {
2-
schemas: __schema {
3-
types { ...FullType }
2+
schemas: __schema {
3+
types { ...FullType }
44
}
55
}
66

@@ -16,7 +16,7 @@ fragment FullType on __Type {
1616
type { kind }
1717
}
1818
}
19-
fields(includeDeprecated: true) {
19+
fields(includeDeprecated: false) {
2020
name
2121
description
2222
args {...InputValue }
@@ -47,41 +47,41 @@ fragment TypeRef on __Type {
4747
kind
4848
name
4949
description
50-
ofType {
51-
name
52-
inputFields {
53-
name
54-
description
55-
defaultValue
56-
type {
57-
kind
58-
name
59-
description
60-
ofType {name}
61-
inputFields {
62-
name
63-
description
64-
defaultValue
65-
}
66-
}
67-
}
68-
}
69-
inputFields {
70-
name
71-
description
72-
defaultValue
73-
type {
74-
kind
75-
name
76-
description
77-
ofType {name}
78-
inputFields {
79-
name
80-
description
81-
defaultValue
82-
}
83-
}
84-
}
50+
# ofType {
51+
# name
52+
# inputFields {
53+
# name
54+
# description
55+
# defaultValue
56+
# type {
57+
# kind
58+
# name
59+
# description
60+
# ofType {name}
61+
# inputFields {
62+
# name
63+
# description
64+
# defaultValue
65+
# }
66+
# }
67+
# }
68+
# }
69+
# inputFields {
70+
# name
71+
# description
72+
# defaultValue
73+
# type {
74+
# kind
75+
# name
76+
# description
77+
# ofType {name}
78+
# inputFields {
79+
# name
80+
# description
81+
# defaultValue
82+
# }
83+
# }
84+
# }
8585
}
8686
}
8787
}

isatools/graphQL/utils/find.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def find_measurement(measurement_type, expected_value, operator):
2727
def find_exposure_value(sample, expected_value, target):
2828
"""
2929
Tests if a given sample contains the given factor value
30-
:param sample: the sample too look at
30+
:param sample: the sample to look at
3131
:param expected_value: the value to look for
3232
:param target: the target of sample to look into
3333
:return: {Boolean}
@@ -49,7 +49,7 @@ def find_exposure_value(sample, expected_value, target):
4949
def find_characteristics(sample, expected_value):
5050
"""
5151
Tests if a given sample contains the given characteristics
52-
:param sample: the sample too look at
52+
:param sample: the sample to look at
5353
:param expected_value: the value to look for
5454
:return: {Boolean}
5555
"""

isatools/graphQL/utils/validate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def validate_outputs(outputs):
2424

2525
def validate_target(inputs, input_type):
2626
"""
27-
Validate the target depending of the input_type.
27+
Validate the target depending on the input_type.
2828
:param inputs: the value to validate
2929
:param input_type: 'input' or 'output'
3030
:return: True or raise Exception

isatools/model/investigation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ def __ne__(self, other):
252252

253253
def to_dict(self, ld=False):
254254
investigation = {
255+
"@id": self.id,
255256
"identifier": self.identifier,
256257
"title": self.title,
257258
"description": self.description,
@@ -269,6 +270,7 @@ def to_ld(self):
269270
return self.to_dict(ld=True)
270271

271272
def from_dict(self, investigation):
273+
self.id = investigation.get("@id", "")
272274
self.identifier = investigation.get("identifier", "")
273275
self.title = investigation.get("title", "")
274276
self.public_release_date = investigation.get("publicReleaseDate", "")

isatools/model/person.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ def __ne__(self, other):
204204

205205
def to_dict(self, ld=False):
206206
person = {
207+
"@id": self.id,
207208
"address": self.address,
208209
"affiliation": self.affiliation,
209210
"comments": [comment.to_dict(ld=ld) for comment in self.comments],
@@ -218,6 +219,7 @@ def to_dict(self, ld=False):
218219
return self.update_isa_object(person, ld=ld)
219220

220221
def from_dict(self, person):
222+
self.id = person.get("@id", "")
221223
self.address = person["address"] if "address" in person else ""
222224
self.affiliation = person["affiliation"] if "affiliation" in person else ""
223225
self.email = person["email"] if "email" in person else ""

isatools/model/publication.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
from isatools.model.comments import Commentable
2+
from isatools.model.identifiable import Identifiable
23
from isatools.model.ontology_annotation import OntologyAnnotation
34

45

5-
class Publication(Commentable):
6+
class Publication(Commentable, Identifiable):
67
"""A publication associated with an investigation or study.
78
89
Attributes:
@@ -17,9 +18,10 @@ class Publication(Commentable):
1718
comments: Comments associated with instances of this class.
1819
"""
1920

20-
def __init__(self, pubmed_id="", doi="", author_list="", title="", status=None, comments=None):
21+
def __init__(self, id_="", pubmed_id="", doi="", author_list="", title="", status=None, comments=None):
2122
super().__init__(comments)
2223

24+
self.id = id_
2325
self.__pubmed_id = pubmed_id
2426
self.__doi = doi
2527
self.__author_list = author_list
@@ -127,6 +129,7 @@ def to_dict(self, ld=False):
127129
if isinstance(self.status, OntologyAnnotation):
128130
status = self.status.to_dict()
129131
publication = {
132+
"@id": self.id,
130133
"authorList": self.author_list,
131134
"doi": self.doi,
132135
"pubMedID": self.pubmed_id,
@@ -137,12 +140,12 @@ def to_dict(self, ld=False):
137140
return self.update_isa_object(publication, ld=ld)
138141

139142
def from_dict(self, publication):
143+
self.id = publication.get("@id", "")
140144
self.author_list = publication["authorList"] if "authorList" in publication else ""
141145
self.doi = publication["doi"] if "doi" in publication else ""
142146
self.pubmed_id = publication["pubMedID"] if "pubMedID" in publication else ""
143147
self.title = publication["title"] if "title" in publication else ""
144148
self.load_comments(publication.get("comments", []))
145-
146149
status = OntologyAnnotation()
147150
status.from_dict(publication.get("status", {}))
148151
self.status = status

0 commit comments

Comments
 (0)