Exemplo n.º 1
0
def add_parser(subparsers, *args, **kwargs):
    """
    Adds subparser for this analysis to a nascent argument parser

    **Arguments:**
        :*subparsers*: argparse subparsers object to add subparser
        :*args*:       Passed to subparsers.add_parser(...)
        :*kwargs*:     Passed to subparsers.add_parser(...)
    """
    from MDclt import overridable_defaults

    subparser  = secondary.add_parser(subparsers,
      name     = "association",
      help     = "Analyzes molecular association")
    arg_groups = {ag.title:ag for ag in subparser._action_groups}

    arg_groups["input"].add_argument(
      "-log",
      type     = str,
      required = True,
      nargs    = "+",
      metavar  = ("H5_FILE", "ADDRESS"),
      action   = overridable_defaults(nargs = 2, defaults = {1: "log"}),
      help     = "H5 file and optionally address from which to load " + 
                 "simulation log (default ADDRESS: log)")
    arg_groups["input"].add_argument(
      "-coord",
      type     = str,
      required = True,
      nargs    = 2,
      metavar  = ("H5_FILE", "ADDRESS"),
      help     = "H5 file and address from which to load coordinate")

    arg_groups["action"].add_argument(
      "-bound",
      type     = float,
      required = True,
      help     = "Bound state cutoff along coordinate")
    arg_groups["action"].add_argument(
      "-unbound",
      type     = float,
      required = True,
      help     = "Unbound state cutoff along coordinate")

    arg_groups["output"].add_argument(
      "-output",
      type     = str,
      required = True,
      metavar  = "H5_FILE",
      help     = "H5 file in which to output data")

    subparser.set_defaults(analysis = command_line)
Exemplo n.º 2
0
def add_parser(tool_subparsers, **kwargs):
    """
    Adds subparser for this analysis to a nascent argument parser

    **Arguments:**
        :*tool_subparsers*: Argparse subparsers object to add subparser
        :*args*:            Passed to tool_subparsers.add_parser(...)
        :*\*\*kwargs*:      Passed to tool_subparsers.add_parser(...)

    .. todo:
        - Implement nested subparser (should be 'amber log', not just 'log')
    """
    from MDclt import overridable_defaults

    subparser  = primary.add_parser(tool_subparsers,
      name     = "log",
      help     = "Load AMBER logs")
    arg_groups = {ag.title:ag for ag in subparser._action_groups}

    arg_groups["input"].add_argument(
      "-frames_per_file",
      type     = int,
      required = False,
      help     = "Number of frames in each file; used to check if new data " +
                 "is present")
    arg_groups["input"].add_argument(
      "-start_time",
      type     = float,
      required = False,
      help     = "Time of first frame (ns) (optional)")

    arg_groups["output"].add_argument(
      "-output",
      type     = str,
      required = True,
      nargs    = "+",
      action   = overridable_defaults(nargs = 2, defaults = {1: "/log"}),
      help     = "H5 file and optionally address in which to output data " +
                 "(default address: /log)")

    subparser.set_defaults(analysis = command_line)
Exemplo n.º 3
0
def add_parser(tool_subparsers, **kwargs):
    """
    Adds subparser for this analysis to a nascent argument parser

    **Arguments:**
        :*tool_subparsers*: argparse subparsers object to add subparser
        :*args*:            Passed to tool_subparsers.add_parser(...)
        :*kwargs*:          Passed to tool_subparsers.add_parser(...)
    """
    from MDclt import overridable_defaults

    subparser  = primary.add_parser(tool_subparsers,
      name     = "raw",
      help     = "Load raw text files")
    arg_groups = {ag.title: ag for ag in subparser._action_groups}

    arg_groups["input"].add_argument(
      "-frames_per_file",
      type     = int,
      required = False,
      help     = "Number of frames in each file; used to check if new data " +
                 "is present")
    arg_groups["input"].add_argument(
      "-dimensions",
      type     = int,
      required = False,
      nargs    = "*",
      help     = "Additional dimensions in dataset; if multidimensional " +
                 "(optional)")

    arg_groups["output"].add_argument(
      "-output",
      type     = str,
      required = True,
      nargs    = "+",
      action   = overridable_defaults(nargs = 2, defaults = {1: "/dataset"}),
      help     = "H5 file and optionally address in which to output data " +
                 "(default address: /dataset)")

    subparser.set_defaults(analysis = command_line)
