diff --git a/api/nbnode.apply.html b/api/nbnode.apply.html index 6ae06db..1965790 100644 --- a/api/nbnode.apply.html +++ b/api/nbnode.apply.html @@ -41,7 +41,7 @@

Submodules

nbnode.apply.count_celltree_df module

-nbnode.apply.count_celltree_df.count_celltree_df(celltree_gated: NBNode) DataFrame[source]
+nbnode.apply.count_celltree_df.count_celltree_df(celltree_gated: NBNode) DataFrame[source]

Count the number of rows in node.data (per node) grouped by “sample_name” and concat them into a dataframe

diff --git a/api/nbnode.html b/api/nbnode.html index 3d05b1d..d1e267a 100644 --- a/api/nbnode.html +++ b/api/nbnode.html @@ -283,7 +283,7 @@

Submodules
-property data: DataFrame
+property data: DataFrame

Data of a node for its ids.

root._data contains all data. However, each node only “holds” a subset of the data. To not have to copy the data for each node, we just subset the data @@ -351,7 +351,7 @@

Submodules
-export_counts(only_leafnodes: bool = False, node_counts_dtype='int64') DataFrame[source]
+export_counts(only_leafnodes: bool = False, node_counts_dtype='int64') DataFrame[source]

Export the counts of the predicted celltree to a pd.Dataframe.

Rows are the samples, columns the node names get_name_full()

@@ -500,7 +500,7 @@

Submodules
-predict(values: List | Dict | DataFrame | None = None, names: list | None = None, allow_unfitting_data: bool = False, allow_part_predictions: bool = False) NBNode | List[NBNode] | Series[source]
+predict(values: List | Dict | DataFrame | None = None, names: list | None = None, allow_unfitting_data: bool = False, allow_part_predictions: bool = False) NBNode | List[NBNode] | Series[source]

See single_prediction.

But you can put in dataframes or ndarrays instead of only dict + value/key paired lists.

@@ -1013,7 +1013,7 @@

Submodules

nbnode.nbnode_util module

-nbnode.nbnode_util.frame_cov(dt_frame: Frame) DataFrame[source]
+nbnode.nbnode_util.frame_cov(dt_frame: Frame) DataFrame[source]

Compute the covariance matrix of a datatable frame from all columns.

Similar to pd.DataFrame.cov().

@@ -1031,7 +1031,7 @@

Submodules
-nbnode.nbnode_util.per_node_data_fun(x: DataFrame, fun_name: str, include_features: List[str | int] | slice | None = None, *fun_args, **fun_kwargs) DataFrame | Any[source]
+nbnode.nbnode_util.per_node_data_fun(x: DataFrame, fun_name: str, include_features: List[str | int] | slice | None = None, *fun_args, **fun_kwargs) DataFrame | Any[source]

per_node_data_fun.

To be used in NBnode.node.apply() to apply a function to the data of each node.

diff --git a/api/nbnode.simulation.html b/api/nbnode.simulation.html index c475eff..d9e3991 100644 --- a/api/nbnode.simulation.html +++ b/api/nbnode.simulation.html @@ -41,12 +41,12 @@

Submodules

nbnode.simulation.FlowSimulationTree module

-class nbnode.simulation.FlowSimulationTree.BaseFlowSimulationTree(rootnode: NBNode, data_cellgroup_col: str = 'sample_name', node_percentages: DataFrame | None = None, seed: int = 12987, include_features: List[str] = 'dataset_melanoma', verbose: bool = False)[source]
+class nbnode.simulation.FlowSimulationTree.BaseFlowSimulationTree(rootnode: NBNode, data_cellgroup_col: str = 'sample_name', node_percentages: DataFrame | None = None, seed: int = 12987, include_features: List[str] = 'dataset_melanoma', verbose: bool = False)[source]

Bases: object

Base class for flow simulation.

-estimate_cell_distributions(nodes: List[NBNode]) Dict[str, Dict[Literal['mu', 'cov'], DataFrame]][source]
+estimate_cell_distributions(nodes: List[NBNode]) Dict[str, Dict[Literal['mu', 'cov'], DataFrame]][source]

