Skip to content

Commit

Permalink
Merge pull request #183 from daichengxin/dev
Browse files Browse the repository at this point in the history
ignore case in original extension
  • Loading branch information
ypriverol authored Oct 27, 2024
2 parents 209bde9 + ee099f8 commit d87d22c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sdrf_pipelines/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.31"
__version__ = "0.0.32"
7 changes: 4 additions & 3 deletions sdrf_pipelines/openms/openms.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ def _removesuffix(x: str, suffix: str, /) -> str:
# This is a backport of the function, remove it and use the
# built-in function when we drop support for python 3.8
# https://peps.python.org/pep-0616/
if suffix and x.endswith(suffix):
return x[: -len(suffix)]
if suffix and x.lower().endswith(suffix.lower()):
res = re.sub(suffix + "$", "", x, flags=re.I)
return res
else:
return x[:]

Expand All @@ -59,7 +60,7 @@ def _removesuffix(x: str, suffix: str, /) -> str:

raw_bkp = raw
for current_extension, target_extension in extension_convert_dict.items():
if raw.endswith(current_extension):
if raw.lower().endswith(current_extension.lower()):
raw = _removesuffix(raw, current_extension)
raw += target_extension
if not any(raw.endswith(x) for x in possible_extension):
Expand Down
2 changes: 1 addition & 1 deletion sdrf_pipelines/parse_sdrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def cli():
@click.option(
"--extension_convert",
"-e",
help="convert extensions of files from one type to other 'raw:mzML,mzml:MZML,mzML:mzML,d:d'",
help="convert extensions of files from one type to other 'raw:mzML,mzml:MZML,d:d'. The original extensions are case insensitive",
)
@click.pass_context
def openms_from_sdrf(
Expand Down

0 comments on commit d87d22c

Please sign in to comment.