Exemplo n.º 4
0
def add_parser(tool_subparsers, **kwargs):
    """
    Adds subparser for this analysis to a nascent argument parser

    **Arguments:**
        :*tool_subparsers*: <argparse._SubParsersAction> to which to add
        :*\*\*kwargs*:      Passed to *subparsers*.add_parser(...)
    """
    from MDclt import h5_default_path, overridable_defaults

    tool_subparser = tool_subparsers.add_parser(
      name     = "pdist",
      help     = "Calculates probability density function along a coordinate")
    mode_subparsers = tool_subparser.add_subparsers(
      dest        = "mode",
      description = "")

    hist_subparser = secondary.add_parser(mode_subparsers,
      name = "hist",
      help = "Calculates probability density function along a coordinate " +
             "using a histogram")
    kde_subparser  = secondary.add_parser(mode_subparsers,
      name = "kde",
      help = "Calculates probability density function along a coordinate " +
             "using a kernal density estimate")

    arg_groups = {
        hist_subparser:
          {ag.title: ag for ag in hist_subparser._action_groups},
        kde_subparser:
          {ag.title: ag for ag in kde_subparser._action_groups}}

    # Input
    for mode_subparser in [hist_subparser, kde_subparser]:
        arg_groups[mode_subparser]["input"].add_argument(
          "-coord",
          type     = str,
          required = True,
          nargs    = "+",
          action   = h5_default_path(),
          metavar  = ("H5_FILE", "ADDRESS"),
          help     = "H5 file and address from which to load coordinate")

    # Action
    arg_groups[hist_subparser]["action"].add_argument(
      "-frames_per_block",
      type     = int,
      default  = 128,
      help     = "Number of frames included in each block of analysis; " +
                 "may influence results of block averaging error analysis,  " +
                 "frames_per_block is minimum potential length of block " +
                 "(default: %(default)s)")
    arg_groups[kde_subparser]["action"].add_argument(
      "-frames_per_block",
      type     = int,
      default  = 128,
      help     = "Number of frames included in each block of analysis; " + 
                 "may influence results of block averaging error analysis, " +
                 "frames_per_block is minimum potential length of block " +
                 "(default: %(default)s)")
    arg_groups[hist_subparser]["action"].add_argument(
      "-bins",
      type     = str,
      required = True,
      metavar  = "BINEXPR",
      help     = "Python expression used to generate bins")
    arg_groups[kde_subparser]["action"].add_argument(
      "-grid",
      type     = str,
      required = True,
      metavar  = "GRIDEXPR",
      help     = "Python expression used to generate grid")
    arg_groups[kde_subparser]["action"].add_argument(
      "-bandwidth",
      type     = float,
      required = True,
      help     = "Bandwidth of kernel density estimate")
    for mode_subparser in [hist_subparser, kde_subparser]:
        arg_groups[mode_subparser]["action"].add_argument(
          "-zero_point",
          type     = str,
          required = False,
          help     = "Point at which to shift PMF to 0; " + 
                     "alternatively range of points (e.g. 10-12) " + 
                     "over which to adjust average to 0 (optional)")
        arg_groups[mode_subparser]["action"].add_argument(
          "-temperature",
          type     = str,
          default  = 298.0,
          help     = "System temperature (default: %(default)s)")

    # Output
    for mode_subparser in [hist_subparser, kde_subparser]:
        arg_groups[mode_subparser]["output"].add_argument(
          "-output",
          type     = str,
          required = True,
          nargs    = "+",
          action   = overridable_defaults(nargs = 2, defaults = {1: "/pdist"}),
          metavar  = ("H5_FILE", "ADDRESS"),
          help     = "H5 file and optionally address in which to output data " +
                     "(default ADDRESS: /pdist)")

    hist_subparser.set_defaults(
      analysis = command_line(Hist_Block_Generator, Hist_Block_Accumulator))
    kde_subparser.set_defaults(
      analysis = command_line(KDE_Block_Generator,  KDE_Block_Accumulator))