Estimate the distribution of cells in each node.

If no distribution can be estimated (less than 2 cells), @@ -178,7 +178,7 @@

Submodules
-ncells_from_percentages(percentages: DataFrame, n_cells: int) List[int][source]
+ncells_from_percentages(percentages: DataFrame, n_cells: int) List[int][source]

‘Sample’ the number of cells according to the random percentages

Parameters:
@@ -234,7 +234,7 @@

Submodules
-sample(n_cells: int = 10000, return_sampled_cell_numbers: bool = False, use_only_diagonal_covmat: bool = True, **population_parameters) Tuple[DataFrame, Series] | DataFrame[source]
+sample(n_cells: int = 10000, return_sampled_cell_numbers: bool = False, use_only_diagonal_covmat: bool = True, **population_parameters) Tuple[DataFrame, Series] | DataFrame[source]

Sample cells from the tree.

Parameters:
@@ -261,7 +261,7 @@

Submodules
-sample_populations(n_cells: int = 10000, **population_parameters) Series[source]
+sample_populations(n_cells: int = 10000, **population_parameters) Series[source]

Generate number of cells according to leaf node population distributions.

Parameters:
@@ -291,12 +291,12 @@

Submodules
-class nbnode.simulation.FlowSimulationTree.FlowSimulationTreeDirichlet(rootnode: NBNode, data_cellgroup_col: str = 'sample_name', node_percentages: DataFrame | None = None, seed: int = 12987, include_features='dataset_melanoma', verbose: bool = False)[source]
+class nbnode.simulation.FlowSimulationTree.FlowSimulationTreeDirichlet(rootnode: NBNode, data_cellgroup_col: str = 'sample_name', node_percentages: DataFrame | None = None, seed: int = 12987, include_features='dataset_melanoma', verbose: bool = False)[source]

Bases: BaseFlowSimulationTree

Simulate a tree of cell populations using the Dirichlet distribution.

-property alpha_all: Series
+property alpha_all: Series

The alpha parameter of the Dirichlet distribution for all populations

Concentration parameters “alpha” of the Dirichlet distribution. The alpha parameter is a vector of positive values, where each value @@ -323,7 +323,7 @@

Submodules
-generate_populations(population_parameters, n_cells: int, *args, **kwargs) DataFrame[source]
+generate_populations(population_parameters, n_cells: int, *args, **kwargs) DataFrame[source]

Generate a population of cells using the Dirichlet distribution.

Parameters:
@@ -350,7 +350,7 @@

Submodules
-property mean_leafs: Series
+property mean_leafs: Series

Mean from dirichlet distribution

Estimating a Dirichlet distribution Thomas P. Minka @@ -551,7 +551,7 @@

Submodules
-sample() Tuple[DataFrame, Dict[str, Any], List[DataFrame]][source]
+sample() Tuple[DataFrame, Dict[str, Any], List[DataFrame]][source]

A method to sample with a relative change in a population mean.

See the __init__ method for the description of the arguments.

@@ -573,7 +573,7 @@

Submodules
-sample_customize(n_samples=None, n_cells=None, change_pop_mean_proportional=None, use_only_diagonal_covmat=None, verbose=None, seed_sample_0=None, save_dir=None, _only_return_sampled_cell_numbers=None, save_changed_parameters=False) Tuple[DataFrame, Dict[str, Any], List[DataFrame]][source]
+sample_customize(n_samples=None, n_cells=None, change_pop_mean_proportional=None, use_only_diagonal_covmat=None, verbose=None, seed_sample_0=None, save_dir=None, _only_return_sampled_cell_numbers=None, save_changed_parameters=False) Tuple[DataFrame, Dict[str, Any], List[DataFrame]][source]

A customizable method to sample with a relative change in a population mean.

See the __init__ method for the description of the arguments. In contrast to .sample(), this method allows to change each parameter @@ -604,7 +604,7 @@

