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

Output content #8

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
root: true,
env: {
node: true,
es6: true,
},
'extends': [
'eslint:recommended'
],
parserOptions: {
parser: 'babel-eslint',
ecmaVersion: 11
}
}
23 changes: 23 additions & 0 deletions notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# TODO LIST:

- in protocol schema manualy create the "components" relationship and the corresponding file.

```
component model
"properties": {
"componentName": {
"type": "string"
},
"componentType": {
"$ref": "ontology_annotation_schema.json#"
},
"comments" : {
"type": "array",
"items": {
"$ref": "comment_schema.json#"
}
}
}
```

- manually curate `x_to_many` relations
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "isa2zendro",
"license": "MIT",
"repository": "https://github.com/Zendro-dev/ISA_Schema_to_Zendro_Definition",
"devDependencies": {
"eslint": "^6.7.2"
},
"scripts": {
"lint": "eslint utils.js",
"exec:silent": "node src/index.js",
"exec": "node src/index.js",
"exec:verbose": "node src/index.js mode=verbose"
}
}
37 changes: 37 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const fs = require("fs");
const utils = require("./utils.js");

if (require.main === module) {
const params = parseParams();
if (params.verbose) utils.setVerbose(true)
else utils.setVerbose(false)
fs.readdir("./src/isa_1_0_core/", (err, files) => {
let output = {};
files.forEach((file) => {
// console.log(`PROCESSING FILE ${file}`);
const schemaName = utils.getSchemaName(file),
i = require(`./isa_1_0_core/${file}`);
output[schemaName] = utils.processProperties(i.properties, schemaName);
utils.writeToFile({
name: schemaName,
value: output[schemaName]
})
});
utils.writeToFile({
name: "reverseRelations",
value: utils.relationMapping
})
});
}