Exemplo n.º 5
0
def add_parser(tool_subparsers, **kwargs):
    """
    Adds subparser for this analysis to a nascent argument parser

    **Arguments:**
        :*tool_subparsers*: <argparse._SubParsersAction> to which to add
        :*\*\*kwargs*:      Passed to *tool_subparsers*.add_parser(...)
    """
    from MDclt import h5_default_path, overridable_defaults

    tool_subparser = secondary.add_parser(tool_subparsers,
      name     = "assign",
      help     = "Assigns states")
    mode_subparsers = tool_subparser.add_subparsers(
      dest        = "mode",
      description = "")

    coord_subparser = secondary.add_parser(mode_subparsers,
      name = "from_coord",
      help = "Assigns states based on coordinates")
    assign_subparser  = secondary.add_parser(mode_subparsers,
      name = "from_assign",
      help = "Assigns states based on previous state assignments")

    arg_groups = {
        coord_subparser:
          {ag.title: ag for ag in coord_subparser._action_groups},
        assign_subparser:
          {ag.title: ag for ag in assign_subparser._action_groups}}

    # Input
    arg_groups[coord_subparser]["input"].add_argument(
      "-coord",
      type     = str,
      required = True,
      nargs    = "+",
      action   = h5_default_path(),
      metavar  = ("H5_FILE", "ADDRESS"),
      help     = "H5 file and address from which to load coordinate")
    arg_groups[assign_subparser]["input"].add_argument(
      "-assign",
      type     = str,
      required = True,
      nargs    = "+",
      action   = h5_default_path(),
      metavar  = ("H5_FILE", "ADDRESS"),
      help     = "H5 file and address from which to load state "
                 "assignments")

    # Action
    arg_groups[coord_subparser]["action"].add_argument(
      "-states",
      type     = str,
      required = True,
      nargs    = "+",
      metavar  = "NAME:{<,>}CUTOFF",
      help     = "State definitions")

    # Output
    for mode_subparser in [coord_subparser, assign_subparser]:
        arg_groups[mode_subparser]["output"].add_argument(
          "-output",
          type     = str,
          required = True,
          nargs    = "+",
          action   = overridable_defaults(nargs = 2, defaults = {1:"/"}),
          metavar  = ("H5_FILE", "ADDRESS"),
          help     = "H5 file and optionally address in which to output data " +
                     "(default address: /)")

    coord_subparser.set_defaults(analysis  = coord_command_line)
    assign_subparser.set_defaults(analysis = assign_command_line)
Exemplo n.º 6
0
def add_parser(tool_subparsers, **kwargs):
    """
    Adds subparser for this analysis to a nascent argument parser

    **Arguments:**
        :*tool_subparsers*: <argparse._SubParsersAction> to which to add
        :*\*\*kwargs*:      Passed to *tool_subparsers*.add_parser(...)
    """
    from MDclt import h5_default_path, overridable_defaults

    tool_subparser = tool_subparsers.add_parser(
      name     = "stateprobs",
      help     = "Calculates state probabilities")
    mode_subparsers = tool_subparser.add_subparsers(
      dest        = "mode",
      description = "")

    pdist_subparser = secondary.add_parser(mode_subparsers,
      name = "from_pdist",
      help = "Calculates state probabilities using the probability "
             "density function")
    assign_subparser  = secondary.add_parser(mode_subparsers,
      name = "from_assignment",
      help = "Calculates state probabilities using per-frame state " +
             "assignments")

    arg_groups = {
        pdist_subparser:
          {ag.title: ag for ag in pdist_subparser._action_groups},
        assign_subparser:
          {ag.title: ag for ag in assign_subparser._action_groups}}

    # Input
    arg_groups[pdist_subparser]["input"].add_argument(
      "-pdist",
      type     = str,
      required = True,
      nargs    = "+",
      action   = h5_default_path(),
      metavar  = ("H5_FILE", "ADDRESS"),
      help     = "H5 file and address from which to load probability "
                 "density function")
    arg_groups[assign_subparser]["input"].add_argument(
      "-assign",
      type     = str,
      required = True,
      nargs    = "+",
      action   = h5_default_path(),
      metavar  = ("H5_FILE", "ADDRESS"),
      help     = "H5 file and address from which to load state "
                 "assignments")

    # Action
    arg_groups[pdist_subparser]["action"].add_argument(
      "-states",
      type     = str,
      nargs    = "+",
      metavar  = "NAME:{<,>}CUTOFF",
      help     = "State definitions")

    # Output
    for mode_subparser in [pdist_subparser, assign_subparser]:
        arg_groups[mode_subparser]["output"].add_argument(
          "-output",
          type     = str,
          required = True,
          nargs    = "+",
          action   = overridable_defaults(nargs = 2, defaults = {1: "/"}),
          metavar  = ("H5_FILE", "ADDRESS"),
          help     = "H5 file and optionally address in which to output data " +
                     "(default address: /)")

    pdist_subparser.set_defaults(analysis  = command_line(PDist_Analyzer))
    assign_subparser.set_defaults(analysis = command_line(Assign_Analyzer))