Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cellrank component #6

Open
bio-la opened this issue Feb 2, 2022 · 0 comments
Open

Cellrank component #6

bio-la opened this issue Feb 2, 2022 · 0 comments

Comments

@bio-la
Copy link

bio-la commented Feb 2, 2022

from velocity_component import velocity_vectors

1. Initialize kernel

from cellrank.tl.kernels import VelocityKernel
vk = VelocityKernel(adata)

input: anndata with velocity vectors
output: initialized kernel object

2. Compute transition matrix

vk.compute_transition_matrix()

input: initialized kernel object
output: kernel object with transition matrix

3. optional but recommended correct velocity kernel by combining with connectivity kernel

ck = ConnectivityKernel(adata).compute_transition_matrix()
#NB 3.1,3.2 are just 1,2 with different param choice

3.1 compute connectivity kernel 
	input: anndata with connectivities
	output: kernel object 

3.2 compute transition matrix
	input: initialized kernel object
	output: kernel object with transition matrix

3.3 combine kernels
	input: 2 kernels and combining ratio (combined_kernel = 0.8 * vk + 0.2 * ck)
	output: combined kernel with transition matrix

4. initialize estimator for matrix decomposition

from cellrank.tl.estimators import GPCCA
g = GPCCA(combined_kernel)

#note best estimator is GPCCA use this by default
input: kernel with transition matrix
output: *estimator* initialized object with transition matrix (anndata)

5. compute matrix decomposition

g.compute_schur(n_components=20)

params: 
		- no of components (usually 20)
		- method: default to krylov for GPCCA

input: *estimator* initialized object with transition matrix (anndata)
output: *estimator* object with transition matrix decomposition (anndata)
#nb this can be plotted

6. compute macrostates

g.compute_macrostates(n_states=3, cluster_key="clusters")

params: 
		- number of macrostates if known, or from inspection of re(gamma) vs eigenvalue index plot
		- clustering info (NB don't understand if this can be run without clustering altogether)

input: *estimator* object with transition matrix decomposition	(anndata)	
output: *estimator* object with computed macrostates (anndata)
#nb this can be plotted

7. identify terminal states from macrostates

options:

	- automatic  
		estimator.compute_terminal_states()
		input: *estimator* object with computed macrostates (anndata)
		output: *estimator* object with terminal states in obs (anndata)
	
	- restrict macrostates to a list of states known beforehand
		estimator.set_terminal_states_from_macrostates()
		input: *estimator* object with computed macrostates (anndata) + list of states
		output: *estimator* object with terminal states in obs (anndata)
	
	- manually set terminal states ignoring macrostates
		estimator.set_terminal_states()
		input: *estimator* object with computed macrostates (anndata) + list of states
		output: *estimator* object with terminal states in obs (anndata)

8. estimate fate probabilties (absorption)

g.compute_absorption_probabilities()

input: *estimator* object with terminal states in obs (anndata)
output: *estimator* object with fate probabilities in obs (anndata)

9. find driver genes (correlate GEX with fate prob)

g.compute_lineage_drivers(lineages="Alpha", return_drivers=True)

input:*estimator* object with fate probabilities in obs (anndata)
output *estimator* object with added .var  (anndata)

10. plotting utilities

input: anndata
output: pngs

- g.plot_spectrum()
- g.plot_macrostates()
- g.plot_lineage_drivers("Alpha", n_genes=5)
- cr.pl.circular_projection(adata, keys="clusters", legend_loc="right")
DriesSchaumont added a commit that referenced this issue Jan 16, 2024
# This is the 1st commit message:

Concatenation: fix order of var_names in concatenated object.

# This is the commit message #2:

Adjust tests in order to use less memory

# This is the commit message #3:

Another attempt to reduce memory footprint

# This is the commit message #4:

Add logging

# This is the commit message #5:

More robust indexing handling

# This is the commit message #6:

Add possibility to disable runtime asserts

# This is the commit message #7:

Use check_list instead of sort

# This is the commit message #8:

Reindexing will always be more efficient

# This is the commit message #9:

Use backed array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant