Beispiel #1
0
def register_command(logger):
    from chimerax.core.commands import CmdDesc, register, AnnotationError, \
        Or, EmptyArg, ColorArg, NonNegativeIntArg, FloatArg, BoolArg, SaveFileNameArg, ObjectsArg
    from chimerax.atomic import PseudobondsArg
    # eventually this will handle more than just atoms, but for now...
    d_desc = CmdDesc(
        required = [('objects', ObjectsArg)],
        keyword = [('color', ColorArg), ('dashes', NonNegativeIntArg), ('radius', FloatArg),
            ('decimal_places', NonNegativeIntArg), ('symbol', BoolArg), ('signed', BoolArg)],
        synopsis = 'show/report distance')
    register('distance', d_desc, distance, logger=logger)
    # command registration doesn't allow resuse of the sam CmdDesc, so...
    xd_desc = lambda: CmdDesc(
        required = [('pbonds', Or(PseudobondsArg,EmptyArg))],
        synopsis = 'remove distance monitors')
    register('~distance', xd_desc(), xdistance, logger=logger)
    register('distance delete', xd_desc(), xdistance, logger=logger)
    df_desc = CmdDesc(
        required = [('pbonds', Or(PseudobondsArg,EmptyArg))],
        keyword = [('color', ColorArg), ('dashes', NonNegativeIntArg), ('radius', FloatArg),
            ('decimal_places', NonNegativeIntArg), ('symbol', BoolArg), ('set_defaults', BoolArg)],
        synopsis = 'set distance display properties')
    register('distance style', df_desc, distance_style, logger=logger)
    ds_desc = CmdDesc(
        required = [('save_file_name', SaveFileNameArg)],
        synopsis = 'save distance information')
    register('distance save', ds_desc, distance_save, logger=logger)
Beispiel #2
0
def register_command(logger):
    global _registered
    if _registered:
        # registration can be called for both main command and alias, so only do once...
        return
    _registered = True
    from chimerax.core.commands import CmdDesc, register, FloatArg, StringArg, \
        BoolArg, NoneArg, TopModelsArg, create_alias, Or, DynamicEnum
    from chimerax.atomic import AtomsArg
    from chimerax import sim_matrices
    desc = CmdDesc(
        required=[('match_atoms', AtomsArg)],
        required_arguments=['to'],
        keyword=[
            ('to', AtomsArg), ('pairing', StringArg), ('alg', StringArg),
            ('verbose', BoolArg), ('ss_fraction', Or(FloatArg, BoolArg)),
            ('matrix',
             DynamicEnum(
                 lambda logger=logger: sim_matrices.matrices(logger).keys())),
            ('gap_open', FloatArg), ('hgap', FloatArg), ('sgap', FloatArg),
            ('ogap', FloatArg), ('cutoff_distance', Or(FloatArg, NoneArg)),
            ('gap_extend', FloatArg), ('bring', TopModelsArg),
            ('show_alignment', BoolArg), ('compute_ss', BoolArg),
            ('mat_hh', FloatArg), ('mat_ss', FloatArg), ('mat_oo', FloatArg),
            ('mat_hs', FloatArg), ('mat_ho', FloatArg), ('mat_so', FloatArg),
            ('keep_computed_ss', BoolArg)
        ],
        synopsis='Align atomic structures using sequence alignment')
    register('matchmaker', desc, cmd_match, logger=logger)
    create_alias('mmaker',
                 "%s $*" % 'matchmaker',
                 logger=logger,
                 url="help:user/commands/matchmaker.html")
Beispiel #3
0
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
    from chimerax.atomic import UniqueChainsArg
    desc = CmdDesc(
        required = [('chains', UniqueChainsArg)],
        synopsis = 'show structure chain sequence'
    )
    register('sequence chain', desc, seqalign_chain, logger=logger)

    desc = CmdDesc(
        required = [('chains', UniqueChainsArg)],
        optional = [('target', Or(AlignmentArg, AlignSeqPairArg))],
        synopsis = 'associate chain(s) with sequence'
    )
    register('sequence associate', desc, seqalign_associate, logger=logger)

    desc = CmdDesc(
        required = [('chains', UniqueChainsArg)],
        optional = [('alignment', AlignmentArg)],
        synopsis = 'disassociate chain(s) from alignment'
    )
    register('sequence disassociate', desc, seqalign_disassociate, logger=logger)
    create_alias('sequence dissociate', 'sequence disassociate $*', logger=logger,
            url="help:user/commands/sequence.html#disassociate")

    desc = CmdDesc(
        required = [('alignments', Or(AlignmentArg,ListOf(AlignmentArg),EmptyArg)),
            ('subcommand_text', RestOfLine)],
        synopsis = "send subcommand to header"
    )
    register('sequence header', desc, seqalign_header, logger=logger)

    from . import manager
    manager._register_viewer_subcommands(logger)
