bbop-graph-noctua
Advanced tools
Comparing version 0.0.6 to 0.0.7
110
lib/edit.js
@@ -402,3 +402,3 @@ /** | ||
annotations: [] | ||
} | ||
}; | ||
@@ -543,6 +543,7 @@ // Referenced instance ID. | ||
* @param {Array} [types] - list of types to pre-load | ||
* @param {Array} [inferred_types] - list of inferred types to pre-load | ||
* @returns {node} new bbop model node | ||
*/ | ||
noctua_graph.prototype.create_node = function(id, label, types){ | ||
return new noctua_node(id, label, types); | ||
noctua_graph.prototype.create_node = function(id, label, types, inferred_types){ | ||
return new noctua_node(id, label, types, inferred_types); | ||
}; | ||
@@ -668,3 +669,4 @@ | ||
var itypes = indv['type'] || []; | ||
new_node = anchor.create_node(iid, null, itypes); | ||
var inf_itypes = indv['inferred-type'] || []; | ||
new_node = anchor.create_node(iid, null, itypes, inf_itypes); | ||
@@ -1049,3 +1051,2 @@ // See if there is type info that we want to add. | ||
var inds = data['individuals']; | ||
//var i_inds = raw_resp['data']['individuals-i']; | ||
each(inds, function(ind){ | ||
@@ -1098,3 +1099,2 @@ anchor.add_node_from_individual(ind); | ||
var inds = data['individuals']; | ||
//var i_inds = raw_resp['data']['individuals-i']; | ||
each(inds, function(ind){ | ||
@@ -1254,5 +1254,6 @@ anchor.add_node_from_individual(ind); | ||
* @param {Array} [in_types] - list of Objects or strings--anything that can be parsed by class_expression | ||
* @param {Array} [in_inferred_types] - list of Objects or strings--anything that can be parsed by class_expression | ||
* @returns {this} | ||
*/ | ||
function noctua_node(in_id, in_label, in_types){ | ||
function noctua_node(in_id, in_label, in_types, in_inferred_types){ | ||
bbop_node.call(this, in_id, in_label); | ||
@@ -1262,4 +1263,6 @@ this._is_a = 'bbop-graph-noctua.node'; | ||
// Let's make this an OWL-like world. | ||
this._types = []; | ||
this._id2type = {}; | ||
this._inferred_types = []; | ||
this._id2type = {}; // contains map to both types and inferred types | ||
this._annotations = []; | ||
@@ -1273,3 +1276,2 @@ this._referenced_individuals = []; | ||
}else{ | ||
//this._id = in_id; | ||
this._id = in_id; | ||
@@ -1285,2 +1287,10 @@ } | ||
}); | ||
} | ||
// Same with inferred types. | ||
if( us.isArray(in_inferred_types) ){ | ||
each(in_inferred_types, function(in_inferred_type){ | ||
var new_type = new class_expression(in_inferred_type); | ||
anchor._id2type[new_type.id()] = new_type; | ||
anchor._inferred_types.push(new class_expression(in_inferred_type)); | ||
}); | ||
} | ||
@@ -1306,3 +1316,4 @@ | ||
// Fresh. | ||
var new_clone = new noctua_node(anchor.id(), anchor.label(), anchor.types()); | ||
var new_clone = new noctua_node(anchor.id(), anchor.label(), | ||
anchor.types(), anchor.inferred_types()); | ||
@@ -1349,5 +1360,8 @@ // Base class stuff. | ||
// Wipe previous type set. | ||
anchor._id2type = {}; | ||
each(anchor._types, function(t){ | ||
delete anchor._id2type[t.id()]; | ||
}); | ||
anchor._types = []; | ||
// Serially add new ondes. | ||
each(in_types, function(in_type){ | ||
@@ -1359,2 +1373,3 @@ var new_type = new class_expression(in_type); | ||
} | ||
return this._types; | ||
@@ -1364,2 +1379,31 @@ }; | ||
/** | ||
* Get current inferred types; replace current inferred types. | ||
* | ||
* Parameters: | ||
* @param {Array} [in_types] - raw JSON type objects | ||
* @returns {Array} array of types | ||
*/ | ||
noctua_node.prototype.inferred_types = function(in_types){ | ||
var anchor = this; | ||
if( us.isArray(in_types) ){ | ||
// Wipe previous type set. | ||
each(anchor._inferred_types, function(t){ | ||
delete anchor._id2type[t.id()]; | ||
}); | ||
anchor._inferred_types = []; | ||
// Serially add new ondes. | ||
each(in_types, function(in_type){ | ||
var new_type = new class_expression(in_type); | ||
anchor._id2type[new_type.id()] = new_type; | ||
anchor._inferred_types.push(new_type); | ||
}); | ||
} | ||
return this._inferred_types; | ||
}; | ||
/** | ||
* Add types to current types. | ||
@@ -1380,5 +1424,9 @@ * | ||
each(in_types, function(in_type){ | ||
var new_type = new class_expression(in_type, inf_p); | ||
var new_type = new class_expression(in_type); | ||
anchor._id2type[new_type.id()] = new_type; | ||
anchor._types.push(new_type); | ||
if( ! inferred_p ){ | ||
anchor._types.push(new_type); | ||
}else{ | ||
anchor._inferred_types.push(new_type); | ||
} | ||
@@ -1392,3 +1440,4 @@ ret = true; // return true if did something | ||
/** | ||
* If extant, get the type by its unique identifier. | ||
* If extant, get the type by its unique identifier. This works for | ||
* both inferred and non-inferred types generally. | ||
* | ||
@@ -1408,2 +1457,35 @@ * @param {String} type_id - type id | ||
/** | ||
* Essentially, get all of the "uneditable" inferred types from the | ||
* reasoner that are not duplicated in the regular (editable) types | ||
* listing. | ||
* | ||
* Returns originals. | ||
* | ||
* Note: the matching here is awful and should be redone (going by | ||
* very lossy string rep). | ||
* | ||
* @returns {Array} of {class_expression} | ||
*/ | ||
noctua_node.prototype.get_unique_inferred_types = function(){ | ||
var anchor = this; | ||
var ret = []; | ||
// Create a checkable representation of the types. | ||
var type_cache = {}; | ||
each(anchor.types(), function(t){ | ||
type_cache[t.to_string()] = true; | ||
}); | ||
// Do a lookup. | ||
each(anchor.inferred_types(), function(t){ | ||
if( ! type_cache[t.to_string()] ){ | ||
ret.push(t); | ||
} | ||
}); | ||
return ret; | ||
}; | ||
/** | ||
* Get/set the "contained" subgraph. This subgraph is still considered | ||
@@ -1410,0 +1492,0 @@ * to be part of the graph, but is "hidden" under this node for most |
{ | ||
"name": "bbop-graph-noctua", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"license": "BSD-3-Clause", | ||
@@ -5,0 +5,0 @@ "description": "A subclass of bbop-graph that layers on a complete annotation and graph editing model for the Noctua set of tools.", |
{ | ||
"data": { | ||
"individuals-i": [ | ||
"properties": [ | ||
{ | ||
"type": [ | ||
{ | ||
"id": "SGD:S000004659", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000004659-553ff9ed0000010" | ||
"label": "has input", | ||
"id": "RO:0002233", | ||
"type": "property" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"label": "GTPase inhibitor activity", | ||
"id": "GO:0005095", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel:taxon_559292-5525a0fc0000001-GO-0005095-5525a0fc0000009" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"label": "direct assay evidence", | ||
"id": "ECO:0000002", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000002-553ff9ed0000017" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"label": "enzyme assay evidence", | ||
"id": "ECO:0000005", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000005-553ff9ed0000003" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"id": "SGD:S000004529", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000004529-553ff9ed0000004" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"label": "enzyme assay evidence", | ||
"id": "ECO:0000005", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000005-553ff9ed0000001" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"label": "direct assay evidence", | ||
"id": "ECO:0000002", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000002-553ff9ed0000005" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"id": "SGD:S000003814", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000003814-553ff9ed0000002" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"id": "SGD:S000003814", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000003814-553ff9ed0000007" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"label": "physical interaction evidence", | ||
"id": "ECO:0000021", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000021-553ff9ed0000009" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"label": "GTP binding", | ||
"id": "GO:0005525", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel:taxon_559292-5525a0fc0000001-GO-0005525-5525a0fc0000010" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"id": "SGD:S000004659", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000004659-553ff9ed0000006" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"label": "Bfa1-Bub2 complex", | ||
"id": "GO:1990334", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-GO-1990334-553ff9ed0000011" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"id": "SGD:S000004529", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000004529-553ff9ed0000014" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"label": "in vitro binding evidence", | ||
"id": "ECO:0000148", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000148-553ff9ed0000013" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"label": "direct assay evidence", | ||
"id": "ECO:0000002", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000002-553ff9ed0000016" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"label": "direct assay evidence", | ||
"id": "ECO:0000002", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000002-553ff9ed0000015" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"label": "GTPase activator complex", | ||
"id": "GO:1902773", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-GO-1902773-553ff9ed0000008" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"id": "SGD:S000003814", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000003814-553ff9ed0000012" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"label": "GTPase activator activity", | ||
"id": "GO:0005096", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel:taxon_559292-5525a0fc0000001-GO-0005096-5525a0fc0000012" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"label": "GTPase activity", | ||
"id": "GO:0003924", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel:taxon_559292-5525a0fc0000001-GO-0003924-5525a0fc0000008" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"label": "molecular function regulator", | ||
"id": "GO:0098772", | ||
"type": "class" | ||
}, | ||
{ | ||
"label": "protein binding", | ||
"id": "GO:0005515", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel:taxon_559292-5525a0fc0000001-GO-0005515-5525a0fc0000023" | ||
} | ||
], | ||
"properties": [ | ||
{ | ||
"label": "occurs in", | ||
@@ -230,7 +15,2 @@ "id": "BFO:0000066", | ||
{ | ||
"label": "has input", | ||
"id": "RO:0002233", | ||
"type": "property" | ||
}, | ||
{ | ||
"label": "directly inhibits", | ||
@@ -336,8 +116,8 @@ "id": "RO:0002408", | ||
{ | ||
"value": "http://orcid.org/0000-0001-7476-6306", | ||
"key": "contributor" | ||
}, | ||
{ | ||
"value": "2015-04-13", | ||
"key": "date" | ||
}, | ||
{ | ||
"value": "http://orcid.org/0000-0001-7476-6306", | ||
"key": "contributor" | ||
} | ||
@@ -347,7 +127,7 @@ ], | ||
{ | ||
"id": "SGD:S000004529", | ||
"id": "SGD:S000003814", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000004529-553ff9ed0000004" | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000003814-553ff9ed0000007" | ||
}, | ||
@@ -408,8 +188,8 @@ { | ||
{ | ||
"value": "2015-04-13", | ||
"key": "date" | ||
}, | ||
{ | ||
"value": "http://orcid.org/0000-0001-7476-6306", | ||
"key": "contributor" | ||
}, | ||
{ | ||
"value": "2015-04-13", | ||
"key": "date" | ||
} | ||
@@ -419,7 +199,7 @@ ], | ||
{ | ||
"id": "SGD:S000003814", | ||
"id": "SGD:S000004529", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000003814-553ff9ed0000007" | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000004529-553ff9ed0000004" | ||
}, | ||
@@ -678,2 +458,14 @@ { | ||
], | ||
"inferred-type": [ | ||
{ | ||
"label": "molecular function regulator", | ||
"id": "GO:0098772", | ||
"type": "class" | ||
}, | ||
{ | ||
"label": "protein binding", | ||
"id": "GO:0005515", | ||
"type": "class" | ||
} | ||
], | ||
"type": [ | ||
@@ -731,20 +523,5 @@ { | ||
], | ||
"object": "gomodel:taxon_559292-5525a0fc0000001-GO-0003924-5525a0fc0000008", | ||
"property": "RO:0002406", | ||
"subject": "gomodel:taxon_559292-5525a0fc0000001-GO-0005096-5525a0fc0000012" | ||
}, | ||
{ | ||
"annotations": [ | ||
{ | ||
"value": "http://orcid.org/0000-0001-7476-6306", | ||
"key": "contributor" | ||
}, | ||
{ | ||
"value": "2015-04-13", | ||
"key": "date" | ||
} | ||
], | ||
"object": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000004529-553ff9ed0000004", | ||
"object": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000004529-553ff9ed0000014", | ||
"property": "RO:0002333", | ||
"subject": "gomodel:taxon_559292-5525a0fc0000001-GO-0003924-5525a0fc0000008" | ||
"subject": "gomodel:taxon_559292-5525a0fc0000001-GO-0005525-5525a0fc0000010" | ||
}, | ||
@@ -754,12 +531,12 @@ { | ||
{ | ||
"value": "http://orcid.org/0000-0001-7476-6306", | ||
"value": "GOC:kmv", | ||
"key": "contributor" | ||
}, | ||
{ | ||
"value": "2015-04-14", | ||
"value": "2015-04-20", | ||
"key": "date" | ||
} | ||
], | ||
"object": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000003814-553ff9ed0000012", | ||
"property": "RO:0002233", | ||
"object": "gomodel:taxon_559292-5525a0fc0000001-GO-0005096-5525a0fc0000012", | ||
"property": "RO:0002406", | ||
"subject": "gomodel:taxon_559292-5525a0fc0000001-GO-0005515-5525a0fc0000023" | ||
@@ -778,5 +555,5 @@ }, | ||
], | ||
"object": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000004529-553ff9ed0000014", | ||
"property": "RO:0002333", | ||
"subject": "gomodel:taxon_559292-5525a0fc0000001-GO-0005525-5525a0fc0000010" | ||
"object": "gomodel:taxon_559292-5525a0fc0000001-GO-0003924-5525a0fc0000008", | ||
"property": "RO:0002406", | ||
"subject": "gomodel:taxon_559292-5525a0fc0000001-GO-0005096-5525a0fc0000012" | ||
}, | ||
@@ -836,12 +613,12 @@ { | ||
{ | ||
"value": "GOC:kmv", | ||
"value": "http://orcid.org/0000-0001-7476-6306", | ||
"key": "contributor" | ||
}, | ||
{ | ||
"value": "2015-04-20", | ||
"value": "2015-04-14", | ||
"key": "date" | ||
} | ||
], | ||
"object": "gomodel:taxon_559292-5525a0fc0000001-GO-0005096-5525a0fc0000012", | ||
"property": "RO:0002406", | ||
"object": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000003814-553ff9ed0000012", | ||
"property": "RO:0002233", | ||
"subject": "gomodel:taxon_559292-5525a0fc0000001-GO-0005515-5525a0fc0000023" | ||
@@ -856,2 +633,17 @@ }, | ||
{ | ||
"value": "2015-04-13", | ||
"key": "date" | ||
} | ||
], | ||
"object": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000004529-553ff9ed0000004", | ||
"property": "RO:0002333", | ||
"subject": "gomodel:taxon_559292-5525a0fc0000001-GO-0003924-5525a0fc0000008" | ||
}, | ||
{ | ||
"annotations": [ | ||
{ | ||
"value": "http://orcid.org/0000-0001-7476-6306", | ||
"key": "contributor" | ||
}, | ||
{ | ||
"value": "2015-04-14", | ||
@@ -946,3 +738,3 @@ "key": "date" | ||
"uid": "GOC:kltm", | ||
"packet-id": "5b87bdc7d497b3" | ||
"packet-id": "6fcd5414a08834" | ||
} |
@@ -296,2 +296,29 @@ //// | ||
describe("let's take a close look at types and inferred types", function(){ | ||
it('are they working as expected?', function(){ | ||
// Setup. | ||
var g = new model.graph(); | ||
var raw_resp = require('./minerva-01.json'); | ||
g.load_data_go_noctua(raw_resp['data']); | ||
var nid = 'gomodel:taxon_559292-5525a0fc0000001-GO-0005515-5525a0fc0000023'; | ||
var n = g.get_node(nid); | ||
//console.log('type:', n.types()); | ||
//console.log('inferred type:', n.inferred_types()); | ||
assert.equal(n.types().length, 1, 'one std'); | ||
assert.equal(n.inferred_types().length, 2, 'two inferred'); | ||
assert.equal(n.get_unique_inferred_types().length, 1, | ||
'one unique inferred'); | ||
assert.equal(n.types()[0].class_id(), 'GO:0005515', | ||
'std class id'); | ||
assert.equal(n.get_unique_inferred_types()[0].class_id(), 'GO:0098772', | ||
'one unique inferred class id'); | ||
}); | ||
}); | ||
// var assert = require('chai').assert; | ||
@@ -298,0 +325,0 @@ // var model = new require('..'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6327852
26953