omicsdata.tree package

Submodules

omicsdata.tree.adj module

omicsdata.tree.adj.adj_to_anc(adj, root=0)[source]

Converts an adjacency matrix to an ancestry matrix

Parameters:
  • adj (ndarray) – a 2D numpy array that is an adjacency matrix for a graph

  • root (int, optional) – the row in the inputted adjacency matrix that corresponds to the root nodes

Returns:

an ancestry matrix for the corresponding adjacency matrix

Return type:

ndarray

omicsdata.tree.adj.adj_to_parents(adj)[source]

Converts and adjacency matrix to a parents vector. We assume the inputted adjacency matrix is for a directed graph

Parameters:

adj (ndarray) – a 2D numpy array that is an adjacency matrix for a graph

Returns:

an array where each index i represents a node in a graph, and the value at index i is which node is its direct ancestor

Return type:

ndarray

omicsdata.tree.columns module

class omicsdata.tree.columns.NEUTREE_Columns(STRUCTS: str = 'structs', PHIS: str = 'phis', COUNTS: str = 'counts', LOGSCORES: str = 'logscores', CLUSTERINGS: str = 'clusterings', GARBAGE: str = 'garbage')[source]

Bases: object

Dataclass used to define Neutree columns

CLUSTERINGS: str = 'clusterings'
COUNTS: str = 'counts'
GARBAGE: str = 'garbage'
LOGSCORES: str = 'logscores'
PHIS: str = 'phis'
STRUCTS: str = 'structs'

omicsdata.tree.parents module

omicsdata.tree.parents.compute_partial_parents(parents)[source]

Computes the partial parents of a parents vector

omicsdata.tree.parents.parents_to_adj(parents)[source]

Converts an incomplete parents vector to an equivalent adjacency matrix

omicsdata.tree.neutree module

class omicsdata.tree.neutree.Neutree(structs, phis, counts, logscores, clusterings, garbage)

Bases: tuple

clusterings

Alias for field number 4

counts

Alias for field number 2

garbage

Alias for field number 5

logscores

Alias for field number 3

phis

Alias for field number 1

structs

Alias for field number 0

omicsdata.tree.neutree.load(neutree_fn)[source]

Loads the Neutree namedtuple from a zipped archive

Parameters:

neutree_fn (str) – the file name that the ntree namedtuple will be loaded from

Returns:

a pickle file loaded into memory

Return type:

pickle

omicsdata.tree.neutree.save(ntree, neutree_fn)[source]

Saves the data for a bulk DNA cancer phylongeny reconstruction in a generalized format that’s simply a zipped archive containing a namedtuple

Parameters:
  • ntree (namedtuple) – the name tuple that will be written to a zipped archive

  • neutree_fn (str) – the file name that the ntree namedtuple will be written to

Return type:

None

Module contents