Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Commit

Permalink
Pass seed to random_state parameter of sc.tl.umap and sc.tl.tsne vib-…
Browse files Browse the repository at this point in the history
  • Loading branch information
dweemx committed Feb 21, 2020
1 parent 357e3a8 commit c8bf402
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bin/dim_reduction/sc_dim_reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ def str2bool(v):
# - /!\ BBKNN is slotting into the sc.pp.neighbors() => sc.pp.neighbors() should not be run afterwards otherwise results will be overwritten
if "neighbors" not in adata.uns.keys():
raise Exception("The neighborhood graph of observations has not been computed. Computing...")
sc.tl.umap(adata)
sc.tl.umap(
adata=adata,
random_state=args.seed
)
elif args.method.lower() == "tsne":
# Run t-SNE
# Source: https://icb-scanpy.readthedocs-hosted.com/en/stable/api/scanpy.tl.tsne.html
Expand All @@ -138,7 +141,8 @@ def str2bool(v):
adata=adata,
n_jobs=args.n_jobs,
use_fast_tsne=args.use_fast_tsne,
n_pcs=args.n_pcs
n_pcs=args.n_pcs,
random_state=args.seed
)
else:
raise Exception("The dimensionality reduction method {} does not exist.".format(args.method))
Expand Down

0 comments on commit c8bf402

Please sign in to comment.