Esempio n. 1
0
def main():
    treefile1 = sys.argv[1]
    treefile2 = sys.argv[2]

    treelist = TreeList()
    treelist.read(file=open(treefile1, 'rU'), schema="nexus")
    treelist.read(file=open(treefile2, 'rU'), schema="nexus")

    if treecompare.symmetric_difference(treelist.__getitem__(0),
                                        treelist.__getitem__(1)) == 0:
        print "trees are identical"
    else:
        print "trees are NOT identical"
Esempio n. 2
0
def readTree(filename, quiet=False):
    if not quiet:
        print()
        print("Reading in files...")
        print()

    temp = TreeList()
    try:
        temp.read(file=open(filename, 'r'), schema="newick", preserve_underscores=True)
    except:
        print("Error with file '{}': please only use files with newick tree format".format(f))
        sys.exit()

    return temp
Esempio n. 3
0
def readTrees(filenames, namespace, quiet=False):
    if not quiet:
        print()
        print("Reading in files...")
        print()

    sample_tree_list = []
    for f in filenames:
        # temp = TreeList(taxon_namespace=namespace)
        temp = TreeList()
        try:
            temp.read(file=open(f, 'r'),
                      schema="newick",
                      preserve_underscores=True)
        except:
            print(
                "Error with file '{}': please only use files with newick tree format"
                .format(f))
            sys.exit()

        sample_tree_list.append(temp)
    return sample_tree_list
Esempio n. 4
0
#! /usr/bin/env python

from dendropy import TreeList
from sys import argv

trees = TreeList()
trees.read(path=argv[1],schema="newick")

trees.write(path=argv[2],schema="nexus")