Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(30)  |  Call(30)  |  Derive(0)  |  Import(0)
Write a sequence of trees to file in the given format.

        def write(trees, file, format, **kwargs):
    """Write a sequence of trees to file in the given format."""
    if isinstance(trees, BaseTree.Tree) or isinstance(trees, BaseTree.Clade):
        # Passed a single tree instead of an iterable -- that's OK
        trees = [trees]
    with File.as_handle(file, 'w+') as fp:
        n = getattr(supported_formats[format], 'write')(trees, fp, **kwargs)
    return n
        


src/p/h/phyloGenerator-HEAD/phyloGenerator.py   phyloGenerator(Download)
def unrootPhylomatic(tree):
    Phylo.write(tree, 'unrootingOutput.tre', 'newick')
    with open('unrootingOutput.tre') as f:
        treeText = f.read()
    if re.search('\)[a-zA-z_:0-9\.]*;', treeText):
def treeDistances(trees, nReps, fileName='tempStem'):
    Phylo.write(trees, fileName, 'newick')
    pipe = TerminationPipe('raxml -f r -z ' + fileName + ' -n alignCheckTemp -m GTRGAMMA', 999999)
    pipe.run()
    if not pipe.failure:
        #Starting tree
        if startingTree:
            Phylo.write(startingTree, tempStem + 'startingTree.tre', 'newick')
            options += ' -t ' + tempStem + 'startingTree.tre'
    #RAxML Flavour
        else:
            options += " -g " + tempStem + "_constraint.tre"
        Phylo.write(constraint, tempStem + "_constraint.tre", 'newick')
        if constraint.total_branch_length() > 0:
            output = ''
        f.write('   </constantSize>\n')
        if completeConstraint:
            Phylo.write(constraint, 'tempStem'+'_TREE.tre', 'newick')
            with open('tempStem'+'_TREE.tre') as tF:
                treeFormat = tF.readlines()[0]

src/c/l/CladeCompare-0.2/cladecomparelib/ancestrallrt.py   CladeCompare(Download)
    _tree.root_with_outgroup(_tree.clade[0], outgroup_branch_length=0.0)
    fulltreefname = treefname + '.full'
    Phylo.write(_tree, fulltreefname, 'newick')
    # FG is now the first clade at the base of the tree
    subtreefname = treefname + '.fg'
    Phylo.write(_tree.clade[0], subtreefname, 'newick')

src/f/a/fammer-0.2/fammerlib/cluster.py   fammer(Download)
 
    treefname = os.path.basename(seqfname) + '.xml'
    Phylo.write(tree, treefname, 'phyloxml') 
    logging.info("Wrote %s", treefname)
 

src/b/i/biopython-HEAD/Tests/test_Phylo.py   biopython(Download)
        mem_file = StringIO()
        tree = Phylo.read(StringIO('(A,B,(C,D)E)F;'), 'newick')
        Phylo.write(tree, mem_file, 'newick')
        mem_file.seek(0)
        tree2 = Phylo.read(mem_file, 'newick')
    def test_format_branch_length(self):
        """Custom format string for Newick branch length serialization."""
        tree = Phylo.read(StringIO('A:0.1;'), 'newick')
        mem_file = StringIO()
        Phylo.write(tree, mem_file, 'newick', format_branch_length='%.0e')

src/b/i/biopython-1.63/Tests/test_Phylo.py   biopython(Download)
        mem_file = StringIO()
        tree = Phylo.read(StringIO('(A,B,(C,D)E)F;'), 'newick')
        Phylo.write(tree, mem_file, 'newick')
        mem_file.seek(0)
        tree2 = Phylo.read(mem_file, 'newick')
    def test_format_branch_length(self):
        """Custom format string for Newick branch length serialization."""
        tree = Phylo.read(StringIO('A:0.1;'), 'newick')
        mem_file = StringIO()
        Phylo.write(tree, mem_file, 'newick', format_branch_length='%.0e')

src/b/i/biopython-HEAD/Tests/test_TreeConstruction.py   biopython(Download)
        trees = searcher._get_neighbors(tree)
        self.assertEqual(len(trees), 2 * (5 - 3))
        Phylo.write(trees, './TreeConstruction/neighbor_trees.tre', 'newick')
 
class ParsimonyTreeConstructorTest(unittest.TestCase):
        constructor = ParsimonyTreeConstructor(searcher, tree1)
        best_tree = constructor.build_tree(aln)
        Phylo.write(best_tree, './TreeConstruction/pars1.tre', 'newick')
        constructor.starting_tree = tree2
        best_tree = constructor.build_tree(aln)
        Phylo.write(best_tree, './TreeConstruction/pars2.tre', 'newick')
        constructor.starting_tree = None
        best_tree = constructor.build_tree(aln)
        Phylo.write(best_tree, './TreeConstruction/pars3.tre', 'newick')

src/b/i/biopython-HEAD/Tests/test_Consensus.py   biopython(Download)
        tree = Consensus.bootstrap_consensus(self.msa, 100, constructor, Consensus.majority_consensus)
        self.assertTrue(isinstance(tree, BaseTree.Tree))
        Phylo.write(tree, './TreeConstruction/bootstrap_consensus.tre', 'newick')