From de57ce81c4addfc6d5f33631f01d94cc1f241129 Mon Sep 17 00:00:00 2001 From: Joseph Kuo Date: Thu, 14 Mar 2024 10:35:03 +0100 Subject: [PATCH] add desc to tqdm --- genomkit/annotation/gannotation.py | 2 +- genomkit/regions/gregions.py | 6 +++--- genomkit/sequences/io.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/genomkit/annotation/gannotation.py b/genomkit/annotation/gannotation.py index 8f28480..7cf821c 100644 --- a/genomkit/annotation/gannotation.py +++ b/genomkit/annotation/gannotation.py @@ -28,7 +28,7 @@ def load_data(self): open_func = gzip.open if self.file_path.endswith('.gz') else open total_lines = sum(1 for _ in open_func(self.file_path, 'rt')) with open_func(self.file_path, 'rt') as f: - for line in tqdm(f, total=total_lines, desc="Loading Data"): + for line in tqdm(f, total=total_lines, desc="Loading GTF"): if line.startswith('#'): continue fields = line.strip().split('\t') diff --git a/genomkit/regions/gregions.py b/genomkit/regions/gregions.py index 44108e2..3021df0 100644 --- a/genomkit/regions/gregions.py +++ b/genomkit/regions/gregions.py @@ -310,7 +310,7 @@ def intersect(self, target, mode: str = "OVERLAP", cont_overlap = False # OVERLAP ############################### if mode == "OVERLAP": - with tqdm(total=len(b)) as pbar: + with tqdm(total=len(b), desc="Calculate intersects") as pbar: while cont_loop: # When the regions overlap if s.overlap(b[j]): @@ -355,7 +355,7 @@ def intersect(self, target, mode: str = "OVERLAP", pbar.update(1) # ORIGINAL ############################### if mode == "ORIGINAL": - with tqdm(total=len(b)) as pbar: + with tqdm(total=len(b), desc="Calculate intersects") as pbar: while cont_loop: # When the regions overlap if s.overlap(b[j]): @@ -382,7 +382,7 @@ def intersect(self, target, mode: str = "OVERLAP", pbar.update(1) # COMP_INCL ############################### if mode == "COMP_INCL": - with tqdm(total=len(b)) as pbar: + with tqdm(total=len(b), desc="Calculate intersects") as pbar: while cont_loop: # When the regions overlap if s.overlap(b[j]): diff --git a/genomkit/sequences/io.py b/genomkit/sequences/io.py index 29d0c7d..f2a2f3f 100644 --- a/genomkit/sequences/io.py +++ b/genomkit/sequences/io.py @@ -21,7 +21,7 @@ def load_FASTA_from_file(file): current_sequence = "" total_lines = sum(1 for line in file if not line.startswith("#")) file.seek(0) # Reset file pointer to the beginning - with tqdm(total=total_lines) as pbar: + with tqdm(total=total_lines, desc="Load FASTA") as pbar: for line in file: line = line.strip() if line.startswith("#"): @@ -69,7 +69,7 @@ def load_FASTQ_from_file(file): total_records = sum(1 for _ in file) // 4 # Calculate total records file.seek(0) # Reset file pointer to the beginning - with tqdm(total=total_records) as pbar: + with tqdm(total=total_records, desc="Load FASTQ") as pbar: for line_num, line in enumerate(file): line = line.strip() if line.startswith("#"):