You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @ziqlu0722, for Tangram run finished and got 'tangram_ct_pred', I don't feel confident for the downstream analysis step; can you help me a little? Thanks!
For example, should I do normalization for the probability value and then project to cell types? like using the scripts below:
Hi @ziqlu0722, for Tangram run finished and got 'tangram_ct_pred', I don't feel confident for the downstream analysis step; can you help me a little? Thanks!
For example, should I do normalization for the probability value and then project to cell types? like using the scripts below:
probabilities = np.array(comb_adata.obsm['tangram_pred'])
n_voxels = probabilities.shape[0]
n_cell_types = probabilities.shape[1]
predicted_cell_types = [XXXX cell types
]
assert len(predicted_cell_types) == n_cell_types, f"Mismatch: {len(predicted_cell_types)} vs {n_cell_types}"
sampled_cell_types = []
for voxel_idx in range(n_voxels):
voxel_probabilities = probabilities[voxel_idx, :]
voxel_probabilities /= np.sum(voxel_probabilities)
sampled_cell_type_idx = np.random.choice(n_cell_types, p=voxel_probabilities)
sampled_cell_type = predicted_cell_types[sampled_cell_type_idx]
sampled_cell_types.append(sampled_cell_type)
comb_adata.obs['sampled_cell_type'] = sampled_cell_types
The text was updated successfully, but these errors were encountered: