Skip to content

Commit

Permalink
Merge pull request #412 from hyanwong/tqdm-auto
Browse files Browse the repository at this point in the history
Reduce notebook size by using the notebook version of tqdm if available
  • Loading branch information
jeromekelleher authored Nov 27, 2024
2 parents a602b50 + 04d17ed commit 7858c86
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sc2ts/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import numba
import tskit
import numpy as np
import tqdm
from tqdm.auto import tqdm
import pandas as pd
import humanize
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -143,7 +143,7 @@ def tally_lineages(ts, metadata_db, show_progress=False):
# Take the exact matches into account also.
counter = collections.Counter(md["exact_matches"]["pango"])
key = "Viridian_pangolin"
iterator = tqdm.tqdm(
iterator = tqdm(
ts.samples()[1:],
desc="ARG metadata",
disable=not show_progress,
Expand Down Expand Up @@ -397,7 +397,7 @@ def max_descendant_samples(ts, show_progress=True):
"""
tree = ts.first()
num_samples = np.zeros(ts.num_nodes, dtype=np.int32)
iterator = tqdm.tqdm(
iterator = tqdm(
tree.preorder(),
desc="Counting descendants ",
total=ts.num_nodes,
Expand Down Expand Up @@ -497,7 +497,7 @@ def _preprocess_nodes(self, show_progress):
self.earliest_pango_lineage = {}
self.pango_lineage_samples = collections.defaultdict(list)

iterator = tqdm.tqdm(
iterator = tqdm(
ts.nodes(),
desc="Indexing metadata ",
total=ts.num_nodes,
Expand Down Expand Up @@ -603,7 +603,7 @@ def _preprocess_mutations(self, show_progress):
transversions.add((b1, b2))

tree = ts.first()
iterator = tqdm.tqdm(
iterator = tqdm(
np.arange(N), desc="Classifying mutations", disable=not show_progress
)
for mut_id in iterator:
Expand Down

0 comments on commit 7858c86

Please sign in to comment.