for w in wrapper.wrap(s): print w print return if __name__ == '__main__': from optparse import OptionParser parser = OptionParser(usage="usage: %prog [taxa/sites] nexus.nex") options, commands = parser.parse_args() if len(commands) != 2: print __doc__ parser.print_help() quit() command, nex = commands try: nex = NexusReader(nex) except IOError: raise IOError("Unable to read %s" % nex) if command in ('taxa', 't'): tally = tally_by_taxon(nex) elif command in ('site', 's'): tally = tally_by_site(nex) else: quit("Invalid tally command. Only 'taxa' and 'site' are valid.") print_tally(tally)
for i in sorted(tally): print("%d\t%d" % (i, tally[i])) return if __name__ == '__main__': from optparse import OptionParser parser = OptionParser(usage="usage: %prog [taxa/sites/binary] nexus.nex") options, commands = parser.parse_args() if len(commands) != 2: print(__doc__) print("Author: %s\n" % __author__) parser.print_help() quit() command, nex = commands try: nex = NexusReader(nex) except IOError: raise IOError("Unable to read %s" % nex) if command in ('taxa', 't'): print_tally(tally_by_taxon(nex)) elif command in ('site', 's'): print_tally(tally_by_site(nex)) elif command in ('binary', 'b'): print_binary(count_binary_set_size(nex)) else: quit("Invalid tally command. Only 'taxa' and 'site' are valid.")
print("%d\t%d" % (i, tally[i])) return if __name__ == '__main__': from optparse import OptionParser parser = OptionParser(usage="usage: %prog [taxa/sites/binary] nexus.nex") options, commands = parser.parse_args() if len(commands) != 2: print(__doc__) print("Author: %s\n" % __author__) parser.print_help() quit() command, nex = commands try: nex = NexusReader(nex) except IOError: raise IOError("Unable to read %s" % nex) if command in ('taxa', 't'): print_tally(tally_by_taxon(nex)) elif command in ('site', 's'): print_tally(tally_by_site(nex)) elif command in ('binary', 'b'): print_binary(count_binary_set_size(nex)) else: quit("Invalid tally command. Only 'taxa' and 'site' are valid.")