Skip to content

Instantly share code, notes, and snippets.

@armanbilge
Last active December 24, 2015 20:59
Show Gist options
  • Save armanbilge/6861858 to your computer and use it in GitHub Desktop.
Save armanbilge/6861858 to your computer and use it in GitHub Desktop.
Converts trees from Nexus format to Newick format. Depends on Dendropy.
#!/usr/bin/env python
import sys
from dendropy import TreeList
NEWICK = 'newick'
NEXUS = 'nexus'
try:
stream = sys.argv[1]
except:
stream = sys.stdin
TreeList.get_from_path(stream, NEXUS).write(sys.stdout, NEWICK)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment