Skip to content

Commit 531b4e8

Browse files
committed
Augmented affinity matrix computation can use pre computed components
1 parent e1f60a6 commit 531b4e8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/harmony/core.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def augmented_affinity_matrix(data_df, timepoints, timepoint_connections,
1616
:param timepoints: Panadas series indicating timepoints for each cell in data_df
1717
:param timepoint_connections: Links between timepoints
1818
:param n_neighbors: Number of nearest neighbors for graph construction
19-
:param pc_components: Minimum number of principal components to use
19+
:param pc_components: Minimum number of principal components to use. Specify `None` to use pre-computed components
2020
:return: Affinity matrix augmented to mutually nearest neighbors
2121
"""
2222

@@ -34,7 +34,10 @@ def augmented_affinity_matrix(data_df, timepoints, timepoint_connections,
3434
offset += len(tp_cells[i])
3535

3636
# Run PCA to denoise the dropouts
37-
pca_projections, _ = utils.run_pca(data_df, n_components=pc_components)
37+
if pc_components is None:
38+
pca_projections = data_df
39+
else:
40+
pca_projections, _ = utils.run_pca(data_df, n_components=pc_components)
3841

3942
# Nearest neighbor graph construction and affinity matrix
4043
print('Nearest neighbor computation...')

0 commit comments

Comments
 (0)