Skip to content

Looping in python for multiple samples (h5ad files) #475

Answered by VolkerBergen
saeedfc asked this question in Q&A
Discussion options

You must be logged in to vote

You could run it along the following lines, after creating a list of filenames.

import scvelo as scv
for fname in filenames:
   adata = scv.read(f"/mnt/DATA1/Fibrosis/Full Scale Analysis/scVelo/{fname}.h5ad")
   scv.pp.filter_and_normalize(adata, min_shared_counts=20, n_top_genes=2000)
   scv.pp.moments(adata, n_pcs=30, n_neighbors=30)
   scv.tl.recover_dynamics(adata)
   scv.tl.velocity(adata, mode='dynamical')
   scv.tl.velocity_graph(adata)
   scv.pl.velocity_embedding_stream(adata, basis='umap')
   adata.write(f"data/{fname}")

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by WeilerP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #280 on May 30, 2021 13:39.