microbetag.networks¶

Functions¶

read_cyjson(→ networkx.Graph)

Function based on the corresponding of the manta library:

get_edgelist(→ pandas.DataFrame)

Loads a 3-column network file as pd.DataFrame

build_base_graph(→ dict)

Builds a non-annotated graph in a .cyjs format,

Module Contents¶

microbetag.networks.read_cyjson(filename: str, direction: bool = False) networkx.Graph[source]¶

Function based on the corresponding of the manta library: https://github.com/ramellose/manta/blob/master/manta/cyjson.py

Small utility function for reading Cytoscape json files generated with CoNet. In our case, it also gets the layout and adds it as part of the node data.

Parameters:
  • filename – Filepath to .cyjs network file.

  • direction – If True, graph is imported as a networkx.DiGraph

Returns:

A networkx.Graph object. In the microbetag framework, it is being used to load the manta output.

microbetag.networks.get_edgelist(network_file: str) pandas.DataFrame[source]¶

Loads a 3-column network file as pd.DataFrame

Parameters:

network_file – Filepath to the edgelist.

Returns:

A 3-column pandas.DataFrame

microbetag.networks.build_base_graph(conf: microbetag.config.Config) dict[source]¶

Builds a non-annotated graph in a .cyjs format, using only the scores and the taxonomies of the taxa of the network. To be used only when manta clustering has been asked.

Parameters:

conf – A utils.Config instance.

Returns:

The base network as a dictionary.

Note

Runs if network clustering has been asked for from the user, converting the initial .csv edgelist to .cyjs since manta gets a .cyjs input file.