mosaicmpi.Network#
- class mosaicmpi.Network(integration: Integration, subset_nodes: Iterable[str] | None = None, communities: Dict[str, Collection[str]] | None = None)#
Create a program network from an
Integrationobject.- 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
Get the number of communities in the Network.
Get community names, ordered numerically after separating clusters and subclusters.
Get the nodes in the program graph as (dataset, k, program) tuples.
Methods
Add attributes to the program graph for generating the community-weighted network.
community_search([algorithm, resolution, k, ...])Identifies communities from the program graph.
_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.
Counts edges within each community that are within and between datasets.
Creates community network after community search.
Creates a program graph based on pairwise correlation thresholds and selected ranks.
from_pkl(filename)Read an Network object from a file.
_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.
Create a matrix with community and dataset on each axis.
Get node counts before and after various node and edge filters.
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.
Select programs based on rank.
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.