function parseParams() {
const args = process.argv.slice(2);
let params = {
verbose: false
}
args.forEach((arg) => {
const split = arg.split("=");
if (split[0] === "mode" && split[1] === "verbose") params.verbose = true
});
return params;
}
77 changes: 77 additions & 0 deletions src/isa_1_0_core/assay_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Assay JSON Schema",
"name": "Assay JSON Schema",
"description": "JSON Schema describing an Assay",
"@context": {
"@base": "http://purl.org/isaterms/",
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"type": "object",
"properties": {
"@id": { "type": "string", "format": "uri" },
"filename" : { "type" : "string" },
"measurementType" : {
"$ref": "ontology_annotation_schema.json#"
},
"technologyType" : {
"type" : "object",
"properties": {
"ontologyAnnotation" : {
"$ref": "ontology_annotation_schema.json#"
}
}
},
"technologyPlatform" : { "type" : "string"},
"dataFiles" : {
"type": "array",
"items" : {
"$ref": "data_schema.json#"
}
},
"materials": {
"type": "object",
"properties": {
"samples": {
"type": "array",
"items": {
"$ref": "sample_schema.json#"
}
},
"otherMaterials": {
"type": "array",
"items": {
"$ref": "material_schema.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",
"items": {
"$ref": "material_attribute_schema.json#"
}
},
"unitCategories": {
"description": "List of all the unitsdefined in the study, used to avoid duplication of their declaration when each value is created. ",
"type": "array",
"items": {
"$ref": "ontology_annotation_schema.json#"
}
},
"processSequence": {
"type": "array",
"items" : {
"$ref" : "process_schema.json#"
}
},
"comments" : {
"type": "array",
"items": {
"$ref": "comment_schema.json#"
}
}
},
"additionalProperties": false
}
16 changes: 16 additions & 0 deletions src/isa_1_0_core/comment_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"title": "ISA comment schema - it corresponds to ISA Comment[] construct",
"description": "JSON-schema representing a comment in the ISA model",
"type": "object",
"properties": {
"@id": { "type": "string", "format": "uri" },
"name": {
"type": "string"
},
"value": {
"type": "string"
}
},
"additionalProperties": false
}
39 changes: 39 additions & 0 deletions src/isa_1_0_core/data_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"title": "ISA data schema",
"description": "JSON-schema representing a data file in the ISA model",
"type": "object",
"properties": {
"@id": { "type": "string", "format": "uri" },
"name": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"Raw Data File",
"Derived Data File",
"Image File",
"Acquisition Parameter Data File",
"Derived Spectral Data File",
"Protein Assignment File",
"Raw Spectral Data File",
"Peptide Assignment File",
"Array Data File",
"Derived Array Data File",
"Post Translational Modification Assignment File",
"Derived Array Data Matrix File",
"Free Induction Decay Data File",
"Metabolite Assignment File",
"Array Data Matrix File"
]
},
"comments" : {
"type": "array",
"items": {
"$ref": "comment_schema.json#"
}
}
},
"additionalProperties": false
}
23 changes: 23 additions & 0 deletions src/isa_1_0_core/factor_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"title": "ISA factor schema",
"name": "ISA factor schema",
"description": "JSON-schema representing a factor value in the ISA model",
"type": "object",
"properties": {
"@id": { "type": "string", "format": "uri" },
"factorName": {
"type": "string"
},
"factorType": {
"$ref": "ontology_annotation_schema.json#"
},
"comments" : {
"type": "array",
"items": {
"$ref": "comment_schema.json#"
}
}
},
"additionalProperties": false
}
29 changes: 29 additions & 0 deletions src/isa_1_0_core/factor_value_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"title": "ISA factor value schema",
"description": "JSON-schema representing a factor value in the ISA model",
"type": "object",
"properties": {
"@id": { "type": "string", "format": "uri" },
"category" : {
"$ref": "factor_schema.json#"
},
"value": {
"anyOf" : [
{ "$ref": "ontology_annotation_schema.json#"},
{ "type": "string"},
{ "type": "number"}
]
},
"unit": {
"$ref": "ontology_annotation_schema.json#"
},
"comments" : {
"type": "array",
"items": {
"$ref": "comment_schema.json#"
}
}
},
"additionalProperties": false
}
49 changes: 49 additions & 0 deletions src/isa_1_0_core/investigation_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"title" : "ISA investigation schema",
"description" : "JSON-schema representing an investigation in the ISA model",
"type" : "object",
"properties" : {
"@id": { "type": "string", "format": "uri" },
"filename": { "type" : "string"},
"identifier" : { "type" : "string" },
"title" : { "type" : "string"},
"description" : { "type" : "string"},
"submissionDate" : { "type" : "string", "format" : "date-time"},
"publicReleaseDate" : { "type" : "string", "format" : "date-time"},
"ontologySourceReferences" : {
"type" : "array",
"items" : {
"$ref": "ontology_source_reference_schema.json#"
}
},
"publications" : {
"type" : "array",
"items" : {
"$ref": "publication_schema.json#"

}
},
"people" : {
"type" : "array",
"items" : {
"$ref": "person_schema.json#"

}
},
"studies" : {
"type" : "array",
"items" : {
"$ref": "study_schema.json#"

}
},
"comments" : {
"type": "array",
"items": {
"$ref": "comment_schema.json#"
}
}
},
"additionalProperties": false
}
13 changes: 13 additions & 0 deletions src/isa_1_0_core/material_attribute_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"title" : "ISA material attribute schema",
"description" : "JSON-schema representing a characteristics category (what appears between the brackets in Charactersitics[]) in the ISA model",
"type" : "object",
"properties" : {
"@id": { "type": "string", "format": "uri" },
"characteristicType": {
"$ref": "ontology_annotation_schema.json#"
}
},
"additionalProperties": false
}
29 changes: 29 additions & 0 deletions src/isa_1_0_core/material_attribute_value_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"title" : "ISA material attribute schema",
"description" : "JSON-schema representing a material attribute (or characteristic) value in the ISA model",
"type" : "object",
"properties" : {
"@id": { "type": "string", "format": "uri" },
"category" : {
"$ref": "material_attribute_schema.json#"
},
"value": {
"anyOf" : [
{ "$ref": "ontology_annotation_schema.json#"},
{ "type": "string"},
{ "type": "number"}
]
},
"unit": {
"$ref": "ontology_annotation_schema.json#"
},
"comments" : {
"type": "array",
"items": {
"$ref": "comment_schema.json#"
}
}
},
"additionalProperties": false
}
Loading