From b8eef73a4805d2e6feb579eb932f000723abe330 Mon Sep 17 00:00:00 2001
From: Larissa Glass <larissa.glass@unibas.ch>
Date: Wed, 9 Nov 2022 13:46:50 +0100
Subject: [PATCH] Display progress bar for main processing loop

---
 environment.yml | 1 +
 pyproject.toml  | 1 +
 tsg/main.py     | 4 +++-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/environment.yml b/environment.yml
index 3287b74..ac26257 100644
--- a/environment.yml
+++ b/environment.yml
@@ -7,6 +7,7 @@ dependencies:
   - matplotlib
   - pandas
   - pip
+  - tqdm
   - flake8-docstrings
   - mypy
   - flake8
diff --git a/pyproject.toml b/pyproject.toml
index ed805ec..de522e9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -12,6 +12,7 @@ requires-python = ">=3.7"
 license = {text = "MIT"}
 dependencies = [
     "pandas",
+    "tqdm",
 ]
 
 [project.urls]
diff --git a/tsg/main.py b/tsg/main.py
index 25b7455..29e1420 100644
--- a/tsg/main.py
+++ b/tsg/main.py
@@ -2,6 +2,8 @@ import logging
 
 import numpy as np
 import pandas as pd
+from tqdm import tqdm
+
 
 LOG = logging.getLogger(__name__)
 
@@ -288,7 +290,7 @@ def sample_transcripts(
     # Set up output file, write header once and append data in loop
     write_header(output_annotations_file)
 
-    for _, row in transcripts.iterrows():
+    for _, row in tqdm(transcripts.iterrows()):
         transcript_id = row["id"]
         transcript_count = row["count"]
 
-- 
GitLab