Skip to content

Fix argparse: add missing type= for numeric arguments#8

Open
rec3141 wants to merge 1 commit into
LorMeBioAI:mainfrom
rec3141:fix-argparse-types
Open

Fix argparse: add missing type= for numeric arguments#8
rec3141 wants to merge 1 commit into
LorMeBioAI:mainfrom
rec3141:fix-argparse-types

Conversation

@rec3141

@rec3141 rec3141 commented Mar 6, 2026

Copy link
Copy Markdown

Summary

  • Add type=int to --bin_length, --batch_size, --epoch, --batchsteps
  • Add type=float to --akeep, --lrate
  • Applies to all subcommands (bin, cluster, train) where these args were missing types
  • Fix incorrect help text for --batch_size (said 64, default is 128) and --batchsteps (said "30, 60, 120", default is [30, 100])

Problem

Without explicit type= in add_argument(), argparse treats all CLI values as strings. This causes TypeError at runtime when the code compares them to integers/floats:

TypeError: '<=' not supported between instances of 'str' and 'int'

at lorbin.py:95 (if bin_length <= 0:), and similar errors for other numeric args.

Note: when using the default values (not passing the flag on the CLI), the defaults are already int/float so the bug only manifests when the argument is explicitly passed.

Fixes #2

Several command-line arguments (--bin_length, --akeep, --batch_size,
--epoch, --lrate, --batchsteps) were missing type=int or type=float
in their argparse definitions.  Without explicit types, argparse
treats all CLI values as strings, causing TypeErrors like:

  TypeError: '<=' not supported between instances of 'str' and 'int'

This affects --bin_length in the `bin` and `cluster` subcommands,
and training parameters in `cluster` and `train` subcommands.

Also fixes help text for --batch_size (said 64, default is 128)
and --batchsteps (said "30, 60, 120", default is [30, 100]).

Fixes LorMeBioAI#2
rec3141 pushed a commit to rec3141/danaSeq that referenced this pull request Mar 7, 2026
The $((…)) workaround for LorBin's missing type=int was invalid Groovy
syntax. The upstream fix (LorMeBioAI/LorBin#8) is already in the
container's pip install, so no cast is needed — just pass the param.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rec3141 rec3141 reopened this Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Argparser issues

1 participant