diff --git a/isatools/convert/isatab2json.py b/isatools/convert/isatab2json.py index 5da882c5..f04db50e 100644 --- a/isatools/convert/isatab2json.py +++ b/isatools/convert/isatab2json.py @@ -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 diff --git a/isatools/model/context.py b/isatools/model/context.py index 2b64cd35..fe4ddbc8 100644 --- a/isatools/model/context.py +++ b/isatools/model/context.py @@ -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__) diff --git a/isatools/resources/schemas/isa_model_version_1_0_schemas/core/process_schema.json b/isatools/resources/schemas/isa_model_version_1_0_schemas/core/process_schema.json index 4f4a0daa..919ccda3 100644 --- a/isatools/resources/schemas/isa_model_version_1_0_schemas/core/process_schema.json +++ b/isatools/resources/schemas/isa_model_version_1_0_schemas/core/process_schema.json @@ -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" }, diff --git a/isatools/resources/schemas/v1.0.1/study_schema.json b/isatools/resources/schemas/v1.0.1/study_schema.json index 6bea2e33..a17ae952 100644 --- a/isatools/resources/schemas/v1.0.1/study_schema.json +++ b/isatools/resources/schemas/v1.0.1/study_schema.json @@ -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", @@ -105,6 +111,10 @@ "$ref": "ontology_annotation_schema.json#" } }, + "license": { + "type": "string", + "enum": [""] + }, "comments" : { "type": "array", "items": { diff --git a/tests/convert/test_isatab2w4m.py b/tests/convert/test_isatab2w4m.py index 5e474743..30e05bcb 100644 --- a/tests/convert/test_isatab2w4m.py +++ b/tests/convert/test_isatab2w4m.py @@ -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 diff --git a/tests/model/test_to_dict.py b/tests/model/test_to_dict.py index 2f9b6cd1..d42b58eb 100644 --- a/tests/model/test_to_dict.py +++ b/tests/model/test_to_dict.py @@ -177,7 +177,7 @@ def test_study_to_dict(self): # Test study design descriptors study.design_descriptors = [ - OntologyAnnotation(term_accession='accession1', term_source='source1', term='name1', id_='id1', + OntologyAnnotation(term_accession='accession1', term_source=OntologySource(name='source1'), term='name1', id_='id1', comments=comments) ] expected_dict['studyDesignDescriptors'] = [ @@ -261,7 +261,6 @@ def setUp(self): def test_to_ld(self): - self.maxDiff = None comment_1 = Comment(name='comment_1', value='value_1') @@ -312,13 +311,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()) + diff --git a/tests/validators/test_validate_test_data.py b/tests/validators/test_validate_test_data.py index e4e31057..33fb9840 100644 --- a/tests/validators/test_validate_test_data.py +++ b/tests/validators/test_validate_test_data.py @@ -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"])