microbetag.networks

Module Contents

microbetag.networks.build_edge_list(edgelist, metadata_file=None)[source]

Read an edge list and build a dataframe with the corresponding NCBI IDs for each pair, if and only if both OTUs have been mapped to an NCBI tax ID. NOTE: edge_list_of_ncbi_ids() on microbetagApp

Parameters: - edgelist (str): Path to the edge list file. - metadata_file (str, optional): Path to the metadata file containing elements to exclude.

Returns: - pd.DataFrame: Filtered edge list with NCBI tax IDs. - pd.DataFrame (optional): Edges that were excluded based on metadata.

microbetag.networks.read_cyjson(filename, direction=False)[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.

:param : :type : param filename: Filepath to location of cyjs file. :param : :type : param direction: If true, graph is imported as a NetworkX DiGraph :param : :type : return: NetworkX graph.

microbetag.networks.get_edgelist(conf)[source]

Loads a 3-column network file as pd.DataFrame

microbetag.networks.build_base_graph(conf)[source]

Runs if manta has been asked for from the user. manta gets a .cyjs input file. This function builds an non-annotated graph using only the scores and the taxonomies of the taxa of the network. It get a list of dictionaries where each dictionary is an edge and returns the basenetwork in a .cyjs format.

microbetag.networks.build_a_base_node(node_name, map_seq, is_taxon: bool)[source]

Builds a node for the base network. [TODO] Remove not necessary entries.