Cytoscape JS networks (indra.assemblers.cyjs.assembler)

class indra.assemblers.cyjs.assembler.CyJSAssembler(stmts=None)[source]

This class assembles a CytoscapeJS graph from a set of INDRA Statements.

CytoscapeJS is a web-based network library for analysis and visualisation: http://js.cytoscape.org/

Parameters:statements (Optional[list[indra.statements.Statement]]) – A list of INDRA Statements to be assembled.
statements

list[indra.statements.Statement] – A list of INDRA Statements to be assembled.

add_statements(stmts)[source]

Add INDRA Statements to the assembler’s list of statements.

Parameters:stmts (list[indra.statements.Statement]) – A list of indra.statements.Statement to be added to the statement list of the assembler.
get_gene_names()[source]

Gather gene names of all nodes and node members

make_model(*args, **kwargs)[source]

Assemble a Cytoscape JS network from INDRA Statements.

This method assembles a Cytoscape JS network from the set of INDRA Statements added to the assembler.

Parameters:grouping (bool) – If True, the nodes with identical incoming and outgoing edges are grouped and the corresponding edges are merged.
Returns:cyjs_str – The json serialized Cytoscape JS model.
Return type:str
print_cyjs_context()[source]

Return a list of node names and their respective context.

Returns:cyjs_str_context – A json string of the context dictionary. e.g. - {‘CCLE’ : {‘bin_expression’ : {‘cell_line1’ : {‘gene1’:’val1’} }, ‘bin_expression’ : {‘cell_line’ : {‘gene1’:’val1’} } }}
Return type:str
print_cyjs_graph()[source]

Return the assembled Cytoscape JS network as a json string.

Returns:cyjs_str – A json string representation of the Cytoscape JS network.
Return type:str
save_json(fname_prefix='model')[source]

Save the assembled Cytoscape JS network in a json file.

This method saves two files based on the file name prefix given. It saves one json file with the graph itself, and another json file with the context.

Parameters:fname_prefix (Optional[str]) – The prefix of the files to save the Cytoscape JS network and context to. Default: model
save_model(fname='model.js')[source]

Save the assembled Cytoscape JS network in a js file.

Parameters:file_name (Optional[str]) – The name of the file to save the Cytoscape JS network to. Default: model.js
set_CCLE_context(cell_types)[source]

Set context of all nodes and node members from CCLE.