Changeset 620 for mds-and-trees


Ignore:
Timestamp:
09/30/16 02:43:38 (8 years ago)
Author:
konrad
Message:

The parameters should not be case specific anymore, also added some protection against wrong values of parameters and marked the default values.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mds-and-trees/tree-genealogy.py

    r619 r620  
    418418
    419419    #TODO: better names for those parameters
    420     parser.add_argument('-t', '--time', default='GENERATIONAL', dest='time', help='values on vertical axis (BIRTHS/GENERATIONAL/REAL); '
     420    parser.add_argument('-t', '--time', default='GENERATIONAL', dest='time', help='values on vertical axis (BIRTHS/GENERATIONAL(d)/REAL); '
    421421                                                                      'BIRTHS: time measured as the number of births since the beginning; '
    422422                                                                      'GENERATIONAL: time measured as number of ancestors; '
    423423                                                                      'REAL: real time of the simulation')
    424     parser.add_argument('-b', '--balance', default='DENSITY', dest='balance', help='method of placing nodes in the tree (RANDOM/MIN/DENSITY)')
    425     parser.add_argument('-s', '--scale', default='NONE', dest='scale', help='type of timescale added to the tree (NONE/SIMPLE)')
    426     parser.add_argument('-c', '--coloring', default='IMPORTANCE', dest="coloring", help='method of coloring the tree (NONE/IMPORTANCE/TYPE)')
    427     parser.add_argument('-d', '--dots', default='TYPE', dest='dots', help='method of drawing dots (individuals) (NONE/NORMAL/TYPE)')
     424    parser.add_argument('-b', '--balance', default='DENSITY', dest='balance', help='method of placing nodes in the tree (RANDOM/MIN/DENSITY(d))')
     425    parser.add_argument('-s', '--scale', default='NONE', dest='scale', help='type of timescale added to the tree (NONE(d)/SIMPLE)')
     426    parser.add_argument('-c', '--coloring', default='IMPORTANCE', dest="coloring", help='method of coloring the tree (NONE/IMPORTANCE(d)/TYPE)')
     427    parser.add_argument('-d', '--dots', default='TYPE', dest='dots', help='method of drawing dots (individuals) (NONE/NORMAL/TYPE(d))')
    428428    parser.add_argument('-j', '--jitter', dest="jitter", action='store_true', help='draw horizontal positions of children from the normal distribution')
    429429
     
    444444    args = parser.parse_args()
    445445
    446     TIME = args.time
    447     BALANCE = args.balance
    448     DOT_STYLE = args.dots
    449     COLORING = args.coloring
     446    TIME = args.time.upper()
     447    BALANCE = args.balance.upper()
     448    DOT_STYLE = args.dots.upper()
     449    COLORING = args.coloring.upper()
     450    SCALE = args.scale.upper()
    450451    JITTER = args.jitter
     452    if not TIME in ['BIRTHS', 'GENERATIONAL', 'REAL']\
     453        or not BALANCE in ['RANDOM', 'MIN', 'DENSITY']\
     454        or not DOT_STYLE in ['NONE', 'NORMAL', 'TYPE']\
     455        or not COLORING in ['NONE', 'IMPORTANCE', 'TYPE']\
     456        or not SCALE in ['NONE', 'SIMPLE']:
     457        print("Incorrect value of one of the parameters! Closing the program.") #TODO don't be lazy, figure out which parameter is wrong...
     458        return
     459
    451460
    452461    svg_mutation_line_style += hex_to_style(args.color_mut)
     
    481490        draw_spine()
    482491
    483     draw_scale(dir, args.scale)
     492    draw_scale(dir, SCALE)
    484493
    485494    svg_file.write("</svg>")
Note: See TracChangeset for help on using the changeset viewer.