~stk-developers/supertree-toolkit/stk_w_support

« back to all changes in this revision

Viewing changes to stk/stk

  • Committer: Jon Hill
  • Date: 2013-12-17 22:21:27 UTC
  • Revision ID: jon.hill@imperial.ac.uk-20131217222127-n0asapdbqdrwoh85
Minor bug fixes to permute trees button and a quick rearrangement of the stk functions menu

Show diffs side-by-side

added added

removed removed

Lines of Context:
337
337
    parser_cm.add_argument('-c',
338
338
            '--create_matrix',
339
339
            choices=['hennig', 'nexus'],
340
 
            help="Create a matrix of the given format for all permutable trees in the input file. Default is hennig",
 
340
            help="Create a matrix of the given format for all permutable trees in the input file.",
341
341
            required=False,
342
 
            default='hennig',
343
342
            )
344
343
    parser_cm.add_argument('-t',
345
344
            '--treefile',
346
345
            choices=['nexus','newick','tnt'],
347
 
            help="Create a tree file of the given format for all permutable trees in the input file. Default is nexus",
 
346
            help="Create a tree file of the given format for all permutable trees in the input file.",
348
347
            required=False,
349
 
            default='',
350
348
            )
351
349
    parser_cm.add_argument('-n',
352
350
            '--treename',
353
351
            default=None,
354
 
            help="Do the permutation on a single tree only. Format of the name is Sourcename_treenumber, e.g. 'Hill_2011_1'",
 
352
            help="Do the permutation on a single tree only. Format of the name is Sourcename_treenumber, e.g. 'Hill_etal_2011_1'",
355
353
            required=False,
356
354
            )
357
355
    parser_cm.set_defaults(func=permute_trees)
895
893
        msg = "***Error: failed to parse a tree in your data set.\n"+detail.msg
896
894
        print msg
897
895
        return
898
 
    except TreeParseError as detail:
899
 
        msg = "***Error: failed to parse a tree in your data set.\n"+detail.msg
900
 
        print msg
901
 
        return
902
896
    except: 
903
897
        msg = "***Error: Failed sbstituting taxa due to unknown error.\n"
904
898
        print msg
954
948
        phyml = supertree_import_export.import_old_data(input_dir,verbose=verbose) 
955
949
    except STKImportExportError as e:
956
950
        print e.msg
 
951
    except NotUniqueError as detail:
 
952
        msg = "***Error: Failed to substituting taxa.\n"+detail.msg
 
953
        print msg
 
954
        return
 
955
    except InvalidSTKData as detail:
 
956
        msg = "***Error: Failed substituting taxa.\n"+detail.msg
 
957
        print msg
 
958
        return
 
959
    except UninformativeTreeError as detail:
 
960
        msg = "***Error: Failed to substituting taxa.\n"+detail.msg
 
961
        print msg
 
962
        return
 
963
    except TreeParseError as detail:
 
964
        msg = "***Error: failed to parse a tree in your data set.\n"+detail.msg
 
965
        print msg
 
966
        return
 
967
    except: 
 
968
        msg = "***Error: Failed sbstituting taxa due to unknown error.\n"
 
969
        print msg
 
970
        traceback.print_exc()
 
971
        return 
 
972
 
957
973
    # Add an event to the history of the file
958
974
    phyml = supertree_toolkit.add_historical_event(phyml, "Data created using: "+ " ".join(sys.argv)) 
959
975
    f = open(output_file, "w")
1198
1214
            if t == name:
1199
1215
                tree_list[t] = all_trees[t]
1200
1216
        if (len(tree_list) == 0):
1201
 
            print "Error finding that name. It should be in the form 'Hill_2011_1'"
 
1217
            print "Error finding that name. It should be in the form 'Hill_2011_1' or 'Hill_etal_2011_1' Note the lower case etal."
1202
1218
            sys.exit(-1)
1203
1219
    else:
1204
1220
        # get all permutable trees