treefit.treefit

treefit.treefit(target, name=None, perturbations=None, normalize=None, reduce_dimension=None, build_tree=None, max_p=20, verbose=False, n_perturbations=20)[source]

Estimate the goodness-of-fit between tree models and data.

Parameters
  • target (dict) –

    The target data to be estimated. It must be one of them:

    • {"counts": COUNTS}

    • {"expression": EXPRESSION}

    COUNTS and EXPRESSION are numpy.array. The rows and columns correspond to samples such as cells and features such as genes. COUNTS’s value is count data such as the number of genes expressed. EXPRESSION’s value is normalized count data.

  • name (string) – The name of target as string.

  • perturbations (list) –

    How to perturbate the target data.

    If this is None, all available perturbation methods are used.

    You can specify used perturbation methods as list. Here are available methods:

    • "poisson": A perturbation method for counts data.

    • "knn": A perturbation method for expression data.

  • normalize (callable) –

    How to normalize counts data.

    If this is None, the default normalization is applied.

    You can specify a callable object that normalized counts data.

  • reduce_dimension (callable) –

    How to reduce dimension of normalized count data.

    If this is None, the default dimensionality reduction is applied.

    You can specify a callable object that reduces dimension of normalized counts data.

  • build_tree (callable) –

    How to build a tree of expression data.

    If this is None, MST is built.

    You can specify a function that builds tree of normalized counts data.

  • max_p (int) –

    How many low dimension Laplacian eigenvectors are used.

    The default is 20.

  • n_perturbations (int) –

    How many times to perturb.

    The default is 20.

Returns

fit – An estimated result as a treefit.fit.Fit object.

Return type

treefit.fit.Fit

Examples

>>> import treefit
# Generate a star tree data that have normalized expression values
# not count data.
>>> star = treefit.data.generate_2d_n_arms_star_data(300, 3, 0.1)
# Estimate tree-likeness of the tree data.
>>> fit = treefit.treefit({"expression": star})