From 43d635ac1f7bad52a891a1fdf935343529dd48c2 Mon Sep 17 00:00:00 2001 From: Henrique Musseli Cezar Date: Thu, 26 Dec 2024 20:23:56 +0100 Subject: [PATCH] Improve detection of in and out formats. --- clusttraj/__init__.py | 2 +- clusttraj/io.py | 136 ++---------------------------------------- 2 files changed, 7 insertions(+), 131 deletions(-) diff --git a/clusttraj/__init__.py b/clusttraj/__init__.py index c1f1735..00a4b72 100644 --- a/clusttraj/__init__.py +++ b/clusttraj/__init__.py @@ -1,6 +1,6 @@ from .main import main -__version__ = "0.3.0" +__version__ = "0.3.1" __all__ = [ "main", diff --git a/clusttraj/io.py b/clusttraj/io.py index 151be7e..a20a135 100644 --- a/clusttraj/io.py +++ b/clusttraj/io.py @@ -380,6 +380,11 @@ def configure_runtime(args_in: List[str]) -> ClustOptions: Logger.setup(args.log) # check input consistency + if os.path.splitext(args.trajectory_file)[1][1:] not in pybel.informats.keys(): + parser.error( + f"The trajectory file format ({os.path.splitext(args.trajectory_file)[1][1:]}) is not supported." + ) + if args.method not in [ "single", "complete", @@ -402,136 +407,7 @@ def configure_runtime(args_in: List[str]) -> ClustOptions: ) if args.clusters_configurations: - if args.clusters_configurations not in [ - "acr", - "adf", - "adfout", - "alc", - "arc", - "bgf", - "box", - "bs", - "c3d1", - "c3d2", - "cac", - "caccrt", - "cache", - "cacint", - "can", - "car", - "ccc", - "cdx", - "cdxml", - "cht", - "cif", - "ck", - "cml", - "cmlr", - "com", - "copy", - "crk2d", - "crk3d", - "csr", - "cssr", - "ct", - "cub", - "cube", - "dmol", - "dx", - "ent", - "fa", - "fasta", - "fch", - "fchk", - "fck", - "feat", - "fh", - "fix", - "fpt", - "fract", - "fs", - "fsa", - "g03", - "g92", - "g94", - "g98", - "gal", - "gam", - "gamin", - "gamout", - "gau", - "gjc", - "gjf", - "gpr", - "gr96", - "gukin", - "gukout", - "gzmat", - "hin", - "inchi", - "inp", - "ins", - "jin", - "jout", - "mcdl", - "mcif", - "mdl", - "ml2", - "mmcif", - "mmd", - "mmod", - "mol", - "mol2", - "molden", - "molreport", - "moo", - "mop", - "mopcrt", - "mopin", - "mopout", - "mpc", - "mpd", - "mpqc", - "mpqcin", - "msi", - "msms", - "nw", - "nwo", - "outmol", - "pc", - "pcm", - "pdb", - "png", - "pov", - "pqr", - "pqs", - "prep", - "qcin", - "qcout", - "report", - "res", - "rsmi", - "rxn", - "sd", - "sdf", - "smi", - "smiles", - "sy2", - "t41", - "tdd", - "test", - "therm", - "tmol", - "txt", - "txyz", - "unixyz", - "vmol", - "xed", - "xml", - "xyz", - "yob", - "zin", - ]: + if args.clusters_configurations not in pybel.outformats.keys(): parser.error( f"The format you selected to save the clustered superposed configurations ({args.clusters_configurations}) is not valid." )