Beispiel #4
0
def register_label_command(logger):

    from chimerax.core.commands import CmdDesc, register, Or, BoolArg, IntArg, StringArg, FloatArg, ColorArg
    from chimerax.core.commands import NonNegativeFloatArg, EnumOf
    from .label3d import DefArg, NoneArg

    labels_arg = [('labels', Or(NamedLabelsArg, LabelsArg))]
    # Create and change have same arguments
    cargs = [('text', StringArg), ('color', Or(DefArg, ColorArg)),
             ('bg_color', Or(NoneArg, ColorArg)), ('size', IntArg),
             ('font', StringArg), ('bold', BoolArg), ('italic', BoolArg),
             ('xpos', FloatArg), ('ypos', FloatArg), ('visibility', BoolArg),
             ('margin', NonNegativeFloatArg), ('outline', NonNegativeFloatArg)]
    create_desc = CmdDesc(required=[('name', StringArg)],
                          keyword=cargs,
                          synopsis='Create a 2d label')
    register('2dlabels create', create_desc, label_create, logger=logger)
    change_desc = CmdDesc(required=labels_arg,
                          keyword=cargs + [('frames', IntArg)],
                          synopsis='Change a 2d label')
    register('2dlabels change', change_desc, label_change, logger=logger)
    delete_desc = CmdDesc(optional=[('labels',
                                     Or(EnumOf(['all']), LabelsArrowsArg))],
                          synopsis='Delete a 2d label')
    register('2dlabels delete', delete_desc, label_delete, logger=logger)
    fonts_desc = CmdDesc(synopsis='List available fonts')
    register('2dlabels listfonts', fonts_desc, label_listfonts, logger=logger)

    label_desc = CmdDesc(optional=labels_arg,
                         keyword=cargs + [('frames', IntArg)],
                         synopsis='Create or change a 2d label')
    register('2dlabels', label_desc, label2d, logger=logger)
Beispiel #5
0
def register_command(logger):
    from chimerax.core.commands import register, CmdDesc, ObjectsArg, EmptyArg, EnumOf, Or, IntArg
    desc = CmdDesc(required = [('objects', Or(ObjectsArg, EmptyArg)),
                               ('atom_style', Or(EnumOf(('sphere', 'ball', 'stick')), EmptyArg))],
                   keyword = [('dashes', IntArg),
                              ('ring_fill', EnumOf(['on', 'off', 'thick', 'thin']))],
                   synopsis='change atom and bond depiction')
    register('style', desc, style, logger=logger)
Beispiel #6
0
def register_command(command_name, logger):
    from chimerax.core.commands \
        import CmdDesc, register, BoolArg, FloatArg, ColorArg, Or, EnumOf, NoneArg, EmptyArg, \
            SaveFileNameArg, NonNegativeIntArg, StringArg, AttrNameArg, PositiveIntArg
    from chimerax.atomic import AtomsArg
    del_kw = {'keyword': [('name', StringArg)]}
    if command_name in ["clashes", "contacts"]:
        kw = {
            'required': [('test_atoms', Or(AtomsArg, EmptyArg))],
            'keyword':
            [('name', StringArg), ('hbond_allowance', FloatArg),
             ('overlap_cutoff', FloatArg), ('attr_name', AttrNameArg),
             ('bond_separation', NonNegativeIntArg), ('continuous', BoolArg),
             ('distance_only', FloatArg), ('inter_model', BoolArg),
             ('inter_submodel', BoolArg), ('intra_model', BoolArg),
             ('intra_mol', BoolArg), ('intra_res', BoolArg), ('log', BoolArg),
             ('make_pseudobonds', BoolArg),
             ('naming_style', EnumOf(('simple', 'command', 'serial'))),
             ('color', Or(NoneArg, ColorArg)), ('radius', FloatArg),
             ('res_separation', PositiveIntArg),
             ('restrict', Or(EnumOf(('cross', 'both', 'any')), AtomsArg)),
             ('reveal', BoolArg), ('save_file', SaveFileNameArg),
             ('set_attrs', BoolArg), ('select', BoolArg),
             ('show_dist', BoolArg), ('dashes', NonNegativeIntArg),
             ('summary', BoolArg)],
        }
        register('clashes',
                 CmdDesc(**kw, synopsis="Find clashes"),
                 cmd_clashes,
                 logger=logger)
        register('contacts',
                 CmdDesc(**kw,
                         synopsis="Find contacts",
                         url="help:user/commands/clashes.html"),
                 cmd_contacts,
                 logger=logger)
        register('clashes delete',
                 CmdDesc(synopsis="Remove clash pseudobonds", **del_kw),
                 cmd_xclashes,
                 logger=logger)
        register('contacts delete',
                 CmdDesc(synopsis="Remove contact pseudobonds",
                         url="help:user/commands/clashes.html",
                         **del_kw),
                 cmd_xcontacts,
                 logger=logger)
    else:
        register('~clashes',
                 CmdDesc(synopsis="Remove clash pseudobonds", **del_kw),
                 cmd_xclashes,
                 logger=logger)
        register('~contacts',
                 CmdDesc(synopsis="Remove contact pseudobonds",
                         url="help:user/commands/clashes.html",
                         **del_kw),
                 cmd_xcontacts,
                 logger=logger)
