diff --git a/src/bundles/core/src/commands/__init__.py b/src/bundles/core/src/commands/__init__.py index cd567469c8..815029ca0f 100644 --- a/src/bundles/core/src/commands/__init__.py +++ b/src/bundles/core/src/commands/__init__.py @@ -48,13 +48,14 @@ EnumOf, DynamicEnum, ) -from .cli import IntArg, Int2Arg, Int3Arg, IntsArg, NonNegativeIntArg, PositiveIntArg +from .cli import IntArg, Int2Arg, Int3Arg, IntsArg, NonNegativeIntArg, PercentIntArg, PositiveIntArg from .cli import ( FloatArg, Float2Arg, Float3Arg, FloatsArg, NonNegativeFloatArg, + PercentFloatArg, PositiveFloatArg, ) from .cli import FloatOrDeltaArg diff --git a/src/bundles/core/src/commands/cli.py b/src/bundles/core/src/commands/cli.py index 9ddf98b8c0..b68f362171 100644 --- a/src/bundles/core/src/commands/cli.py +++ b/src/bundles/core/src/commands/cli.py @@ -2136,6 +2136,8 @@ def unparse(value, session=None): PositiveIntArg = Bounded(IntArg, min=1, name="an integer >= 1") NonNegativeFloatArg = Bounded(FloatArg, min=0, name="a number >= 0") PositiveFloatArg = Bounded(FloatArg, min=0, inclusive=False, name="a number > 0") +PercentFloatArg = Bounded(FloatArg, min=0, max=100, name="a percentage between 0 and 100") +PercentIntArg = Bounded(IntArg, min=0, max=100, name="a percentage between 0 and 100") ModelIdArg = DottedTupleOf(PositiveIntArg, name="a model id", prefix="#") diff --git a/src/bundles/seqalign/src/cmd.py b/src/bundles/seqalign/src/cmd.py index 8ce602dd33..14938c4765 100644 --- a/src/bundles/seqalign/src/cmd.py +++ b/src/bundles/seqalign/src/cmd.py @@ -373,7 +373,8 @@ def seqalign_identity(session, src1, src2=None, *, denominator=IdentityDenominat session.logger.info("%s vs. %s: %.2f%% identity" % (seq1.name, src2.name, identity)) return identity -def seqalign_match(session, alignment, match_chains, to=None, *, iterate=-1, columns=None): +def seqalign_match(session, alignment, match_chains, to=None, *, + iterate=-1, conservation=None, columns=None): if alignment is None: alignment = get_alignment_by_id(session, None) if columns is None: @@ -385,7 +386,7 @@ def seqalign_match(session, alignment, match_chains, to=None, *, iterate=-1, col if col > length: raise UserError("match column (%d) greater than alignment length (%d)" % (col, length)) indices.append(col-1) - return alignment.match(to, match_chains, iterate=iterate, restriction=indices) + return alignment.match(to, match_chains, iterate=iterate, conservation=conservation, restriction=indices) def seqalign_refresh_attrs(session, alignment): alignment._set_residue_attributes() @@ -497,7 +498,7 @@ def seqalign_align(session, seq_source, *, program=CLUSTAL_OMEGA, replace=False) def register_seqalign_command(logger): # REMINDER: update manager._builtin_subcommands as additional subcommands are added from chimerax.core.commands import CmdDesc, register, create_alias, Or, EmptyArg, RestOfLine, ListOf, \ - EnumOf, BoolArg, NoneArg, PositiveIntArg + EnumOf, BoolArg, NoneArg, PositiveIntArg, PercentFloatArg from chimerax.atomic import UniqueChainsArg, SequencesArg, ChainArg apns = list(alignment_program_name_args.keys()) @@ -552,6 +553,7 @@ def register_seqalign_command(logger): required = [('alignment', Or(AlignmentArg, EmptyArg)), ('match_chains', UniqueChainsArg)], required_arguments = ['to'], keyword = [('to', ChainArg), ('iterate', Or(NoneArg, PositiveIntArg)), + ('conservation', PercentFloatArg), ('columns', ListOf(PositiveIntArg))], synopsis = "superimpose chains associated with sequence alignment" )