dandelion.tools.generate_network

dandelion.tools.generate_network(self, distance_mode='simple', min_size=2, aa_or_nt=None, clone_key=None, weights=None, downsample=None, verbose=True, **kwargs)[source]

Generates a Levenshtein distance network based on full length VDJ sequence alignments for heavy and light chain(s). The distance matrices are then combined into a singular matrix.

Parameters
  • data (Dandelion, DataFrame, str) – Dandelion object, pandas DataFrame in changeo/airr format, or file path to changeo/airr file after clones have been determined.

  • distance_mode (str) – The mode of calculating joint distance matrix for heavy and light chains. Default is ‘simple’. If ‘simple’, a simple sum operation will be used. If ‘scaled’, depending on whether weights option is provided, it will scale each layer to range of 0 to 1 to bring the multiple layers of data into a single analysis.

  • min_size (int) – For visualization purposes, two graphs are created where one contains all cells and a trimmed second graph. This value specifies the minimum number of edges required otherwise node will be trimmed in the secondary graph.

  • aa_or_nt (str, optional) – Option accepts ‘aa’, ‘nt’ or None, with None defaulting to ‘aa’. Determines whether amino acid or nucleotide sequences will be used for calculating distances.

  • clone_key (str, optional) – column name to build network on.

  • weights (tuple, optional) – A tuple containing weights to scale each layer. default is None where each layer is scaled evenly i.e. 1/number of layers.

  • downsample (int, optional) – whether or not to downsample the number of cells prior to construction of network. If provided, cells will be randomly sampled to the integer provided. A new Dandelion class will be returned.

  • verbose (bool) – whether or not to print the progress bars.

  • **kwargs – additional kwargs passed to options specified in networkx.drawing.layout.spring_layout.

Returns

Return type

Dandelion object with .distance, .edges, .layout, .graph initialized.