Beispiel #7
0
def register_command(logger):
    from chimerax.core.commands import register, CmdDesc, ObjectsArg, EmptyArg, EnumOf, Or, FloatArg
    desc = CmdDesc(required = [('objects', Or(ObjectsArg, EmptyArg))],
                   keyword = [('atom_radius', Or(EnumOf(['default']), FloatArg)),
                              ('stick_radius', FloatArg),
                              ('pseudobond_radius', FloatArg),
                              ('ball_scale', FloatArg)],
                   synopsis='change atom and bond sizes')
    register('size', desc, size, logger=logger)
Beispiel #8
0
def register_command(logger):
    from chimerax.core.commands import register, CmdDesc, ObjectsArg
    from chimerax.core.commands import EmptyArg, Or, StringArg, BoolArg, IntArg, FloatArg
    desc = CmdDesc(required=[('objects', Or(ObjectsArg, EmptyArg)),
                             ('target', StringArg), ('attr_name', StringArg),
                             ('attr_value',
                              Or(IntArg, FloatArg, BoolArg, StringArg))],
                   keyword=[('create', BoolArg)],
                   synopsis="set attributes")
    register('setattr', desc, set_attr, logger=logger)
Beispiel #9
0
def register_command(logger):
    from chimerax.core.commands import CmdDesc, register, EnumOf, EmptyArg, ObjectsArg, Or
    from chimerax.core.commands import BoolArg, Float2Arg, Float3Arg, ModelArg, create_alias
    methods = ('frontCenter', 'fixed', 'centerOfView')
    desc = CmdDesc(optional=[('method', Or(EnumOf(methods), EmptyArg)),
                             ('objects', Or(ObjectsArg, EmptyArg)),
                             ('pivot', Float3Arg)],
                   keyword=[('coordinate_system', ModelArg),
                            ('show_pivot', Or(Float2Arg, BoolArg))],
                   synopsis='set center of rotation method')
    register('cofr', desc, cofr, logger=logger)
    create_alias('~cofr', 'cofr frontCenter')
Beispiel #10
0
def register_label_command(logger):

    from chimerax.core.commands import CmdDesc, register, create_alias, ObjectsArg, StringArg, FloatArg
    from chimerax.core.commands import Float3Arg, ColorArg, IntArg, BoolArg, EnumOf, Or, EmptyArg

    otype = EnumOf(('atoms', 'residues', 'pseudobonds', 'bonds'))
    desc = CmdDesc(required=[('objects', Or(ObjectsArg, EmptyArg))],
                   optional=[('object_type', otype)],
                   keyword=[('text', Or(DefArg, StringArg)),
                            ('offset', Or(DefArg, Float3Arg)),
                            ('color', Or(DefArg, ColorArg)),
                            ('bg_color', Or(NoneArg, ColorArg)),
                            ('size', Or(DefArg, IntArg)),
                            ('height', Or(EnumOf(['fixed']), FloatArg)),
                            ('default_height', FloatArg), ('font', StringArg),
                            ('attribute', StringArg), ('on_top', BoolArg)],
                   synopsis='Create atom labels')
    register('label', desc, label, logger=logger)
    desc = CmdDesc(optional=[('orient', FloatArg)],
                   synopsis='Set label orientation updating')
    register('label orient', desc, label_orient, logger=logger)
    desc = CmdDesc(required=[('objects', Or(ObjectsArg, EmptyArg))],
                   optional=[('object_type', otype)],
                   synopsis='Delete atom labels')
    register('label delete', desc, label_delete, logger=logger)
    desc = CmdDesc(synopsis='List available fonts')
    from .label2d import label_listfonts
    register('label listfonts', desc, label_listfonts, logger=logger)
    create_alias('~label', 'label delete $*', logger=logger)
