def run(args): write_output(shufflenexus(get_reader(args), args.numchars or False), args)
help="Number of Characters to Generate") options, args = parser.parse_args() try: nexusname = args[0] except IndexError: print __doc__ print "Author: %s\n" % __author__ parser.print_help() sys.exit() try: newnexus = args[1] except IndexError: newnexus = None if options.numchars != False: try: options.numchars = int(options.numchars) except ValueError: print "numchars needs to be a number!" raise nexus = NexusReader(nexusname) nexus = shufflenexus(nexus, options.numchars) if newnexus is not None: nexus.write_to_file(newnexus) print "New random nexus written to %s" % newnexus else: print nexus.write()
def test_resample_100(self): nexus_obj = shufflenexus(self.nexus_obj, 100) assert len(nexus_obj.characters) == 100 assert sorted(nexus_obj.taxalist) == ['George', 'John', 'Paul', 'Ringo']
help="Number of Characters to Generate") options, args = parser.parse_args() try: nexusname = args[0] except IndexError: print(__doc__) print("Author: %s\n" % __author__) parser.print_help() sys.exit() try: newnexus = args[1] except IndexError: newnexus = None if options.numchars != False: try: options.numchars = int(options.numchars) except ValueError: print("numchars needs to be a number!") raise nexus = NexusReader(nexusname) nexus = shufflenexus(nexus, options.numchars) if newnexus is not None: nexus.write_to_file(newnexus) print("New random nexus written to %s" % newnexus) else: print(nexus.write())
def test_output(self): nexus_obj = shufflenexus(self.nexus_obj) assert isinstance(nexus_obj, NexusWriter)