Skip to content

Commit

Permalink
Merge branch 'develop' into issue-511
Browse files Browse the repository at this point in the history
  • Loading branch information
proccaserra authored Feb 11, 2024
2 parents 8a6870c + d246d77 commit 2d692db
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion isatools/convert/isatab2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
log = logging.getLogger('isatools')

SCHEMAS_PATH = join(os.path.dirname(os.path.realpath(__file__)),
"../resources/schemas/v1.0.1/")
"..", "resources", "schemas", "isa_model_version_1_0_schemas", "core")
INVESTIGATION_SCHEMA = "investigation_schema.json"

# REGEXES
Expand Down
1 change: 1 addition & 0 deletions isatools/model/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def __init__(self) -> None:
def gen_id(self) -> str:
""" Generate an identifier for the object. """
prepend = self.context.prepend_url if self.context.prepend_url else ''

if isinstance(self, Identifiable):
return self.id if self.id.startswith('http') else prepend + self.id
return prepend + gen_id(self.__class__.__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"type": "object",
"properties": {
"@id": { "type": "string", "format": "uri-reference" },
"@context": { "type": "string", "format": "uri-reference"},
"@type" : { "type": "string", "enum": ["Process"] },
"@context": { "type": "string", "format": "uri-reference"},
"@type" : { "type": "string", "enum": ["Process"] },
"name": {
"type": "string"
},
Expand Down
10 changes: 10 additions & 0 deletions isatools/resources/schemas/v1.0.1/study_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@
"$ref": "factor_schema.json#"
}
},
"study_groups": {
"type": "array",
"items": {
"$ref": "study_group.json#"
}
},
"characteristicCategories": {
"description": "List of all the characteristics categories (or material attributes) defined in the study, used to avoid duplication of their declaration when each material_attribute_value is created. ",
"type": "array",
Expand All @@ -105,6 +111,10 @@
"$ref": "ontology_annotation_schema.json#"
}
},
"license": {
"type": "string",
"enum": [""]
},
"comments" : {
"type": "array",
"items": {
Expand Down
2 changes: 1 addition & 1 deletion tests/convert/test_isatab2w4m.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def plain_test(self, study, test_dir):
output_file = os.path.join(self._tmp_dir, '.'.join(
['-'.join([study, 'w4m', x]), 'tsv']))
self.assertTrue(os.path.exists(output_file))
self.assertTrue(filecmp.cmp(output_file, ref_file),
self.assertTrue(filecmp.cmp(output_file, ref_file, shallow=False),
'Output file "{0}" differs from reference file "{1}".'.format(output_file, ref_file))

# Test MTBLS30
Expand Down
10 changes: 3 additions & 7 deletions tests/model/test_to_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def test_study_to_dict(self):
self.assertEqual(study.to_dict(), expected_dict)

# Test study design descriptors
study.design_descriptors = [
study.design_descriptors =
OntologyAnnotation(term_accession='accession1',
term_source=OntologySource(name='source1'),
term='name1', id_='id1',
Expand Down Expand Up @@ -263,7 +263,6 @@ def setUp(self):

def test_to_ld(self):


self.maxDiff = None

comment_1 = Comment(name='comment_1', value='value_1')
Expand Down Expand Up @@ -314,13 +313,10 @@ def test_to_ld(self):
self.investigation.publications = [publication]
self.investigation.studies = [study]

inv_ld = self.investigation.to_ld()
investigation = Investigation()
investigation.from_dict(inv_ld)
self.assertEqual(investigation.to_dict(), self.investigation.to_dict())

set_context(vocab='wd', all_in_one=False, local=False)

inv_ld = self.investigation.to_ld()
investigation = Investigation()
investigation.from_dict(inv_ld)
self.assertEqual(investigation.to_dict(), self.investigation.to_dict())

3 changes: 3 additions & 0 deletions tests/validators/test_validate_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,12 @@ def test_validate_testdata_treatment_sequence_json(self):
class TestPerformerValidation(unittest.TestCase):
def test_ptx(self):
filepath = os.path.join(utils.TAB_DATA_DIR, 'TEST-PTX', 'i_investigation.txt')

with open(filepath) as fp:
investigation = isatab.load(fp)
print(investigation.title)

with open(filepath) as fp:
report = isatab.validate(fp)
print(report["errors"])

Expand Down

0 comments on commit 2d692db

Please # to comment.