Beispiel #11
0
def register_command(logger):
    from chimerax.core.commands import register, Or, CmdDesc
    from chimerax.core.commands import Bounded, FloatArg, EnumOf, BoolArg, IntArg, TupleOf, NoArg
    from chimerax.atomic import AtomsArg, AtomicStructuresArg
    desc = CmdDesc(optional=[("atoms", AtomsArg)],
                   keyword=[("smooth", Or(Bounded(FloatArg, 0.0, 1.0),
                                          EnumOf(["default"]))),
                            ("suppress_backbone_display", BoolArg),
                            ("spine", BoolArg),
                            ],
                   hidden=["spine"],
                   synopsis='display cartoon for specified residues')
    register("cartoon", desc, cartoon, logger=logger)

    desc = CmdDesc(optional=[("structures", AtomicStructuresArg)],
                   keyword=[("scale", Bounded(FloatArg, 0.0, 1.0)),
                            ("shape", EnumOf(_TetherShapeMap.keys())),
                            ("sides", Bounded(IntArg, 3, 24)),
                            ("opacity", Bounded(FloatArg, 0.0, 1.0)),
                            ],
                   synopsis='set cartoon tether options for specified structures')
    register("cartoon tether", desc, cartoon_tether, logger=logger)

    desc = CmdDesc(optional=[("atoms", AtomsArg)],
                   keyword=[("width", FloatArg),
                            ("thickness", FloatArg),
                            ("arrows", BoolArg),
                            ("arrows_helix", BoolArg),
                            ("arrow_scale", Bounded(FloatArg, 1.0, 5.0)),
                            ("xsection", EnumOf(_XSectionMap.keys())),
                            ("sides", Bounded(EvenIntArg, 3, 24)),
                            ("divisions", Bounded(IntArg, 2, 40)),
                            ("bar_scale", FloatArg),
                            ("bar_sides", Bounded(EvenIntArg, 3, 24)),
                            ("ss_ends", EnumOf(["default", "short", "long"])),
                            ("mode_helix", EnumOf(list(_ModeHelixMap.keys()))),
                            ("mode_strand", EnumOf(list(_ModeStrandMap.keys()))),
                            ("radius", Or(FloatArg, EnumOf(["auto"]))),
                            ("spline_normals", BoolArg),
                            ],
                   hidden=["ss_ends", "mode_strand", "spline_normals"],
                   synopsis='set cartoon style for secondary structures in specified models')
    register("cartoon style", desc, cartoon_style, logger=logger)
    desc = CmdDesc(optional=[("atoms", AtomsArg)],
                   synopsis='undisplay cartoon for specified residues')
    register("cartoon hide", desc, uncartoon, logger=logger)
    from chimerax.core.commands import create_alias
    create_alias("~cartoon", "cartoon hide $*", logger=logger)
Beispiel #12
0
def register_command(logger):
    from chimerax.core.commands import CmdDesc, register, create_alias
    from chimerax.core.commands import CenterArg, CoordSysArg, Or, EnumOf, FloatArg, AxisArg
    from chimerax.core.commands import ModelsArg, BoolArg
    offset_arg = Or(EnumOf(['off']), FloatArg)
    desc = CmdDesc(optional=[],
                   keyword=[('near', offset_arg), ('far', offset_arg),
                            ('front', offset_arg), ('back', offset_arg),
                            ('position', CenterArg), ('axis', AxisArg),
                            ('coordinate_system', CoordSysArg)],
                   synopsis='set clip planes')
    register('clip', desc, clip, logger=logger)
    register('clip off',
             CmdDesc(synopsis='Turn off all clip planes'),
             clip_off,
             logger=logger)
    register('clip list',
             CmdDesc(synopsis='List active clip planes'),
             clip_list,
             logger=logger)
    model_desc = CmdDesc(required=[('models', ModelsArg)],
                         optional=[('clipping', BoolArg)],
                         synopsis="Turn off clipping for individual models.")
    register('clip model', model_desc, clip_model, logger=logger)
    create_alias('~clip', 'clip off', logger=logger)
Beispiel #13
0
def register_command(logger):
    from chimerax.core.commands import register, CmdDesc, StringArg, ColorArg, NoArg, EnumOf
    from chimerax.core.commands import Or, RestOfLine, create_alias
    register(
        'color list',
        CmdDesc(
            optional=[('which', EnumOf(["all", "custom", "builtin"]))],
            synopsis='list colors'),
        list_colors, logger=logger
    )

    register(
        'color show',
        CmdDesc(required=[('name', RestOfLine)],
                synopsis="show color"),
        show_color, logger=logger
    )
    register(
        'color name',
        CmdDesc(required=[('name', StringArg), ('color', ColorArg)],
                synopsis="name a custom color"),
        name_color, logger=logger
    )
    register(
        'color delete',
        CmdDesc(required=[('name', Or(EnumOf(['custom']), StringArg))],
                synopsis="remove color definition"),
        delete_color, logger=logger
    )
    create_alias('colordef', 'color name $*', logger=logger)
    create_alias('~colordef', 'color delete $*', logger=logger)
    create_alias('colourdef', 'color name $*', logger=logger,
            url="help:user/commands/colordef.html")
    create_alias('~colourdef', 'color delete $*', logger=logger,
            url="help:user/commands/colordef.html")
