Skip to content

Commit

Permalink
v3.3.c
Browse files Browse the repository at this point in the history
  • Loading branch information
masikol committed Dec 22, 2024
1 parent 648c0cd commit b06e990
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# con-hi changelog

# 2024-12-22 edition

## Version `3.3.c`

Improved logging messages.

# 2024-12-04 edition

## Version `3.3.b`
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

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

## Description

Expand Down
7 changes: 4 additions & 3 deletions con-hi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

import sys

__version__ = '3.3.b'
__version__ = '3.3.c'
# Year, month, day
__last_update_date__ = '2024-12-04'
__last_update_date__ = '2024-12-22'
__min_python_version__ = 3.6
# __author__ = 'Maksim Sikolenko'


import logging
logging.basicConfig(
format='%(asctime)s: %(levelname)s -- %(message)s',
format='%(asctime)s | %(levelname)s | %(message)s',
datefmt='%Y-%m-%d %I:%M:%S',
# datefmt='%Y-%m-%d %I:%M:%S %p',
level=logging.INFO
)
Expand Down
5 changes: 3 additions & 2 deletions src/dependencies.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

import re
import os
import sys
import logging
import subprocess as sp
from typing import List, Tuple, Sequence, Callable
Expand Down Expand Up @@ -31,7 +32,7 @@ def check_depencencies() -> None:
err_msg_list.append(err_msg)
# end if

logging.info(f'version {version}')
logging.info(f' version {version}')
# end for

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

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


Expand Down
26 changes: 18 additions & 8 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import os
import sys
import logging
from typing import Sequence, MutableSequence

Expand Down Expand Up @@ -36,7 +37,8 @@ def main(version: str, last_update_date: str) -> None:
args.target_fasta_fpath,
args.target_seq_ids
)
logging.info('Fasta parsing completed')
logging.info('Fasta parsing completed.')
sys.stderr.write('=' * 20 + '\n')

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

logging.info(f'Annotatiion started: `{rec.description}`')
logging.info(f'Annotatiion started: `{rec.description}`.')

# Obtain path to coverage file
coverage_fpath: str = out.conf_path_to_depth_file(args.outfpath, rec.id)
Expand All @@ -58,7 +60,7 @@ def main(version: str, last_update_date: str) -> None:
rec.id,
coverage_fpath
)
logging.info('Coverage counting competed')
logging.info('Coverage counting completed.')

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

# Detect all necessary coverage features
for cov_threshold in cov_thresholds:
logging.info(f'Screening the sequence for regions with {cov_threshold.get_label()}...')
logging.info(f'Screening the sequence for regions of {cov_threshold.get_label()}...')

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

# Append features to list
rec.features.extend(coverage_features)
logging.info(f'{cov_threshold.get_label()} regions annotated')
sum_feature_lengths: int = sum(
map(len, coverage_features)
)
logging.info(
'Regions of {} annotated. Totally, {:,} bp long.'.format(
cov_threshold.get_label(),
sum_feature_lengths
)
)
# end for

if not args.keep_tmp_cov_file:
Expand All @@ -129,12 +139,12 @@ def main(version: str, last_update_date: str) -> None:
cov_array,
args.outfpath
)
logging.info(f'Annotated sequence saved to `{args.outfpath}`')
logging.info(f'Annotated sequence saved to `{args.outfpath}`.')

print('=' * 10)
sys.stderr.write('=' * 20 + '\n')
# end for

logging.info(f'Completed{with_warnings}!')
logging.info(f'Completed{with_warnings}! Fare you well!')
# end def


Expand Down

0 comments on commit b06e990

Please sign in to comment.