HoloNet.tools.filter_ce_tensor#
- HoloNet.tools.filter_ce_tensor(ce_tensor, adata, lr_df, elements_expr_df_dict, w_best, n_pairs=200, thres=0.1, distinguish=True, copy=True)#
Filter the edge in calculated CE tensor, removing the edges with low specificities.
For each LR pair, select faked ligand and receptor genes, which have similar expression levels with the ligand and receptor gene in the dataset. Then calculate the background CE tensor using faked LR genes,
Using permutation tests, require filtered edges with communication event strength larger than a proportion of background strengthes.
- Parameters
- ce_tensor
Tensor Calculated CE tensor (LR_pair_num * cell_num * cell_num) by “compute_ce_tensor” function
- adata
AnnData Annotated data matrix.
- lr_df
DataFrame A preprocessed LR-gene dataframe.
- elements_expr_df_dict
dict metadata from ‘elements_expr_df_calculate’ function.
- w_best
float A distance parameter in edge weighting function controlling the covering region of ligands. ‘default_w_visium’ function provides a recommended value of w_best.
- n_pairs
int(default:200) The number of faked ligand and receptor genes.
- thres
float(default:0.1) We require filtered edges with communicatin event strength larger than a proportion of background strengthes. The parameter is the proportion.
- distinguish
bool(default:True) If True, set the different w_best for secreted ligands and plasma-membrane-binding ligands.
- copy
bool(default:True) If False, change the input ce_tensor and save memory consumption.
- ce_tensor
- Return type
Tensor- Returns
: A CE tensor which removed the edges with low specificities (LR_pair_num * cell_num * cell_num).