Skip to content

Commit

Permalink
Add an error in gecco convert when input is not a folder
Browse files Browse the repository at this point in the history
  • Loading branch information
althonos committed Mar 21, 2024
1 parent e7a0132 commit b29f503
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions gecco/cli/commands/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ def _convert_gbk_bigslice(self, ctx: contextlib.ExitStack) -> None:
from Bio.SeqFeature import SeqFeature, FeatureLocation
from ...model import ClusterTable

# locate original folder
if not os.path.exists(self.input_dir):
self.error("Could not find input folder:", repr(self.input_dir))
raise CommandExit(errno.ENOENT)
# collect `*.clusters.tsv` files
cluster_files = glob.glob(os.path.join(self.input_dir, "*.clusters.tsv"))
unit = "table" if len(cluster_files) == 1 else "tables"
Expand Down Expand Up @@ -262,6 +258,13 @@ def execute(self, ctx: contextlib.ExitStack) -> int: # noqa: D102
self._check()
ctx.enter_context(self.progress)
ctx.enter_context(patch_showwarnings(self._showwarnings)) # type: ignore
# check the input is a folder
if not os.path.exists(self.input_dir):
self.error("Could not find input folder:", repr(self.input_dir))
raise CommandExit(errno.ENOENT)
elif not os.path.isdir(self.input_dir):
self.error("Input is not a folder:", repr(self.input_dir))
raise CommandExit(errno.ENOTDIR)
# run the appropriate method
if self.args["gbk"]:
if self.args["--format"] == "bigslice":
Expand Down

0 comments on commit b29f503

Please sign in to comment.