Submodules

nbnode.simulation.sim_proportional module

-nbnode.simulation.sim_proportional.sim_proportional(flowsim: FlowSimulationTreeDirichlet, n_samples=100, n_cells=25000, use_only_diagonal_covmat=True, change_pop_mean_proportional={'/AllCells/CD4+/CD8-/Tem': 1}, save_dir='sim/intraassay/sim00_baseline', seed_sample_0=129873, verbose=False, only_return_sampled_cell_numbers=False) Tuple[DataFrame, Dict[str, Any], List[DataFrame]][source]
+nbnode.simulation.sim_proportional.sim_proportional(flowsim: FlowSimulationTreeDirichlet, n_samples=100, n_cells=25000, use_only_diagonal_covmat=True, change_pop_mean_proportional={'/AllCells/CD4+/CD8-/Tem': 1}, save_dir='sim/intraassay/sim00_baseline', seed_sample_0=129873, verbose=False, only_return_sampled_cell_numbers=False) Tuple[DataFrame, Dict[str, Any], List[DataFrame]][source]

This function simulates new cells (n_cells) for n_samples samples according to the given flow simulation flowsim.

@@ -669,7 +669,7 @@

Submodules

nbnode.simulation.sim_target module

-nbnode.simulation.sim_target.sim_target(flowsim: FlowSimulationTreeDirichlet, change_pop_mean_target: List[Dict[str, float]] = [{'/AllCells/CD4+/CD8-/Tem': 0.05}], n_cells=25000, use_only_diagonal_covmat=True, save_dir='sim/intraassay/sim00_target', sample_name=None, seed_sample_0=129873, verbose=False, only_return_sampled_cell_numbers=False, save_changed_parameters=False) Tuple[DataFrame, Dict[str, Any], List[DataFrame]][source]
+nbnode.simulation.sim_target.sim_target(flowsim: FlowSimulationTreeDirichlet, change_pop_mean_target: List[Dict[str, float]] = [{'/AllCells/CD4+/CD8-/Tem': 0.05}], n_cells=25000, use_only_diagonal_covmat=True, save_dir='sim/intraassay/sim00_target', sample_name=None, seed_sample_0=129873, verbose=False, only_return_sampled_cell_numbers=False, save_changed_parameters=False) Tuple[DataFrame, Dict[str, Any], List[DataFrame]][source]

This function simulates new cells (n_cells) for n_samples samples according to the given flow simulation flowsim.

diff --git a/api/nbnode.specific_analyses.intraassay.html b/api/nbnode.specific_analyses.intraassay.html index 4559494..01037f0 100644 --- a/api/nbnode.specific_analyses.intraassay.html +++ b/api/nbnode.specific_analyses.intraassay.html @@ -69,7 +69,7 @@

Submodules

nbnode.specific_analyses.intraassay.gate_init module

-nbnode.specific_analyses.intraassay.gate_init.gate_init(sample_list: List[str] | None = None) Tuple[NBNode, DataFrame, FlowSimulationTreeDirichlet][source]
+nbnode.specific_analyses.intraassay.gate_init.gate_init(sample_list: List[str] | None = None) Tuple[NBNode, DataFrame, FlowSimulationTreeDirichlet][source]

Gate the intraassay samples and generate the Dirichlet-based simulation.

Parameters:
diff --git a/api/nbnode.utils.html b/api/nbnode.utils.html index ae309ed..b4cdef4 100644 --- a/api/nbnode.utils.html +++ b/api/nbnode.utils.html @@ -40,7 +40,7 @@

Submodules

nbnode.utils.merge_leaf_nodes module

-nbnode.utils.merge_leaf_nodes.merge_leaf_nodes(leaf_nodes_df: DataFrame, intermediate_node: str) float[source]
+nbnode.utils.merge_leaf_nodes.merge_leaf_nodes(leaf_nodes_df: DataFrame, intermediate_node: str) float[source]

Merge leaf node dataframe into intermediate node.

Parameters: