bsmith89 / StrainFacts

Factorize metagenotypes to infer strains and their abundances
MIT License
11 stars 1 forks source link

Improper error handling when num strains == 1 #2

Closed gavinmdouglas closed 2 years ago

gavinmdouglas commented 2 years ago

Hey again,

Just a quick note regarding a minor issue I just came across. When running sfacts fit with the below command I got a confusing Atrribute Error. I think this is due to issues in the error handling for the case when the num-strains parameter is set to a value that is not permitted.

sfacts fit \
     --verbose \
     --num-strains 1 \
     --random-seed 0 \
     ./Snodgrassella_alvi_yqeY_metagenotype.loaded \
     ./Snodgrassella_alvi_yqeY_metagenotype.fit

Traceback (most recent call last):
  File "/home/gdouglas/local/miniconda3/envs/strainfacts/bin/sfacts", line 33, in <module>
    sys.exit(load_entry_point('StrainFacts', 'console_scripts', 'sfacts')())
  File "/home/gdouglas/local/prg/StrainFacts-0.2/sfacts/app/__init__.py", line 718, in main
    args._subcommand(args)
  File "/home/gdouglas/local/prg/StrainFacts-0.2/sfacts/app/components.py", line 154, in __init__
    args = self.transform_app_parameter_inputs(deepcopy(args))
  File "/home/gdouglas/local/prg/StrainFacts-0.2/sfacts/app/__init__.py", line 329, in transform_app_parameter_inputs
    raise argparse.ArgumentError(
  File "/home/gdouglas/local/miniconda3/envs/strainfacts/lib/python3.10/argparse.py", line 748, in __init__
    self.argument_name = _get_action_name(argument)
  File "/home/gdouglas/local/miniconda3/envs/strainfacts/lib/python3.10/argparse.py", line 728, in _get_action_name
    elif argument.option_strings:
AttributeError: 'str' object has no attribute 'option_strings'

Cheers,

Gavin

bsmith89 commented 2 years ago

Thanks! I'll make sure it's alerting users that strain number needs to be >1.

bsmith89 commented 2 years ago

Fixed by fbdb264.