bbop-graph-noctua
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -6,3 +6,3 @@ //// | ||
var gulp = require('gulp'); | ||
var jsdoc = require('gulp-jsdoc'); | ||
//var jsdoc = require('gulp-jsdoc'); | ||
var mocha = require('gulp-mocha'); | ||
@@ -14,2 +14,3 @@ var uglify = require('gulp-uglify'); | ||
var del = require('del'); | ||
var shell = require('gulp-shell'); | ||
@@ -54,5 +55,13 @@ var paths = { | ||
// Completely dependent on clean before running doc. | ||
// gulp.task('jsdoc', ['clean'], function(cb) { | ||
// gulp.src(paths.docable, paths.readme) | ||
// .pipe(jsdoc('./doc')); | ||
// cb(null); | ||
// }); | ||
// TODO: Ugh--do this manually until gulp-jsdoc gets its act together. | ||
gulp.task('jsdoc', ['clean'], function(cb) { | ||
gulp.src(paths.docable, paths.readme) | ||
.pipe(jsdoc('./doc')); | ||
gulp.src('') | ||
.pipe(shell([ | ||
'./node_modules/.bin/jsdoc --verbose --template ./node_modules/jsdoc-baseline --readme ./README.md --destination ./doc/ ./lib/*.js' | ||
])); | ||
cb(null); | ||
@@ -59,0 +68,0 @@ }); |
400
lib/edit.js
@@ -63,2 +63,3 @@ /** | ||
* | ||
* @memberOf annotation | ||
* @returns {String} string | ||
@@ -278,2 +279,209 @@ */ | ||
/// | ||
/// Generic internal evidence (reference individuals) operations; | ||
/// dynamically attached to node and edge. | ||
/// | ||
/** | ||
* Get/set referenced individual list. | ||
* | ||
* Also, changes type to "referenced" from (probably) node. | ||
* | ||
* @name referenced_individuals | ||
* @function | ||
* @param {Array} indivs - (optional) list of {node} to clobber current list | ||
* @returns {Array} list of all referenced individuals | ||
*/ | ||
function _referenced_individuals(indivs){ | ||
if( us.isArray(indivs) ){ | ||
// Convert type. | ||
each(indivs, function(ind){ | ||
ind.type('referenced'); | ||
}); | ||
// Not copies, so add by replacement. | ||
this._referenced_individuals = indivs; | ||
} | ||
return this._referenced_individuals; | ||
} | ||
/** | ||
* Add referenced individual. | ||
* | ||
* Also, changes type to "referenced" from (probably) node. | ||
* | ||
* @name add_referenced_individual | ||
* @function | ||
* @param {annotation} indiv - individual to add | ||
* @returns {Array} list of all individuals | ||
*/ | ||
function _add_referenced_individual(indiv){ | ||
if( ! us.isArray(indiv) ){ | ||
indiv.type('referenced'); | ||
this._referenced_individuals.push(indiv); | ||
} | ||
return this._referenced_individuals; | ||
} | ||
/** | ||
* Get a sublist of referenced individuals using the filter | ||
* function. The filter function take a single individual as an | ||
* argument, and adds to the return list if it evaluates to true. | ||
* | ||
* @name get_referenced_individuals_by_filter | ||
* @function | ||
* @param {Function} filter - function described above | ||
* @returns {Array} list of passing individuals | ||
*/ | ||
function _get_referenced_individuals_by_filter(filter){ | ||
var anchor = this; | ||
var ret = []; | ||
each(anchor._referenced_individuals, function(ind){ | ||
var res = filter(ind); | ||
if( res && res == true ){ | ||
ret.push(ind); | ||
} | ||
}); | ||
return ret; | ||
} | ||
/** | ||
* Get sublist of referenced_individuals with a certain ID. | ||
* | ||
* @name get_referenced_individual_by_id | ||
* @function | ||
* @param {String} iid - referenced_individual ID to look for | ||
* @returns {Array} list of referenced_individuals with that ID | ||
*/ | ||
function _get_referenced_individual_by_id(iid){ | ||
var anchor = this; | ||
var ret = null; | ||
each(anchor._referenced_individuals, function(ind){ | ||
if( ind.id() == iid ){ | ||
ret = ind; | ||
} | ||
}); | ||
return ret; | ||
} | ||
/** | ||
* Returns a list with the following structure: | ||
* | ||
* : [ { id: <ID>, | ||
* : class_expressions: [{class_expression}, ...], | ||
* : anntations: [{annotation}, ...] }, | ||
* : ... | ||
* : ] | ||
* | ||
* Each top-level element in the list represents the core information | ||
* of a single referenced individual for a node or edge in this model. | ||
* | ||
* Keep in mind that this may be most useful in the GO Noctua use case | ||
* where evidence is uniformly modeled as (a) referenced | ||
* individual(s), where the class(es) are evidence and the annotations | ||
* keep things such as source (e.g. PMID), etc. | ||
* | ||
* @name get_referenced_individual_profiles | ||
* @function | ||
* @returns {Array} list of referenced_individual information. | ||
*/ | ||
function _get_referenced_individual_profiles(){ | ||
var anchor = this; | ||
var ret = []; | ||
each(anchor.referenced_individuals(), function(ind){ | ||
// Base. | ||
var prof = { | ||
id: null, | ||
class_expressions: [], | ||
annotations: [] | ||
} | ||
// Referenced instance ID. | ||
prof.id = ind.id(); | ||
// Collect class expressions and annotations. | ||
each(ind.types(), function(ce){ | ||
prof.class_expressions.push(ce); | ||
}); | ||
each(ind.annotations(), function(ann){ | ||
prof.annotations.push(ann); | ||
}); | ||
// | ||
ret.push(prof); | ||
}); | ||
return ret; | ||
} | ||
/** | ||
* Returns a list with the following structure: | ||
* | ||
* : [ { id: <ID>, | ||
* : cls: <ID>, | ||
* : source: <STRING>, | ||
* : date: <STRING>, | ||
* : etc | ||
* : }, | ||
* : ... | ||
* : ] | ||
* | ||
* Each top-level element in the list represents the core information | ||
* in a simple (GO-style) element. This is essentially a distilled | ||
* version of get_referenced_individual_profiles for cases where that | ||
* is modelling simple piece of evidence (single non-nested class | ||
* expression and a set know list of annotations). | ||
* | ||
* @name get_basic_evidence | ||
* @function | ||
* @param {Array} annotation_ids - list of strings that identify the annotation keys that will be captured-- | ||
* @returns {Array} list of referenced_individual simple evidence information. | ||
*/ | ||
function _get_basic_evidence(annotation_ids){ | ||
var anchor = this; | ||
var ret = []; | ||
// Get hash of the annotation keys present. | ||
var test = us.object(us.map(annotation_ids, | ||
function(e){ return [e, true]})); | ||
each(anchor.get_referenced_individual_profiles(), function(cmplx_prof){ | ||
//console.log(cmplx_prof); | ||
// Only add conformant referenced individuals. | ||
if( cmplx_prof.id && ! us.isEmpty(cmplx_prof.class_expressions) ){ | ||
// Base. | ||
//console.log(cmplx_prof.class_expressions); | ||
var basic_prof = { | ||
id: cmplx_prof.id, | ||
cls: cmplx_prof.class_expressions[0].to_string() | ||
}; | ||
// Match and clobber. | ||
each(cmplx_prof.annotations, function(ann){ | ||
//console.log(ann); | ||
if( test[ann.key()] ){ | ||
basic_prof[ann.key()] = ann.value(); | ||
} | ||
}); | ||
//console.log(basic_prof); | ||
ret.push(basic_prof); | ||
} | ||
}); | ||
return ret; | ||
} | ||
/// | ||
/// Next, get some subclasses working for the core triumvirate: graph, | ||
@@ -284,2 +492,12 @@ /// node, edge. Start with graph. | ||
var bbop_graph = bbop_model.graph; | ||
/** | ||
* Sublcass of bbop-graph for use with Noctua ideas and concepts. | ||
* | ||
* @constructor | ||
* @see module:bbop-graph | ||
* @alias graph | ||
* @param {String} new_id - (optional) new id; otherwise new unique generated | ||
* @returns {this} | ||
*/ | ||
function noctua_graph(new_id){ | ||
@@ -305,2 +523,3 @@ bbop_graph.call(this); | ||
this._annotations = []; | ||
//this._referenced_individuals = []; // not for graph yet, or maybe ever | ||
}; | ||
@@ -719,6 +938,8 @@ bbop.extend(noctua_graph, bbop_graph); | ||
* | ||
* TODO: inferred individuals | ||
* | ||
* @param {Object} the "data" portion of a Minerva graph-related response. | ||
* @returns {this} | ||
* @returns {Boolean} if data was loaded | ||
*/ | ||
noctua_graph.prototype.load_minerva_response_data = function(data){ | ||
noctua_graph.prototype.load_data_base = function(data){ | ||
var anchor = this; | ||
@@ -730,12 +951,63 @@ | ||
// TODO: Graph parts--annotations, etc. | ||
// Add the graph metadata. | ||
var graph_id = data['id'] || null; | ||
var graph_anns = data['annotations'] || []; | ||
if( graph_id ){ anchor.id(graph_id); } | ||
if( ! us.isEmpty(graph_anns) ){ | ||
each(graph_anns, function(ann_kv_set){ | ||
var na = new annotation(ann_kv_set); | ||
anchor.add_annotation(na); | ||
}); | ||
} | ||
// Easy facts. | ||
var facts = data['facts']; | ||
each(facts, function(fact){ | ||
anchor.add_edge_from_fact(fact); | ||
}); | ||
// Build the structure of the graph in the most obvious way. | ||
var inds = data['individuals']; | ||
//var i_inds =raw_resp['data']['individuals-i']; | ||
var facts = data['facts']; | ||
// This is likely to be the seed for the graph builders ;) | ||
//var i_inds = raw_resp['data']['individuals-i']; | ||
each(inds, function(ind){ | ||
anchor.add_node_from_individual(ind); | ||
}); | ||
ret = true; | ||
} | ||
return ret; | ||
}; | ||
/** | ||
* Load minerva data response. However, this time, we're going to fold | ||
* the evidence individuals into the edges and nodes that reference | ||
* them under the referenced_individual functions. | ||
* | ||
* TODO: inferred individuals | ||
* | ||
* @param {Object} the "data" portion of a Minerva graph-related response. | ||
* @returns {Boolean} if data was loaded | ||
*/ | ||
noctua_graph.prototype.load_data_fold_evidence = function(data){ | ||
var anchor = this; | ||
var ret = false; | ||
if( data ){ | ||
// Load the graph parts as usual. | ||
var graph_id = data['id'] || null; | ||
var graph_anns = data['annotations'] || []; | ||
if( graph_id ){ anchor.id(graph_id); } | ||
if( ! us.isEmpty(graph_anns) ){ | ||
each(graph_anns, function(ann_kv_set){ | ||
var na = new annotation(ann_kv_set); | ||
anchor.add_annotation(na); | ||
}); | ||
} | ||
// Currently, evidence does not have edges, and if they did, | ||
// we wouldn't want to handle them here. All edges in. | ||
var facts = data['facts']; | ||
each(facts, function(fact){ | ||
@@ -745,5 +1017,67 @@ anchor.add_edge_from_fact(fact); | ||
// Start by adding all of the individuals to the graph. | ||
var inds = data['individuals']; | ||
//var i_inds = raw_resp['data']['individuals-i']; | ||
each(inds, function(ind){ | ||
anchor.add_node_from_individual(ind); | ||
}); | ||
// Find the evidence singletons and remove them from the | ||
// graph. | ||
var singletons = {}; | ||
each(anchor.get_singleton_nodes(), function(singleton){ | ||
var sid = singleton.id(); | ||
singletons[sid] = singleton; | ||
anchor.remove_node(sid); | ||
}); | ||
//console.log('singletons'); | ||
//console.log(singletons); | ||
// Add the evidence singletons back into the structure by | ||
// scanning through the nodes and adding them as referenced | ||
// individuals. | ||
each(anchor.all_nodes(), function(node){ | ||
each(node.annotations(), function(ann){ | ||
//console.log(ann.key(), ann.value_type(), ann.value()); | ||
// Is it an evidence annotation. | ||
if( ann.key() == 'evidence' && ann.value_type() == 'IRI' ){ | ||
// If so, add it in. | ||
var ev_ref = ann.value(); | ||
if( singletons[ev_ref] ){ | ||
var ev_indiv = singletons[ev_ref]; | ||
var c1 = node.add_referenced_individual(ev_indiv); | ||
// console.log('<<' + node.id() + '>1>', c1.length); | ||
var c2 = node.referenced_individuals(); | ||
// console.log('<<' + node.id() + '>2>', c2.length); | ||
// console.log(node) | ||
} | ||
} | ||
}); | ||
}); | ||
// We also need to do the same thing with the edges, adding | ||
// back in the evidence as referenced individuals. | ||
each(anchor.all_edges(), function(edge){ | ||
each(edge.annotations(), function(ann){ | ||
// Is it an evidence annotation. | ||
if( ann.key() == 'evidence' && ann.value_type() == 'IRI' ){ | ||
// If so, add it in. | ||
var ev_ref = ann.value(); | ||
if( singletons[ev_ref] ){ | ||
var ev_indiv = singletons[ev_ref]; | ||
edge.add_referenced_individual(ev_indiv); | ||
} | ||
} | ||
}); | ||
}); | ||
ret = true; | ||
} | ||
// console.log(anchor); | ||
return ret; | ||
@@ -757,2 +1091,13 @@ }; | ||
var bbop_node = bbop_model.node; | ||
/** | ||
* Sublcass of bbop-graph.node for use with Noctua ideas and concepts. | ||
* | ||
* @constructor | ||
* @see module:bbop-graph | ||
* @alias node | ||
* @param {String} in_id - (optional) new id; otherwise new unique generated | ||
* @param {String} in_label - (optional) node "label" | ||
* @param {Array} in_types - (optional) list of Objects or strings--anything that can be parsed by class_expression | ||
* @returns {this} | ||
*/ | ||
function noctua_node(in_id, in_label, in_types){ | ||
@@ -766,2 +1111,3 @@ bbop_node.call(this, in_id, in_label); | ||
this._annotations = []; | ||
this._referenced_individuals = []; | ||
@@ -813,2 +1159,5 @@ // Incoming ID or generate ourselves. | ||
}); | ||
each(anchor._referenced_individuals, function(ind){ | ||
new_clone._referenced_individuals.push(ind.clone()); | ||
}); | ||
new_clone._x_init = anchor._x_init; | ||
@@ -913,2 +1262,13 @@ new_clone._y_init = anchor._y_init; | ||
var bbop_edge = bbop_model.edge; | ||
/** | ||
* Sublcass of bbop-graph.edge for use with Noctua ideas and concepts. | ||
* | ||
* @constructor | ||
* @see module:bbop-graph | ||
* @alias edge | ||
* @param {String} subject - required subject id | ||
* @param {String} object - required object id | ||
* @param {String} predicate - (optional) preidcate id; if not provided, will use defined default (you probably want to provide one--explicit is better) | ||
* @returns {this} | ||
*/ | ||
function noctua_edge(subject, object, predicate){ | ||
@@ -922,2 +1282,3 @@ bbop_edge.call(this, subject, object, predicate); | ||
this._annotations = []; | ||
this._referenced_individuals = []; | ||
}; | ||
@@ -951,2 +1312,5 @@ bbop.extend(noctua_edge, bbop_edge); | ||
}); | ||
each(anchor._referenced_individuals, function(ind){ | ||
new_clone._referenced_individuals.push(ind.clone()); | ||
}); | ||
@@ -1001,6 +1365,3 @@ return new_clone; | ||
/// | ||
/// Add generic bulk annotation operations to: graph, edge, and node. | ||
/// | ||
// Add generic bulk annotation operations to: graph, edge, and node. | ||
each([noctua_graph, noctua_node, noctua_edge], function(constructr){ | ||
@@ -1014,2 +1375,19 @@ constructr.prototype.annotations = _annotations; | ||
// Add generic evidence (referenced individuals) operations to: edge | ||
// and node. | ||
each([noctua_node, noctua_edge], function(constructr){ | ||
constructr.prototype.referenced_individuals = | ||
_referenced_individuals; | ||
constructr.prototype.add_referenced_individual = | ||
_add_referenced_individual; | ||
constructr.prototype.get_referenced_individuals_by_filter = | ||
_get_annotations_by_filter; | ||
constructr.prototype.get_referenced_individual_by_id = | ||
_get_referenced_individual_by_id; | ||
constructr.prototype.get_referenced_individual_profiles | ||
= _get_referenced_individual_profiles; | ||
constructr.prototype.get_basic_evidence | ||
= _get_basic_evidence; | ||
}); | ||
/// | ||
@@ -1016,0 +1394,0 @@ /// Exportable body. |
{ | ||
"name": "bbop-graph-noctua", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"license": "BSD-3-Clause", | ||
@@ -34,3 +34,3 @@ "description": "A subclass of bbop-graph that layers on a complete annotation and graph editing model for the Noctua set of tools.", | ||
"bbop-graph": "0.0.12", | ||
"class-expression": "0.0.3", | ||
"class-expression": "0.0.4", | ||
"underscore": "1.8.3" | ||
@@ -48,3 +48,6 @@ }, | ||
"gulp-rename": "^1.2.2", | ||
"gulp-uglify": "^1.2.0" | ||
"gulp-shell": "^0.4.2", | ||
"gulp-uglify": "^1.2.0", | ||
"jsdoc": "^3.3.0", | ||
"jsdoc-baseline": "git://github.com/hegemonic/jsdoc-baseline.git#74d1dc8075" | ||
}, | ||
@@ -56,3 +59,3 @@ "bundleDependencies": [], | ||
"lib": "lib", | ||
"test": "tests" | ||
"tests": "tests" | ||
}, | ||
@@ -59,0 +62,0 @@ "main": "lib/edit.js", |
@@ -5,3 +5,5 @@ # bbop-graph-noctua | ||
General purpose (mathematical) graph library in JavaScript. | ||
A Noctua-specific subclass of the bbop-graph general graph library. | ||
The purpose is to add named edges, evidence, types, and other features | ||
found in a Noctua environment. | ||
@@ -8,0 +10,0 @@ ### Availability |
@@ -7,8 +7,7 @@ { | ||
{ | ||
"label": "in vitro binding evidence", | ||
"id": "ECO:0000148", | ||
"id": "SGD:S000004659", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000148-553ff9ed0000013" | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000004659-553ff9ed0000010" | ||
}, | ||
@@ -18,7 +17,8 @@ { | ||
{ | ||
"id": "SGD:S000004659", | ||
"label": "GTPase inhibitor activity", | ||
"id": "GO:0005095", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000004659-553ff9ed0000010" | ||
"id": "gomodel:taxon_559292-5525a0fc0000001-GO-0005095-5525a0fc0000009" | ||
}, | ||
@@ -33,3 +33,3 @@ { | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000002-553ff9ed0000005" | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000002-553ff9ed0000017" | ||
}, | ||
@@ -39,12 +39,2 @@ { | ||
{ | ||
"label": "GTPase inhibitor activity", | ||
"id": "GO:0005095", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel:taxon_559292-5525a0fc0000001-GO-0005095-5525a0fc0000009" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"label": "enzyme assay evidence", | ||
@@ -79,7 +69,8 @@ "id": "ECO:0000005", | ||
{ | ||
"id": "SGD:S000003814", | ||
"label": "direct assay evidence", | ||
"id": "ECO:0000002", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000003814-553ff9ed0000007" | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000002-553ff9ed0000005" | ||
}, | ||
@@ -98,2 +89,11 @@ { | ||
{ | ||
"id": "SGD:S000003814", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000003814-553ff9ed0000007" | ||
}, | ||
{ | ||
"type": [ | ||
{ | ||
"label": "physical interaction evidence", | ||
@@ -147,8 +147,8 @@ "id": "ECO:0000021", | ||
{ | ||
"label": "direct assay evidence", | ||
"id": "ECO:0000002", | ||
"label": "in vitro binding evidence", | ||
"id": "ECO:0000148", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000002-553ff9ed0000017" | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000148-553ff9ed0000013" | ||
}, | ||
@@ -266,18 +266,2 @@ { | ||
{ | ||
"value": "PMID:12048186", | ||
"key": "source" | ||
} | ||
], | ||
"type": [ | ||
{ | ||
"label": "in vitro binding evidence", | ||
"id": "ECO:0000148", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000148-553ff9ed0000013" | ||
}, | ||
{ | ||
"annotations": [ | ||
{ | ||
"value": "2015-04-14", | ||
@@ -302,18 +286,3 @@ "key": "date" | ||
{ | ||
"value": "PMID:12048186", | ||
"key": "source" | ||
} | ||
], | ||
"type": [ | ||
{ | ||
"label": "direct assay evidence", | ||
"id": "ECO:0000002", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000002-553ff9ed0000005" | ||
}, | ||
{ | ||
"annotations": [ | ||
{ | ||
"value-type": "IRI", | ||
"value": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000005-553ff9ed0000001", | ||
@@ -349,2 +318,18 @@ "key": "evidence" | ||
{ | ||
"label": "direct assay evidence", | ||
"id": "ECO:0000002", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000002-553ff9ed0000017" | ||
}, | ||
{ | ||
"annotations": [ | ||
{ | ||
"value": "PMID:12048186", | ||
"key": "source" | ||
} | ||
], | ||
"type": [ | ||
{ | ||
"label": "enzyme assay evidence", | ||
@@ -395,2 +380,18 @@ "id": "ECO:0000005", | ||
{ | ||
"value": "PMID:12048186", | ||
"key": "source" | ||
} | ||
], | ||
"type": [ | ||
{ | ||
"label": "direct assay evidence", | ||
"id": "ECO:0000002", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000002-553ff9ed0000005" | ||
}, | ||
{ | ||
"annotations": [ | ||
{ | ||
"value": "http://orcid.org/0000-0001-7476-6306", | ||
@@ -410,3 +411,3 @@ "key": "contributor" | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000003814-553ff9ed0000007" | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000003814-553ff9ed0000002" | ||
}, | ||
@@ -430,3 +431,3 @@ { | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000003814-553ff9ed0000002" | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000003814-553ff9ed0000007" | ||
}, | ||
@@ -452,2 +453,3 @@ { | ||
{ | ||
"value-type": "IRI", | ||
"value": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000148-553ff9ed0000013", | ||
@@ -541,8 +543,8 @@ "key": "evidence" | ||
{ | ||
"label": "direct assay evidence", | ||
"id": "ECO:0000002", | ||
"label": "in vitro binding evidence", | ||
"id": "ECO:0000148", | ||
"type": "class" | ||
} | ||
], | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000002-553ff9ed0000017" | ||
"id": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000148-553ff9ed0000013" | ||
}, | ||
@@ -631,2 +633,3 @@ { | ||
{ | ||
"value-type": "IRI", | ||
"value": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000002-553ff9ed0000005", | ||
@@ -652,2 +655,3 @@ "key": "evidence" | ||
{ | ||
"value-type": "IRI", | ||
"value": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000005-553ff9ed0000003", | ||
@@ -673,2 +677,3 @@ "key": "evidence" | ||
{ | ||
"value-type": "IRI", | ||
"value": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000021-553ff9ed0000009", | ||
@@ -753,5 +758,5 @@ "key": "evidence" | ||
], | ||
"object": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000004529-553ff9ed0000014", | ||
"object": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000004529-553ff9ed0000004", | ||
"property": "RO:0002333", | ||
"subject": "gomodel:taxon_559292-5525a0fc0000001-GO-0005525-5525a0fc0000010" | ||
"subject": "gomodel:taxon_559292-5525a0fc0000001-GO-0003924-5525a0fc0000008" | ||
}, | ||
@@ -761,12 +766,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" | ||
@@ -781,9 +786,9 @@ }, | ||
{ | ||
"value": "2015-04-14", | ||
"value": "2015-04-13", | ||
"key": "date" | ||
} | ||
], | ||
"object": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000003814-553ff9ed0000012", | ||
"property": "RO:0002233", | ||
"subject": "gomodel:taxon_559292-5525a0fc0000001-GO-0005515-5525a0fc0000023" | ||
"object": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000004529-553ff9ed0000014", | ||
"property": "RO:0002333", | ||
"subject": "gomodel:taxon_559292-5525a0fc0000001-GO-0005525-5525a0fc0000010" | ||
}, | ||
@@ -823,2 +828,3 @@ { | ||
{ | ||
"value-type": "IRI", | ||
"value": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000002-553ff9ed0000017", | ||
@@ -843,13 +849,13 @@ "key": "evidence" | ||
{ | ||
"value": "http://orcid.org/0000-0001-7476-6306", | ||
"value": "GOC:kmv", | ||
"key": "contributor" | ||
}, | ||
{ | ||
"value": "2015-04-13", | ||
"value": "2015-04-20", | ||
"key": "date" | ||
} | ||
], | ||
"object": "gomodel_taxon_559292-5525a0fc0000001-SGD-S000004529-553ff9ed0000004", | ||
"property": "RO:0002333", | ||
"subject": "gomodel:taxon_559292-5525a0fc0000001-GO-0003924-5525a0fc0000008" | ||
"object": "gomodel:taxon_559292-5525a0fc0000001-GO-0005096-5525a0fc0000012", | ||
"property": "RO:0002406", | ||
"subject": "gomodel:taxon_559292-5525a0fc0000001-GO-0005515-5525a0fc0000023" | ||
}, | ||
@@ -874,2 +880,3 @@ { | ||
{ | ||
"value-type": "IRI", | ||
"value": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000002-553ff9ed0000015", | ||
@@ -894,2 +901,3 @@ "key": "evidence" | ||
{ | ||
"value-type": "IRI", | ||
"value": "gomodel_taxon_559292-5525a0fc0000001-ECO-0000002-553ff9ed0000016", | ||
@@ -952,3 +960,3 @@ "key": "evidence" | ||
"uid": "GOC:kltm", | ||
"packet-id": "587a9e87c34a51a" | ||
"packet-id": "5b87bdc7d497b3" | ||
} |
@@ -96,3 +96,3 @@ //// | ||
var g = new model.graph(); | ||
g.load_minerva_response_data(raw_resp['data']); | ||
g.load_data_base(raw_resp['data']); | ||
@@ -109,4 +109,11 @@ // Right? | ||
var g = new model.graph(); | ||
g.load_minerva_response_data(raw_resp['data']); | ||
g.load_data_base(raw_resp['data']); | ||
assert.equal(g.id(),'gomodel:taxon_559292-5525a0fc0000001_all_indivdual', | ||
'graph id'); | ||
assert.equal(g.annotations().length, 4, '4 graph annotation'); | ||
var anns = g.get_annotations_by_key('date'); | ||
assert.equal(anns.length, 1, 'one date annotation'); | ||
assert.equal(anns[0].value(), '2015-04-10', 'correct date annotation'); | ||
// Wee tests. | ||
@@ -127,3 +134,3 @@ assert.equal(g.all_nodes().length, 22, 'right num nodes'); | ||
var g = new model.graph(); | ||
g.load_minerva_response_data(raw_resp['data']); | ||
g.load_data_base(raw_resp['data']); | ||
@@ -158,2 +165,45 @@ // Head up from our one leaf | ||
it("evidence that evidence works", function(){ | ||
// Setup. | ||
var raw_resp = require('./minerva-01.json'); | ||
var g = new model.graph(); | ||
g.load_data_fold_evidence(raw_resp['data']); | ||
// Okay, we should have a lot less nodes now. | ||
assert.equal(g.all_nodes().length, 14, '22 - 8 ev nodes = 14'); | ||
// Let's track down the evidence for one node. | ||
var nid = 'gomodel:taxon_559292-5525a0fc0000001-GO-0005515-5525a0fc0000023'; | ||
var n = g.get_node(nid); | ||
assert.equal(n.id(), nid, 'some weirdness here at one point'); | ||
// The hard way. | ||
var ri = n.referenced_individuals(); | ||
assert.equal(ri.length, 1, 'one piece of ev'); | ||
var ev_ind = ri[0]; | ||
var types = ev_ind.types(); | ||
assert.equal(types.length, 1, 'one class exp'); | ||
var t = types[0]; | ||
assert.equal(t.class_id(), 'ECO:0000021', 'say hi'); | ||
// The easy way. | ||
var profs = n.get_referenced_individual_profiles(); | ||
assert.equal(profs.length, 1, 'one profile using this method'); | ||
var first_prof = profs[0]; | ||
assert.isNotNull(first_prof.id, 'has id using this method'); | ||
assert.equal(first_prof.class_expressions.length, 1, | ||
'one ce using this method'); | ||
assert.equal(first_prof.annotations.length, 1, | ||
'one ann using this method'); | ||
// The overly easy super-simple (GO) way. | ||
var evs = n.get_basic_evidence(['source']); | ||
//console.log(evs); | ||
assert.equal(evs.length, 1, 'one evs'); | ||
var ev = evs[0]; | ||
assert.isString(ev['id'], 'got RI id'); | ||
assert.equal(ev['cls'], 'ECO:0000021', 'got ev class'); | ||
assert.equal(ev['source'], 'PMID:12048186', 'got source ref'); | ||
}); | ||
}); | ||
@@ -169,2 +219,2 @@ | ||
// var g = new model.graph(); | ||
// g.load_minerva_response_data(raw_resp['data']); | ||
// g.load_data_fold_evidence(raw_resp['data']); |
6323765
26840
18
13
+ Addedclass-expression@0.0.4(transitive)
- Removedclass-expression@0.0.3(transitive)
Updatedclass-expression@0.0.4