Beispiel #14
0
def register_marker_command(logger):
    from chimerax.core.commands import CmdDesc, register, FloatArg, Color8Arg, BoolArg, StringArg
    from chimerax.core.commands import CenterArg, CoordSysArg, ModelIdArg, Or, EnumOf, SurfacesArg
    desc = CmdDesc(required=[('marker_set', Or(MarkerSetArg, ModelIdArg))],
                   keyword=[('position', CenterArg), ('radius', FloatArg),
                            ('color', Color8Arg),
                            ('coordinate_system', CoordSysArg)],
                   required_arguments=['position'],
                   synopsis='Place a marker')
    register('marker', desc, marker, logger=logger)

    desc = CmdDesc(required=[('markers', MarkersArg)],
                   keyword=[('links_only', BoolArg)],
                   synopsis='Delete markers')
    register('marker delete', desc, marker_delete, logger=logger)

    desc = CmdDesc(required=[('some_markers', MarkersArg)],
                   keyword=[('position', CenterArg), ('radius', FloatArg),
                            ('color', Color8Arg),
                            ('coordinate_system', CoordSysArg),
                            ('markers', BoolArg), ('links', BoolArg)],
                   synopsis='Change marker position or appearance')
    register('marker change', desc, marker_change, logger=logger)

    desc = CmdDesc(required=[('markers', MarkersArg)],
                   keyword=[('radius', FloatArg), ('color', Color8Arg)],
                   synopsis='Connect two markers')
    register('marker link', desc, marker_link, logger=logger)

    desc = CmdDesc(required=[('marker_set', Or(MarkerSetArg, ModelIdArg))],
                   keyword=[('position', CenterArg),
                            ('to_position', CenterArg), ('radius', FloatArg),
                            ('color', Color8Arg),
                            ('coordinate_system', CoordSysArg),
                            ('label', StringArg), ('label_height', FloatArg),
                            ('label_color', Or(EnumOf(['default']),
                                               Color8Arg))],
                   required_arguments=['position', 'to_position'],
                   synopsis='Create two markers and a link between them')
    register('marker segment', desc, marker_segment, logger=logger)

    desc = CmdDesc(required=[('surfaces', SurfacesArg)],
                   keyword=[('edge_radius', FloatArg), ('color', Color8Arg),
                            ('markers', MarkerSetArg)],
                   synopsis='Create markers and links for surface mesh')
    register('marker fromMesh', desc, markers_from_mesh, logger=logger)
Beispiel #15
0
def register_command(logger):
    from chimerax.core.commands import CmdDesc, Or, EnumOf, EmptyArg, RestOfLine, register
    desc = CmdDesc(optional=[('option',
                              Or(EnumOf(['allOptions'], abbreviations=False),
                                 EmptyArg)), ('command_name', RestOfLine)],
                   non_keyword=['command_name', 'option'],
                   hidden=['option'],
                   synopsis='show command usage')
    register('usage', desc, usage, logger=logger)
Beispiel #16
0
def register_command(logger):
    from chimerax.core.commands import CmdDesc, register, ObjectsArg
    from chimerax.core.commands import FloatArg, IntArg, ColorArg, BoolArg, NoArg, create_alias
    from chimerax.core.commands import SurfacesArg, EmptyArg, EnumOf, Or
    from chimerax.atomic import AtomsArg
    surface_desc = CmdDesc(optional=[('atoms', AtomsArg)],
                           keyword=[('enclose', AtomsArg),
                                    ('include', AtomsArg),
                                    ('probe_radius', FloatArg),
                                    ('grid_spacing', FloatArg),
                                    ('resolution', FloatArg),
                                    ('level', FloatArg), ('color', ColorArg),
                                    ('transparency', FloatArg),
                                    ('visible_patches', IntArg),
                                    ('sharp_boundaries', BoolArg),
                                    ('nthread', IntArg), ('replace', BoolArg),
                                    ('update', BoolArg)],
                           synopsis='create molecular surface')
    register('surface', surface_desc, surface, logger=logger)

    show_desc = CmdDesc(optional=[('objects', ObjectsArg)],
                        synopsis='Show patches of molecular surfaces')
    register('surface showPatches',
             show_desc,
             surface_show_patches,
             logger=logger)

    hide_desc = CmdDesc(optional=[('objects', ObjectsArg)],
                        synopsis='Hide patches of molecular surfaces')
    register('surface hidePatches',
             hide_desc,
             surface_hide_patches,
             logger=logger)
    create_alias('~surface', 'surface hidePatches $*', logger=logger)

    close_desc = CmdDesc(optional=[('objects', ObjectsArg)],
                         synopsis='close molecular surfaces')
    register('surface close', close_desc, surface_close, logger=logger)

    style_desc = CmdDesc(required=[('surfaces', Or(SurfacesArg, EmptyArg)),
                                   ('style', EnumOf(
                                       ('mesh', 'dot', 'solid')))],
                         synopsis='Change surface style to mesh, dot or solid')
    register('surface style', style_desc, surface_style, logger=logger)

    cap_desc = CmdDesc(optional=[
        ('enable', BoolArg),
    ],
                       keyword=[('offset', FloatArg),
                                ('subdivision', FloatArg), ('mesh', BoolArg)],
                       synopsis='Enable or disable clipping surface caps')
    register('surface cap', cap_desc, surface_cap, logger=logger)

    # Register surface operation subcommands.
    from . import sop
    sop.register_surface_subcommands(logger)
