Package schrodinger :: Package application :: Package desmond :: Package packages :: Module cui :: Class CommandLine
[hide private]
[frames] | no frames]

Class CommandLine

                object --+        
                         |        
 argparse._AttributeHolder --+    
                             |    
                object --+   |    
                         |   |    
argparse._ActionsContainer --+    
                             |    
       argparse.ArgumentParser --+
                                 |
                                CommandLine


Use this class to define common command line arguments such input cms
file, input trajectory, output file base name, trajectory slicing option,
and so on.

After calling L{parse_args} method, you will have those arguments parsed
properly, and you will get the L{cms.Cms} object, the L{msys.System} object,
and the trajectory object (sliced properly), automatically.

You can use the C{spec} argument to custom your command line interface.
Examples:

  1:
  spec = REQUIRE_MSYS_CMS + REQUIRE_TRJ + REQUIRE_OUT + SLICE_TRJ
  # This will give you the following:
  #   cms  - First positional argument for cms input, and when it's parsed,
  #          you will get both msys and cms models.
  #   trj  - Second positional argument for trajectory input
  #   out  - Third positional argument for output base name
  #   -slice-trj
  #        - Option for slicing trajectory

  2:
  spec = REQUIRE_CMS_ONLY + REQUIRE_TRJ + REQUIRE_OUT + SLICE_TRJ
  # Similar to the first example, but parsing the cms input file will return
  # only the cms model.

  3:
  spec = REQUIRE_CMS_ONLY + OPTIONAL_TRJ + REQUIRE_OUT + SLICE_TRJ
  # This will give you the following:
  #   cms  - First positional argument for cms input, and when it's parsed,
  #          you will get the cms models.
  #   out  - Second positional argument for output base name
  #   -trj - Option for trajectory input
  #   -slice-trj
  #        - Option for slicing trajectory

Other standard options:
  -ref-mae  Reference geometry from given .mae or .cms file. After parsing,
            the .ref_mae attribute will provide
            C{(structure.Structure, str)}, where the first element is the
            C{Structure} object of the file and the second the file's name.
            If this option is unspecified, the attribute' value will be
            C{None}.
            spec: REF_MAE
  -ref-frame
            Reference geometry from a trajectory frame. After parsing, the
            .ref_frame attribute will provide C{(traj.Frame, int)}, where
            the first element is the specified frame and the second the
            index of the frame. If this option is overridden by -ref-mae, or
            if the trajectory is not provided, the attribute's value will
            be C{None}.
            spec: REF_FRAME

Instance Methods [hide private]
 
__init__(self, spec=46, **kwarg)
x.__init__(...) initializes x; see help(type(x)) for signature
 
_parse_args_impl(self, *arg, **kwarg)
 
parse_args(self, *arg, **kwarg)

Inherited from argparse.ArgumentParser: add_subparsers, convert_arg_line_to_args, error, exit, format_help, format_usage, format_version, parse_known_args, print_help, print_usage, print_version

Inherited from argparse.ArgumentParser (private): _add_action, _check_value, _get_formatter, _get_kwargs, _get_nargs_pattern, _get_option_tuples, _get_optional_actions, _get_positional_actions, _get_value, _get_values, _match_argument, _match_arguments_partial, _parse_known_args, _parse_optional, _print_message, _read_args_from_files

Inherited from argparse._AttributeHolder: __repr__

Inherited from argparse._AttributeHolder (private): _get_args

Inherited from argparse._ActionsContainer: add_argument, add_argument_group, add_mutually_exclusive_group, get_default, register, set_defaults

Inherited from argparse._ActionsContainer (private): _add_container_actions, _check_conflict, _get_handler, _get_optional_kwargs, _get_positional_kwargs, _handle_conflict_error, _handle_conflict_resolve, _pop_action_class, _registry_get, _remove_action

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, spec=46, **kwarg)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

parse_args(self, *arg, **kwarg)

 
Overrides: argparse.ArgumentParser.parse_args