Skip to content

Commit

Permalink
Fixed exit message when multiple files share the same filename prefix.
Browse files Browse the repository at this point in the history
  • Loading branch information
rfm-targa committed Mar 22, 2024
1 parent ac8c215 commit 9374361
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CHEWBBACA/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

__version__ = "3.3.3"
__version__ = "3.3.4"
2 changes: 1 addition & 1 deletion CHEWBBACA/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'Rafael Mamede'

# The full version, including alpha/beta/rc tags
release = '3.3.3'
release = '3.3.4'

# -- General configuration ---------------------------------------------------

Expand Down
21 changes: 11 additions & 10 deletions CHEWBBACA/utils/parameters_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1316,18 +1316,19 @@ def check_unique_prefixes(input_list):
"""
input_paths = fo.read_lines(input_list)
basenames = [fo.file_basename(file) for file in input_paths]
unique_ids = [fo.split_joiner(name, [0], '.') for name in basenames]
unique_ids = {}
for name in basenames:
prefix = fo.split_joiner(name, [0], '.')
unique_ids.setdefault(prefix, []).append(name)

# Detect if some inputs share the same unique prefix
if len(set(unique_ids)) < len(input_paths):
basename_counts = [[name, basenames.count(name)]
for name in set(basenames)]
repeated_basenames = ['{0}: {1}'.format(*l)
for l in basename_counts if l[1] > 1]
sys.exit('\nSome input files share the same filename prefix '
'(substring before the first "." in the filename). '
'Please make sure that every input file has a unique '
'filename prefix.\n{0}'.format('\n'.join(repeated_basenames)))
repeated_basenames = [v for k, v in unique_ids.items() if len(v) > 1]
repeated_basenames = [','.join(l) for l in repeated_basenames]
sys.exit('The following input files share the same filename prefix '
'(substring before the first "." in the filename):\n{0}\n'
'Please ensure that every input file has a unique '
'filename prefix.'.format('\n'.join(repeated_basenames)))

return False

Expand All @@ -1354,7 +1355,7 @@ def check_blanks(input_list):
include_blanks = [name for name in basenames if ' ' in name]

if len(include_blanks) > 0:
sys.exit('\nThe following input files include blank spaces '
sys.exit('The following input files include blank spaces '
'in the filename:\n{0}\nPlease ensure that filenames '
'do not include blank spaces or special characters '
'(e.g. !@#?$^*()+)'.format('\n'.join(include_blanks)))
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ authors:
given-names: João
- family-names: Ramirez
given-names: Mário
version: 3.3.0
version: 3.3.4
date-released: "2023-06-29"
keywords:
- bioinformatics
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "chewBBACA"
version = "3.3.3"
version = "3.3.4"
requires-python = ">=3.8"
dependencies = [
"numpy~=1.24.3",
Expand Down

0 comments on commit 9374361

Please sign in to comment.