Skip to content

Commit

Permalink
added percentage argument annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
e-pettersen committed Feb 5, 2025
1 parent 21443a6 commit efe5195
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/bundles/core/src/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/bundles/core/src/commands/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="#")


Expand Down
8 changes: 5 additions & 3 deletions src/bundles/seqalign/src/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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()
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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"
)
Expand Down

0 comments on commit efe5195

Please sign in to comment.