Beispiel #17
0
def register_command(logger):
    from chimerax.core.commands import create_alias, CmdDesc, register, Or, EmptyArg, StringArg, BoolArg
    from chimerax.atomic import AtomsArg, BondsArg, PseudobondsArg
    desc = CmdDesc(required=[('atoms', AtomsArg)],
                   keyword=[('attached_hyds', BoolArg)],
                   synopsis='delete atoms')
    register('delete', desc, delete, logger=logger)
    desc = CmdDesc(required=[('atoms', Or(AtomsArg, EmptyArg))],
                   keyword=[('attached_hyds', BoolArg)],
                   synopsis='delete atoms')
    register('delete atoms', desc, delete_atoms, logger=logger)
    desc = CmdDesc(required=[('bonds', Or(BondsArg, EmptyArg))],
                   synopsis='delete bonds')
    register('delete bonds', desc, delete_bonds, logger=logger)
    desc = CmdDesc(required=[('pbonds', Or(PseudobondsArg, EmptyArg))],
                   keyword=[('name', StringArg)],
                   synopsis='delete pseudobonds')
    register('delete pbonds', desc, delete_pbonds, logger=logger)
    create_alias('delete pseudobonds', 'delete pbonds $*', logger=logger)
Beispiel #18
0
def register_command(command_name, logger):
    from chimerax.core.commands import CmdDesc, register, BoolArg, ColorArg, Or, StringArg, EmptyArg, \
        FloatArg
    from chimerax.atomic import AtomsArg
    desc = CmdDesc(required=[('atoms', Or(AtomsArg,EmptyArg))],
        keyword = [('mass_weighting', BoolArg), ('name', StringArg), ('color', ColorArg),
            ('radius', FloatArg)],
        synopsis = 'Show centroid'
    )
    register('define centroid', desc, cmd_centroid, logger=logger)
Beispiel #19
0
def register_command(logger):
    from chimerax.core.commands import register, CmdDesc
    from chimerax.core.commands import EmptyArg, Or, OpenFileNameArg, BoolArg
    from chimerax.atomic import StructuresArg
    desc = CmdDesc(required=[
        ('structures', Or(StructuresArg, EmptyArg)),
        ('file_name', OpenFileNameArg),
    ],
                   keyword=[('log', BoolArg)],
                   synopsis="define attributes in bulk")
    register('defattr', desc, cmd_defattr, logger=logger)
Beispiel #20
0
 def register_isolde_step():
     desc = CmdDesc(synopsis=(
         'Step the view forward or backward through the chain, or '
         'jump to a specific residue'),
                    optional=[
                        ('residue', Or(ResiduesArg, StringArg)),
                    ],
                    keyword=[('view_distance', FloatArg),
                             ('interpolate_frames', PositiveIntArg),
                             ('polymeric_only', BoolArg),
                             ('select', BoolArg)])
     register('isolde stepto', desc, isolde_step, logger=logger)
Beispiel #21
0
def register_command(logger):
    from chimerax.core.commands import register, CmdDesc, Or, ObjectsArg, EmptyArg, FloatArg
    from chimerax.core.commands import ListOf, EnumOf
    from .color import TargetArg
    from .color import WHAT_TARGETS
    what_arg = ListOf(EnumOf((*WHAT_TARGETS.keys(),)))
    desc = CmdDesc(required=[('objects', Or(ObjectsArg, EmptyArg)),
                             ('percent', FloatArg)],
                   optional=[('what', what_arg)],
                   keyword=[('target', TargetArg)],
                   synopsis="change object transparency")
    register('transparency', desc, transparency, logger=logger)
