bbop-graph-noctua
Advanced tools
Comparing version 0.0.18 to 0.0.19
@@ -569,2 +569,8 @@ /** | ||
//this._referenced_subgraphs = []; // not for graph yet, or maybe ever | ||
// Some things that come up in live noctua environments. These are | ||
// graph properties that may or may not be there. If unknown, | ||
// null; if positively true (bad), true; may be false otherwise. | ||
this._inconsistent_p = null; | ||
this._modified_p = null; | ||
} | ||
@@ -626,3 +632,7 @@ bbop.extend(noctua_graph, bbop_graph); | ||
}); | ||
// Copy other properties over. | ||
new_graph._inconsistent_p = anchor._inconsistent_p; | ||
new_graph._modified_p = anchor._modified_p; | ||
return new_graph; | ||
@@ -668,2 +678,22 @@ }; | ||
/** | ||
* Returns true if the model had the "inconsistent-p" property when | ||
* built. | ||
* | ||
* @returns {Boolean|null} inconsistent or not; null if unknown | ||
*/ | ||
noctua_graph.prototype.inconsistent_p = function(){ | ||
return this._inconsistent_p; | ||
}; | ||
/** | ||
* Returns true if the model had the "modified-p" property when | ||
* built. | ||
* | ||
* @returns {Boolean|null} inconsistent or not; null if unknown | ||
*/ | ||
noctua_graph.prototype.modified_p = function(){ | ||
return this._modified_p; | ||
}; | ||
/** | ||
* Get the ID from the graph. | ||
@@ -1236,2 +1266,10 @@ * | ||
// Add the additional metadata. | ||
if( typeof(data['inconsistent-p']) !== 'undefined' ){ | ||
anchor._inconsistent_p = data['inconsistent-p']; | ||
} | ||
if( typeof(data['modified-p']) !== 'undefined' ){ | ||
anchor._modified_p = data['modified-p']; | ||
} | ||
// Easy facts. | ||
@@ -1238,0 +1276,0 @@ var facts = data['facts']; |
{ | ||
"name": "bbop-graph-noctua", | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"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.", |
@@ -22,3 +22,3 @@ //// | ||
function _get_standard_graph(){ | ||
var raw_resp = require('./minerva-02.json'); | ||
var raw_resp = require('./minerva-03.json'); | ||
var g = new model.graph(); | ||
@@ -31,8 +31,7 @@ g.load_data_basic(raw_resp['data']); | ||
var model_a = 'gomodel:5525a0fc00000001'; | ||
var seed_a = | ||
"http://purl.obolibrary.org/obo/#5525a0fc00000001%2F5595c4cb00000425"; | ||
var seed_a = "obo:#5525a0fc00000001%2F5595c4cb00000425"; | ||
// The one leaf in the graph ("protein binding"). | ||
var leaf_a = 'http://model.geneontology.org/5525a0fc00000001/5525a0fc0000023'; | ||
var leaf_a = 'gomodel:5525a0fc00000001\/5525a0fc0000023'; | ||
// Bub2. | ||
var node_a = 'http://purl.obolibrary.org/obo/#5525a0fc00000001%2F5595c4cb00000431'; | ||
var node_a = 'obo:#5525a0fc00000001%2F5595c4cb00000431'; | ||
@@ -374,28 +373,28 @@ /// | ||
// describe("let's take a close look at types and inferred types", function(){ | ||
describe("let's take a close look at types and inferred types", function(){ | ||
// it('are they working as expected?', function(){ | ||
it('are they working as expected?', function(){ | ||
// // Setup. | ||
// var g = _get_standard_graph(); | ||
// var rellist = ['RO:0002333', 'BFO:0000066']; | ||
// g.fold_go_noctua(rellist); | ||
// Setup. | ||
var g = _get_standard_graph(); | ||
var rellist = ['RO:0002333', 'BFO:0000066']; | ||
g.fold_go_noctua(rellist); | ||
// var nid = leaf_a; | ||
// var n = g.get_node(nid); | ||
var nid = leaf_a; | ||
var n = g.get_node(nid); | ||
// //console.log('type:', n.types()); | ||
// //console.log('inferred type:', n.inferred_types()); | ||
//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'); | ||
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'); | ||
// }); | ||
// }); | ||
}); | ||
}); | ||
@@ -537,8 +536,6 @@ describe("clobbering updating", function(){ | ||
// Currently dealing with possibly bad data in minerva-02.json | ||
//assert.equal(n.inferred_types().length, 2, 'two inferred'); | ||
assert.equal(n.inferred_types().length, 0, 'two inferred'); | ||
assert.equal(n.inferred_types().length, 2, 'two inferred'); | ||
// Ditto | ||
// assert.equal(n.get_unique_inferred_types().length, 1, | ||
// 'one unique inferred'); | ||
assert.equal(n.get_unique_inferred_types().length, 0, | ||
assert.equal(n.get_unique_inferred_types().length, 1, | ||
'one unique inferred'); | ||
@@ -548,4 +545,4 @@ assert.equal(n.types()[0].class_id(), 'GO:0005515', | ||
// Ditto. | ||
// assert.equal(n.get_unique_inferred_types()[0].class_id(), 'GO:0098772', | ||
// 'one unique inferred class id'); | ||
assert.equal(n.get_unique_inferred_types()[0].class_id(), 'GO:0098772', | ||
'one unique inferred class id'); | ||
}); | ||
@@ -648,2 +645,61 @@ }); | ||
describe("inconsistent_p and modified_p", function(){ | ||
it('would expect them not to usually be defined', function(){ | ||
// Setup. | ||
var g = _get_standard_graph(); | ||
// | ||
assert.equal(g.inconsistent_p(), null, "consistency unknown"); | ||
assert.equal(g.modified_p(), null, "modification unknown"); | ||
}); | ||
it('goose setup so they are false', function(){ | ||
// Setup. | ||
var raw_resp = require('./minerva-03.json'); | ||
raw_resp['data']['inconsistent-p'] = false; | ||
raw_resp['data']['modified-p'] = false; | ||
var g = new model.graph(); | ||
g.load_data_basic(raw_resp['data']); | ||
// | ||
assert.equal(g.inconsistent_p(), false, "consistency false"); | ||
assert.equal(g.modified_p(), false, "modification false"); | ||
}); | ||
it('goose setup so they are true', function(){ | ||
// Setup. | ||
var raw_resp = require('./minerva-03.json'); | ||
raw_resp['data']['inconsistent-p'] = true; | ||
raw_resp['data']['modified-p'] = true; | ||
var g = new model.graph(); | ||
g.load_data_basic(raw_resp['data']); | ||
// | ||
assert.equal(g.inconsistent_p(), true, "consistency true"); | ||
assert.equal(g.modified_p(), true, "modification true"); | ||
}); | ||
it('make sure truth survives a cloning', function(){ | ||
// Setup. | ||
var raw_resp = require('./minerva-03.json'); | ||
raw_resp['data']['inconsistent-p'] = true; | ||
raw_resp['data']['modified-p'] = true; | ||
var g = new model.graph(); | ||
g.load_data_basic(raw_resp['data']); | ||
var c = g.clone() | ||
// | ||
assert.equal(c.inconsistent_p(), true, "clone consistency true"); | ||
assert.equal(c.modified_p(), true, "clone modification true"); | ||
}); | ||
}); | ||
// var assert = require('chai').assert; | ||
@@ -650,0 +706,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
6407489
17
29179