mosaicmpi.network.Network

Contents

mosaicmpi.network.Network#

class mosaicmpi.network.Network(integration: Integration, subset_nodes: Iterable[str] | None = None, communities: Dict[str, Collection[str]] | None = None)#

Create a program network from an Integration object.

Parameters:
  • integration (Integration) – Integration of multiple datasets.

  • subset_nodes (Iterable[str], optional) – Create an SNS from a subset of the larger program graph, defaults to None

  • communities (Dict[str, Collection[str]], optional) – Use pre-defined communities, defaults to None

Attributes

n_communities

Get the number of communities in the Network.

node_to_community

ordered_community_names

Get community names, ordered numerically after separating clusters and subclusters.

programs_in_graph

Get the nodes in the program graph as (dataset, k, program) tuples.

Methods

add_community_weights_to_graph([...])

Add attributes to the program graph for generating the community-weighted network.

community_search([algorithm, resolution, k, ...])

Identifies communities from the program graph.

compute_community_network_layout([...])

_summary_

compute_layout([algorithm, base_weight, ...])

Compute the network layout using a specified algorithm.

consensus([method, min_k])

Generate a 'consensus' program for each community and dataset by taking the median of all constituent programs, separately for each dataset.

count_intracommunity_edges()

Counts edges within each community that are within and between datasets.

create_community_network()

Creates community network after community search.

create_program_network()

Creates a program graph based on pairwise correlation thresholds and selected ranks.

from_pkl(filename)

Read an Network object from a file.

get_community_category_overrepresentation(layer)

_summary_

get_community_metadata_correlation(layer[, ...])

Calculate Pearson correlation of program usage to numerical metadata across samples/observations.

get_community_usage([subset_datasets, ...])

Get median usage of each community of programs for each samples.

get_lowest_rank_programs([min_k])

Identify the programS that are the lowest rank for each dataset.

get_max_corr_communities()

Create a matrix with community and dataset on each axis.

get_node_table()

Get node counts before and after various node and edge filters.

get_representative_program_ids([...])

Select programs based on correlation with the median of all programs in each community

get_representative_programs([correlation_axis])

Select programs based on correlation with the median of all programs in each community

get_sample_entropy([subset_datasets])

Get shannon diversity of Community Usage for each sample.

get_selected_rank_program_ids(k)

Select programs based on rank.

get_vectorized_community_sort_key(...)

Return a vector of sort_indicesGet community names, ordered numerically after separating clusters and subclusters.

most_correlated_edge_between_datasets(ds1, ds2)

Identifies the most correlated edge between two datasets within each community.

prune_communities([min_nodes, min_datasets, ...])

Prune communities based on one or more filters.

read_communities_from_toml(toml_file)

to_pkl(filename)

Persists the SNS object using python's pickle format with optional gzip compression :param filename: path to .pkl or .pkl.gz file :type filename: str

transfer_labels([source, dest, layer, ...])

Transfer sample categories between datasets using usage of representative programs as a proxy.

write_communities_toml(filename)

Write communities to TOML file.

write_community_network_graphml(filename)

Output the community network in graphml format.

write_program_network_graphml(filename)

Output the program network in graphml format.