pegasus.fle
- pegasus.fle(data, file_name=None, n_jobs=-1, rep='diffmap', rep_ncomps=None, K=50, full_speed=False, target_change_per_node=2.0, target_steps=5000, is3d=False, memory=8, random_state=0, out_basis='fle')[source]
Construct the Force-directed (FLE) graph.
This implementation uses forceatlas2-python package, which is a Python wrapper of ForceAtlas2.
See [Jacomy14] for details on FLE.
- Parameters
data (
pegasusio.MultimodalData) – Annotated data matrix with rows for cells and columns for genes.file_name (
str, optional, default:None) – Temporary file to store the coordinates as the input to forceatlas2. IfNone, usetempfile.mkstempto generate file name.n_jobs (
int, optional, default:-1) – Number of threads to use. If-1, use all physical CPU cores.rep (
str, optional, default:"diffmap") – Representation of data used for the calculation. By default, use Diffusion Map coordinates. IfNone, use the count matrixdata.X.rep_ncomps (
int, optional (default: None)) – Number of components to be used in rep. If rep_ncomps == None, use all components; otherwise, use the minimum of rep_ncomps and rep’s dimensions.K (
int, optional, default:50) – Number of nearest neighbors to be considered during the computation.full_speed (
bool, optional, default:False) –If
True, use multiple threads in constructinghnswindex. However, the kNN results are not reproducible.Otherwise, use only one thread to make sure results are reproducible.
target_change_per_node (
float, optional, default:2.0) – Target change per node to stop ForceAtlas2.target_steps (
int, optional, default:5000) – Maximum number of iterations before stopping the ForceAtlas2 algorithm.is3d (
bool, optional, default:False) – IfTrue, calculate 3D force-directed layout.memory (
int, optional, default:8) – Memory size in GB for the Java FA2 component. By default, use 8GB memory.random_state (
int, optional, default:0) – Random seed set for reproducing results.out_basis (
str, optional, default:"fle") – Key name for calculated FLE coordinates to store.
- Return type
None- Returns
NoneUpdate
data.obsm–data.obsm['X_' + out_basis]: FLE coordinates of the data.
Examples
>>> pg.fle(data)