Skip to content

Commit

Permalink
add desc to tqdm
Browse files Browse the repository at this point in the history
  • Loading branch information
chaochungkuo committed Mar 14, 2024
1 parent 303ef9c commit de57ce8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion genomkit/annotation/gannotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
6 changes: 3 additions & 3 deletions genomkit/regions/gregions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]):
Expand Down Expand Up @@ -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]):
Expand All @@ -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]):
Expand Down
4 changes: 2 additions & 2 deletions genomkit/sequences/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("#"):
Expand Down Expand Up @@ -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("#"):
Expand Down

0 comments on commit de57ce8

Please sign in to comment.