javascript/web/DDBrowse.js
function _roots2json(doc){

	var root_id = doc['annotation_class'];
	console.log("_roots2json: " +
		    doc + ', ' +
		    root_id + ', ' +
		    entity_counts[root_id]);

	// Extract the intersting graphs.
	var topo_graph_field = 'topology_graph_json';
	var trans_graph_field = 'regulates_transitivity_graph_json';
	var topo_graph = new model.graph();
	topo_graph.load_base_json(JSON.parse(doc[topo_graph_field]));
	var trans_graph = new model.graph();
	trans_graph.load_base_json(JSON.parse(doc[trans_graph_field]));

	//
	var kids_p = false;
	var kids = [];
	us.each(topo_graph.get_child_nodes(root_id), function(kid){
	    kids.push({
		'id': kid.id(),
		'text': kid.label() || kid.id()
	    });
	});
	if( kids.length > 0 ){
	    kids_p = true;
	}

	// Using the badge template, get the spans for the IDs.
	var ac_badges = new CountBadges(filter_manager);
	var id_to_badge_text =
		ac_badges.make_badge(root_id, entity_counts[root_id]);
	var lbl_txt = doc['annotation_class_label'] || root_id;
	    
	var tmpl = {
	    'id': root_id,
	    'icon': 'glyphicon glyphicon-record',
	    'text': lbl_txt + id_to_badge_text,
	    //'icon': "string",
	    'state': {
		'opened': false,
		'disabled': false,
		'selected': false
	    },
	    'children': kids_p,
	    'li_attr': {},
	    'a_attr': {}
	};

	return tmpl;
    }
function _roots2json(doc){

	var root_id = doc['annotation_class'];
	console.log("_roots2json: " +
		    doc + ', ' +
		    root_id + ', ' +
		    entity_counts[root_id]);

	// Extract the intersting graphs.
	var topo_graph_field = 'topology_graph_json';
	var trans_graph_field = 'regulates_transitivity_graph_json';
	var topo_graph = new model.graph();
	topo_graph.load_base_json(JSON.parse(doc[topo_graph_field]));
	var trans_graph = new model.graph();
	trans_graph.load_base_json(JSON.parse(doc[trans_graph_field]));

	//
	var kids_p = false;
	var kids = [];
	us.each(topo_graph.get_child_nodes(root_id), function(kid){
	    kids.push({
		'id': kid.id(),
		'text': kid.label() || kid.id()
	    });
	});
	if( kids.length > 0 ){
	    kids_p = true;
	}

	// Using the badge template, get the spans for the IDs.
	var ac_badges = new CountBadges(filter_manager);
	var id_to_badge_text =
		ac_badges.make_badge(root_id, entity_counts[root_id]);
	var lbl_txt = doc['annotation_class_label'] || root_id;
	    
	var tmpl = {
	    'id': root_id,
	    'icon': 'glyphicon glyphicon-record',
	    'text': lbl_txt + id_to_badge_text,
	    //'icon': "string",
	    'state': {
		'opened': false,
		'disabled': false,
		'selected': false
	    },
	    'children': kids_p,
	    'li_attr': {},
	    'a_attr': {}
	};

	return tmpl;
    }
function _roots2json ( doc ) { var root_id = doc [ 'annotation_class' ] ; console . log ( "_roots2json: " + doc + ', ' + root_id + ', ' + entity_counts [ root_id ] ) ; // Extract the intersting graphs. var topo_graph_field = 'topology_graph_json' ; var trans_graph_field = 'regulates_transitivity_graph_json' ; var topo_graph = new model . graph ( ) ; topo_graph . load_base_json ( JSON . parse ( doc [ topo_graph_field ] ) ) ; var trans_graph = new model . graph ( ) ; trans_graph . load_base_json ( JSON . parse ( doc [ trans_graph_field ] ) ) ; // var kids_p = false ; var kids = [ ] ; us . each ( topo_graph . get_child_nodes ( root_id ) , function ( kid ) { kids . push ( { 'id' : kid . id ( ) , 'text' : kid . label ( ) || kid . id ( ) } ) ; } ) ; if ( kids . length > 0 ) { kids_p = true ; } // Using the badge template, get the spans for the IDs. var ac_badges = new CountBadges ( filter_manager ) ; var id_to_badge_text = ac_badges . make_badge ( root_id , entity_counts [ root_id ] ) ; var lbl_txt = doc [ 'annotation_class_label' ] || root_id ; var tmpl = { 'id' : root_id , 'icon' : 'glyphicon glyphicon-record' , 'text' : lbl_txt + id_to_badge_text , //'icon': "string", 'state' : { 'opened' : false , 'disabled' : false , 'selected' : false } , 'children' : kids_p , 'li_attr' : { } , 'a_attr' : { } } ; return tmpl ; }
Convert a term callback into the proper json. This method is used for the initial graph creation.
Convert a term callback into the proper json . This method is used for the initial graph creation .