Beispiel #22
0
def register_command(logger):
    from chimerax.core.commands import CmdDesc, register, ObjectsArg, EnumOf, EmptyArg, Or, \
        NoArg, BoolArg, create_alias
    desc = CmdDesc(optional=[('objects', Or(ObjectsArg, EmptyArg)),
                             ('what', WhatArg)],
                   keyword=[('target', TargetArg), ('only', NoArg)],
                   hidden=['only'],
                   synopsis='show specified objects')
    register('show', desc, show, logger=logger)
    create_alias('display',
                 'show $*',
                 logger=logger,
                 url="help:user/commands/show.html")
Beispiel #23
0
def register_command(command_name, logger):
    from chimerax.core.commands import CmdDesc, register, BoolArg, Or, EmptyArg, FloatArg
    from chimerax.atomic import AtomicStructuresArg
    desc = CmdDesc(required=[('structures', Or(AtomicStructuresArg,
                                               EmptyArg))],
                   keyword=[
                       ('hbond', BoolArg), ('in_isolation', BoolArg),
                       ('metal_dist', FloatArg), ('template', BoolArg),
                       ('use_his_name', BoolArg), ('use_glu_name', BoolArg),
                       ('use_asp_name', BoolArg), ('use_lys_name', BoolArg),
                       ('use_cys_name', BoolArg)
                   ],
                   synopsis='Add hydrogens')
    register('addh', desc, cmd_addh, logger=logger)
Beispiel #24
0
def register_command(logger):
    from chimerax.core.commands import register, CmdDesc, ColormapArg, ObjectsArg
    from chimerax.core.commands import EmptyArg, Or, EnumOf, StringArg, TupleOf, FloatArg, BoolArg
    from .color import _SequentialLevels
    desc = CmdDesc(required=[('objects', Or(ObjectsArg, EmptyArg))],
                   optional=[('level', EnumOf(_SequentialLevels))],
                   keyword=[
                       ('target', StringArg),
                       ('transparency', FloatArg),
                       ('palette', ColormapArg),
                   ],
                   url='help:user/commands/color.html#rainbow',
                   synopsis="color residues and chains sequentially")
    register('rainbow', desc, rainbow, logger=logger)
Beispiel #25
0
def register_command(command_name, logger):
    from chimerax.core.commands \
        import CmdDesc, register, BoolArg, FloatArg, ColorArg, Or, EnumOf, \
            SaveFileNameArg, NonNegativeIntArg, StringArg, EmptyArg
    from chimerax.atomic import StructuresArg, AtomsArg
    tilde_desc = CmdDesc(keyword=[('name', StringArg)],
                         synopsis='Clear hydrogen bonds')
    if command_name == "hbonds":
        desc = CmdDesc(required=[('atoms', Or(AtomsArg, EmptyArg))],
                       keyword=[('make_pseudobonds', BoolArg),
                                ('radius', FloatArg), ('color', ColorArg),
                                ('show_dist', BoolArg),
                                ('restrict',
                                 Or(EnumOf(('cross', 'both', 'any')),
                                    AtomsArg)), ('inter_submodel', BoolArg),
                                ('inter_model', BoolArg),
                                ('intra_model', BoolArg),
                                ('intra_mol', BoolArg), ('intra_res', BoolArg),
                                ('cache_DA', BoolArg), ('relax', BoolArg),
                                ('dist_slop', FloatArg),
                                ('angle_slop', FloatArg),
                                ('two_colors', BoolArg),
                                ('slop_color', ColorArg), ('reveal', BoolArg),
                                ('retain_current', BoolArg),
                                ('save_file', SaveFileNameArg),
                                ('log', BoolArg),
                                ('naming_style',
                                 EnumOf(('simple', 'command', 'serial'))),
                                ('batch', BoolArg),
                                ('dashes', NonNegativeIntArg),
                                ('salt_only', BoolArg), ('name', StringArg),
                                ('coordsets', BoolArg), ('select', BoolArg)],
                       synopsis='Find hydrogen bonds')
        register('hbonds', desc, cmd_hbonds, logger=logger)
        register('hbonds delete', tilde_desc, cmd_xhbonds, logger=logger)
    else:
        register('~hbonds', tilde_desc, cmd_xhbonds, logger=logger)
Beispiel #26
0
def register_command(logger):
    from chimerax.core.commands import CmdDesc, register, ObjectsArg, EnumOf, EmptyArg, Or, \
        create_alias
    from .show import WhatArg, TargetArg
    desc = CmdDesc(optional=[('objects', Or(ObjectsArg, EmptyArg)),
                             ('what', WhatArg)],
                   keyword=[('target', TargetArg)],
                   url='help:user/commands/show.html#hide',
                   synopsis='hide specified objects')
    register('hide', desc, hide, logger=logger)
    create_alias('~show', 'hide $*', logger=logger)
    create_alias('~display',
                 'hide $*',
                 logger=logger,
                 url="help:user/commands/show.html")
