Skip to content

Commit b06e990

Browse files
committed
v3.3.c
1 parent 648c0cd commit b06e990

File tree

5 files changed

+32
-14
lines changed

5 files changed

+32
-14
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# con-hi changelog
22

3+
# 2024-12-22 edition
4+
5+
## Version `3.3.c`
6+
7+
Improved logging messages.
8+
39
# 2024-12-04 edition
410

511
## Version `3.3.b`

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
“Con-hi” means “**con**sensus-**hi**ghlighter”.
44

5-
Latest version is `3.3.b` (2024-12-04 edition).
5+
Latest version is `3.3.c` (2024-12-22 edition).
66

77
## Description
88

con-hi.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22

33
import sys
44

5-
__version__ = '3.3.b'
5+
__version__ = '3.3.c'
66
# Year, month, day
7-
__last_update_date__ = '2024-12-04'
7+
__last_update_date__ = '2024-12-22'
88
__min_python_version__ = 3.6
99
# __author__ = 'Maksim Sikolenko'
1010

1111

1212
import logging
1313
logging.basicConfig(
14-
format='%(asctime)s: %(levelname)s -- %(message)s',
14+
format='%(asctime)s | %(levelname)s | %(message)s',
15+
datefmt='%Y-%m-%d %I:%M:%S',
1516
# datefmt='%Y-%m-%d %I:%M:%S %p',
1617
level=logging.INFO
1718
)

src/dependencies.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
import re
33
import os
4+
import sys
45
import logging
56
import subprocess as sp
67
from typing import List, Tuple, Sequence, Callable
@@ -31,7 +32,7 @@ def check_depencencies() -> None:
3132
err_msg_list.append(err_msg)
3233
# end if
3334

34-
logging.info(f'version {version}')
35+
logging.info(f' version {version}')
3536
# end for
3637

3738
# Print errors, if they occured
@@ -44,7 +45,7 @@ def check_depencencies() -> None:
4445
# end if
4546

4647
logging.info('All dependencies are satisfied.')
47-
print('=' * 10)
48+
sys.stderr.write('=' * 20 + '\n')
4849
# end def
4950

5051

src/main.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
import os
3+
import sys
34
import logging
45
from typing import Sequence, MutableSequence
56

@@ -36,7 +37,8 @@ def main(version: str, last_update_date: str) -> None:
3637
args.target_fasta_fpath,
3738
args.target_seq_ids
3839
)
39-
logging.info('Fasta parsing completed')
40+
logging.info('Fasta parsing completed.')
41+
sys.stderr.write('=' * 20 + '\n')
4042

4143
# Create ouput directory
4244
_create_outdir_from_outfile(args.outfpath)
@@ -46,7 +48,7 @@ def main(version: str, last_update_date: str) -> None:
4648
rec: SeqRecord
4749
for rec in fasta_records:
4850

49-
logging.info(f'Annotatiion started: `{rec.description}`')
51+
logging.info(f'Annotatiion started: `{rec.description}`.')
5052

5153
# Obtain path to coverage file
5254
coverage_fpath: str = out.conf_path_to_depth_file(args.outfpath, rec.id)
@@ -58,7 +60,7 @@ def main(version: str, last_update_date: str) -> None:
5860
rec.id,
5961
coverage_fpath
6062
)
61-
logging.info('Coverage counting competed')
63+
logging.info('Coverage counting completed.')
6264

6365
# Obtain coverages for current sequence
6466
try:
@@ -98,7 +100,7 @@ def main(version: str, last_update_date: str) -> None:
98100

99101
# Detect all necessary coverage features
100102
for cov_threshold in cov_thresholds:
101-
logging.info(f'Screening the sequence for regions with {cov_threshold.get_label()}...')
103+
logging.info(f'Screening the sequence for regions of {cov_threshold.get_label()}...')
102104

103105
# Get coverage features
104106
coverage_features = hlft.highlight_coverage_features(
@@ -112,7 +114,15 @@ def main(version: str, last_update_date: str) -> None:
112114

113115
# Append features to list
114116
rec.features.extend(coverage_features)
115-
logging.info(f'{cov_threshold.get_label()} regions annotated')
117+
sum_feature_lengths: int = sum(
118+
map(len, coverage_features)
119+
)
120+
logging.info(
121+
'Regions of {} annotated. Totally, {:,} bp long.'.format(
122+
cov_threshold.get_label(),
123+
sum_feature_lengths
124+
)
125+
)
116126
# end for
117127

118128
if not args.keep_tmp_cov_file:
@@ -129,12 +139,12 @@ def main(version: str, last_update_date: str) -> None:
129139
cov_array,
130140
args.outfpath
131141
)
132-
logging.info(f'Annotated sequence saved to `{args.outfpath}`')
142+
logging.info(f'Annotated sequence saved to `{args.outfpath}`.')
133143

134-
print('=' * 10)
144+
sys.stderr.write('=' * 20 + '\n')
135145
# end for
136146

137-
logging.info(f'Completed{with_warnings}!')
147+
logging.info(f'Completed{with_warnings}! Fare you well!')
138148
# end def
139149

140150

0 commit comments

Comments
 (0)