Beispiel #27
0
def register_command(logger):
    from chimerax.core.commands import CmdDesc, register, Or, EmptyArg, SurfacesArg, EnumOf, FloatArg
    from chimerax.core.commands import BoolArg, ColormapArg, ColormapRangeArg
    from chimerax.atomic import AtomsArg
    desc = CmdDesc(required=[('atoms', Or(AtomsArg, EmptyArg))],
                   keyword=[
                       ('surfaces', SurfacesArg),
                       ('his_scheme', EnumOf(['HIP', 'HIE', 'HID'])),
                       ('offset', FloatArg),
                       ('spacing', FloatArg),
                       ('padding', FloatArg),
                       ('map', BoolArg),
                       ('palette', ColormapArg),
                       ('range', ColormapRangeArg),
                       ('disp_dep', BoolArg),
                       ('dielectric', FloatArg),
                   ],
                   synopsis='Color surfaces by coulombic potential')
    register("coulombic", desc, cmd_coulombic, logger=logger)
Beispiel #28
0
def _register_viewer_subcommand(logger, viewer_sub):
    def viewer_subcommand(session, alignment_s, subcommand_text, *, _viewer_keyword=viewer_sub):
        from .alignment import Alignment
        if alignment_s is None:
            from .cmd import get_alignment_by_id
            alignments = get_alignment_by_id(session, "", multiple_okay=True)
        elif isinstance(alignment_s, Alignment):
            alignments = [alignment_s]
        else:
            alignments = alignment_s
        for alignment in alignments:
            alignment._dispatch_viewer_command(_viewer_keyword, subcommand_text)
    from .cmd import AlignmentArg
    from chimerax.core.commands import CmdDesc, register, Or, EmptyArg, RestOfLine, ListOf
    desc = CmdDesc(
        required = [('alignment_s', Or(AlignmentArg,ListOf(AlignmentArg),EmptyArg)),
            ('subcommand_text', RestOfLine)],
        synopsis = "send subcommand to viewer '%s'" %viewer_sub
    )
    register('sequence %s' % viewer_sub, desc, viewer_subcommand, logger=logger)
Beispiel #29
0
def register_mask_command(logger):
    from chimerax.core.commands import CmdDesc, register, BoolArg, IntArg, FloatArg
    from chimerax.core.commands import AxisArg, Float2Arg, Or, ModelIdArg, SurfacesArg
    from chimerax.map import MapsArg, Float1or3Arg, MapArg, ValueTypeArg
    mask_kw = [('pad', FloatArg), ('extend', IntArg), ('full_map', BoolArg),
               ('slab', Or(FloatArg, Float2Arg)), ('invert_mask', BoolArg),
               ('axis', AxisArg), ('sandwich', BoolArg),
               ('fill_overlap', BoolArg), ('model_id', ModelIdArg)]
    desc = CmdDesc(required=[('volumes', MapsArg)],
                   keyword=[('surfaces', SurfacesArg)] + mask_kw,
                   required_arguments=['surfaces'],
                   synopsis='Mask a map to a surface')
    register('volume mask', desc, mask, logger=logger)

    desc = CmdDesc(required=[('surfaces', SurfacesArg)],
                   keyword=[('on_grid', MapArg), ('spacing', Float1or3Arg),
                            ('border', FloatArg),
                            ('value_type', ValueTypeArg)] + mask_kw,
                   synopsis='Make a mask of 1 values for a surface')
    register('volume onesmask', desc, ones_mask, logger=logger)
Beispiel #30
0
def register_command(logger):
    from chimerax.core.commands import CmdDesc, register, ListOf
    from chimerax.core.commands import IntArg, BoolArg, Or, EmptyArg
    from chimerax.atomic import AtomsArg, StructuresArg
    desc = CmdDesc(required=[('structures', StructuresArg),
                             ('index_range', Or(IndexRangeArg, EmptyArg))],
                   keyword=[('hold_steady', AtomsArg),
                            ('pause_frames', IntArg), ('loop', IntArg),
                            ('bounce', BoolArg), ('compute_ss', BoolArg)],
                   synopsis='show coordinate sets')
    register('coordset', desc, coordset, logger=logger)

    desc = CmdDesc(optional=[('structures', StructuresArg)],
                   synopsis='stop playback of coordinate sets')
    register('coordset stop', desc, coordset_stop, logger=logger)

    desc = CmdDesc(required=[('structures', StructuresArg)],
                   keyword=[('hold_steady', AtomsArg),
                            ('pause_frames', IntArg), ('compute_ss', BoolArg)],
                   synopsis='show slider for coordinate sets')
    register('coordset slider', desc, coordset_slider, logger=logger)