code
stringlengths
1
1.72M
language
stringclasses
1 value
# Copyright (c) 2009-2012, Andrew McNabb # Copyright (c) 2003-2008, Brent N. Chun import optparse import os import shlex import sys import textwrap from psshlib import version _DEFAULT_PARALLELISM = 32 _DEFAULT_TIMEOUT = 0 # "infinity" by default def common_parser(): """ Create a basic OptionParser wit...
Python
#!/usr/bin/python # Copyright (c) 2009, Andrew McNabb # Copyright (c) 2003-2008, Brent N. Chun import os import sys import shutil import tempfile import time import unittest basedir, bin = os.path.split(os.path.dirname(os.path.abspath(sys.argv[0]))) sys.path.append("%s" % basedir) if os.getenv("TEST_HOSTS") is Non...
Python
from utils import * Clean() HgUpdate21() PatchAll() Build_XCode_64() RunAll() Clean()
Python
from utils import * Clean() HgUpdate33() PatchAll() Build_VC10_64() RunAll() Clean() HgUpdate33()
Python
import fileinput import os import glob import shutil from PIL import Image import subprocess import sys import math CMakePath = r'C:\Program Files (x86)\CMake 2.8\bin\cmake.exe' VisualStudio10Path = r'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com' def SetCMakePath(path): glo...
Python
from utils import * HgUpdate33() version = raw_input("Enter version number (ex : 0003) :") Package("OpenGL-tutorial_v"+version+"_33.zip"); HgUpdate21() Package("OpenGL-tutorial_v"+version+"_21.zip"); HgUpdate33()
Python
from utils import * Clean() HgUpdate21() PatchAll() Build_VC10_64() OptimusForceIntel() RunAll() OptimusForceNVIDIA() RunAll() Clean() HgUpdate33() PatchAll() Build_VC10_64() OptimusForceNVIDIA() RunAll() Clean() HgUpdate33()
Python
theLongDescription = """P4 does Bayesian and maximum likelihood phylogenetic analyses on molecular sequences. It's specialty is that you can use heterogeneous models, where the model parameters can differ in different parts of the tree, or over different parts of the data. """ from distutils.core import setup, Extens...
Python
import sys,string,os #from utilities import fixCharsForLatex #from Node import NodeGram from DistanceMatrix import DistanceMatrix from Glitch import Glitch import func from Var import var def patristicDistanceMatrix(self): """Matrix of distances along tree path. This method sums the branch lengths between eac...
Python
from SequenceList import SequenceList from NexusSets import NexusSets from Glitch import Glitch import string,copy, os import func from Var import var if var.usePfAndNumpy: from Part import Part longMessage1 = """ You may want to do the alignment method checkForDuplicateSequences(removeDupes=True, makeDict=...
Python
import random,math import pf,func from Var import var from Glitch import Glitch import sys #localCalls = 0 def proposeRoot3(self, theProposal): """For non-biRooted trees. Root on another internal node.""" internalsNoRoot = [n for n in self.propTree.iterInternalsNoRoot()] if len(internalsNoRoot): ...
Python
"""Peter's re-write of word completion for GNU readline The foundation for this is the wonderful rlcompleter module that comes with Python. It has been re-written to make it more informative. When you import this module, it does this for you: readline.parse_and_bind("tab: complete") which makes the tab key the c...
Python
import func from Var import var class NodeBranchPart(object): def __init__(self): self.rMatrixNum = -1 self.gdasrvNum = -1 #self.bigP = None class NodeBranch(object): def __init__(self): self.len = 0.1 #self.textDrawSymbol = '-' # See var.modelSymbols for some alterna...
Python
"""Various functions.""" import os import sys import re import string import math import cStringIO import random import glob import time import types from Var import var from SequenceList import Sequence,SequenceList from Alignment import Alignment from Nexus import Nexus from Tree import Tree from Node import Node fr...
Python
from Glitch import Glitch from Tree import Tree import Nexus from Var import var import os,string,cStringIO,copy class PosteriorSamples(object): """A container for mcmc samples from files. This would be useful if you wanted to do eg posterior predictive simulations based on the posterior distribution fro...
Python
import sys import os import func from Var import var from Glitch import Glitch from subprocess import Popen,PIPE class DistanceMatrix: """A container for distances between sequences (usually). The numbers are in self.matrix, a self.dim * self.dim list of lists. There is also a self.names attribute, w...
Python
from Glitch import Glitch from TreePartitions import TreePartitions from Tree import Tree from Trees import Trees from func import read, var import sys, csv, random from math import log, factorial, floor ROOT_NODE_NAME = 'A_NAME_NOT_EASILY_FOUND_IN_A_TREE' TAXON_SEPARATOR = ':' class TreeSubsets(object): ...
Python
import string from Tree import Tree from Node import Node class Aho(object): def isTripletCompatibleWithSet(self, set, triplet): list = [] list.append(triplet) for t in set: list.append(t) return self.isListCompatible(list) def isSetCompatible(self, set): ...
Python
import os,sys,math,string import func from Glitch import Glitch from Var import var if var.usePfAndNumpy: import numpy class Numbers(object): """Simple 1-dimensional data handling. Emphasis on 'simple'. Feed this a list of floats, or the name of a file containing floats. If it is a file, lines a...
Python
import string,array import func from Var import var from Alignment import Alignment #from NexusToken import * # nextTok() et al from NexusSets import NexusSets from SequenceList import Sequence from Glitch import Glitch # Some definitions from the MadSwofMad Syst Biol Nexus format paper (MSM97). # # Punctuation: '\(\)...
Python
#import string import textwrap import types class Glitch(Exception): """A class for exceptions in p4. You can raise this with a string, or a list of strings. If its a single string, it gets wrapped. If its a list of 2 strings, the first one is output flush and unwrapped, and the second is indent...
Python
import os import func import cPickle import math import numpy import glob from Glitch import Glitch class McmcCheckPointReader(object): """Read in and display mcmc_checkPoint files. Three options-- To read in a specific checkpoint file, specify the file name by fName=whatever To read in the ...
Python
from Var import var from DistanceMatrix import DistanceMatrix from Glitch import Glitch import numpy, numpy.linalg import math,string #import func # temp import pf def logDet(self, correction='TK02', doPInvarOfConstants=True, pInvar=None, pInvarOfConstants=None, missingCharacterStrategy='fudge', minCompCount=1, nonPo...
Python
import func,pf from Var import var import math,random,copy,numpy from Glitch import Glitch import sys class Chain(object): # Import methods in other files from Chain_propose1 import proposeRoot3, proposeBrLen, proposeLocal, proposeETBR_Blaise, proposeETBR, proposePolytomy, proposeAddEdge, _getCandidateNodes...
Python
import types,string,cStringIO,sys,os from Tree import Tree from Node import Node,NodePart,NodeBranchPart from Trees import Trees from Nexus import Nexus,NexusData from Glitch import Glitch #from NexusToken import nextTok,safeNextTok,nexusSkipPastNextSemiColon import NexusToken # needed for cStrings #import NexusToken...
Python
from Glitch import Glitch import func from func import read from Var import var from Tree import Tree from Node import Node,NodeBranch import sys import random, copy import types from Numbers import Numbers import math # I suppose if there are input trees whose tax sets are equal to or subsets # of the current bigT, ...
Python
import os,string,sys,types from Var import var from Glitch import Glitch ############################################################################ # # Token generation stuff. # # safeNextTok() # checks for None, and dies # nextTok() # may return None # # Handling comments: # - Behaviour is unde...
Python
import string,os from Var import var from Glitch import Glitch """This class is used by Tree.draw(), Tree.eps(), and Tree.svg(). This week, there is no 'user-interface' for it, other than those two methods.""" class TreePicture(object): def __init__(self, theTree = None): gm = ['TreePicture.__init__()'] ...
Python
import string import pf from Glitch import Glitch from Var import var from Part import Part def _initParts(self): gm = ['Alignment._initParts()'] if len(self.parts): for p in self.parts: del(p) self.parts = [] if self.equates: eqSymb = self.equates.keys() eqSymb.sor...
Python
import string,sys,os import func from Var import var from SequenceList import Sequence from Glitch import Glitch def readOpenPhylipFile(self, flob, nTax, nChar): """Read flob to get data in phylip format. The user would generally not need to call this method directly. It is called by read() etc. """ ...
Python
from Glitch import Glitch from Tree import Tree import Nexus from Var import var import sys import os,string,cStringIO,copy class TreeFileLite(object): """Get trees in big files without reading the lot into memory. P4 Tree objects are a little obese, and large tree files will flood your RAM. This class ...
Python
import time,os,string,glob,sys,math import pf,func from Glitch import Glitch ##Ignore def _fixFileName(fName): if fName.count('.') or fName.count(' '): fName = list(fName) for i in range(len(fName)): theChar = fName[i] if theChar == '.' or theChar == ' ': fNa...
Python
import time,os,string,sys import pf,func from Var import var from Glitch import Glitch import numpy #def __del__(self, freeTree=pf.p4_freeTree, freeNode=pf.p4_freeNode): #def __del__(self, freeTree=pf.p4_freeTree, dp_freeTree = pf.dp_freeTree, mysys=sys): #def __del__(self, freeTree=pf.p4_freeTree, dp_freeTree = pf....
Python
"""Stuff to ignore when using p3rlcompleter. The p3rlcompleter is meant to be for the user, to expose the user interface. As such, it generally does not want to display all that dir() can provide. This file is one way to tell the completer to ignore. The other way is with ##Ignore comments in the method doc.""" co...
Python
versionNumberString = '0.93' # a string that can be turned into a number versionNumber = float(versionNumberString) versionNumberModifier = ' [2015-04-08]' # a string versionString = '%s%s' % (versionNumberString, versionNumberModifier) dateString = "8 April, 2015"
Python
import func from Glitch import Glitch class Constraints(object): """A container for tree topology constraints. taxNames A list of taxNames in the same order as in the data or alignment, and the same order as in other tree or trees objects. constraintTree ...
Python
from Alignment import Alignment import sys,time,os import pf,func from Var import var from Glitch import Glitch class Data: """All the alignments that you want to work with, in one place. Initialize this with one of - nothing (or None), - a list of Alignment objects, or - a single Alignment...
Python
import pf,func from Var import var import math,random,string,sys,time,copy,os,cPickle,types from Chain import Chain from Glitch import Glitch from TreePartitions import TreePartitions from Constraints import Constraints import datetime # for proposal probs fudgeFactor = {} fudgeFactor['local'] = 1.0 fudgeFactor['brLen...
Python
"""More Chain 'propose' methods.""" import func,pf from Var import var from Glitch import Glitch import math,random import numpy def proposeCompWithSlider(self, theProposal): gm = ['Chain.proposeCompWithSlider()'] mt = self.propTree.model.parts[theProposal.pNum].comps[theProposal.mtNum] dim = self.propT...
Python
# This is STMcmc, for super tree mcmc. # Started 18 March 2011, first commit 22 March 2011. import pf,func from Var import var import math,random,string,sys,time,copy,os,cPickle,types,glob import numpy as np from Glitch import Glitch from TreePartitions import TreePartitions from Constraints import Constraints from Tr...
Python
from Var import var import string,math,random,copy,os import types import func from Glitch import Glitch from Node import Node,NodeBranch if var.usePfAndNumpy: import numpy def node(self, specifier): """Get a node based on a specifier. The *specifier* can be a nodeNum, name, or node object. """ n...
Python
import os,sys,string,array,types import copy from Var import var # Don't bother with NexusToken2, cuz sets blocks are small from NexusToken import nexusSkipPastNextSemiColon,safeNextTok import func from Glitch import Glitch ## [Examples from the paup manual, ## but note the bad charpartition subset names '1' a...
Python
import time,os,sys,random,string,math from p4.Tree import Tree from Glitch import Glitch try: from Tkinter import * except ImportError: raise Glitch, "TV and BTV need Tkinter, and it does not seem to be installed." def randomColour(): # Colours are #xxyyzz, where each pair is a hex number. Colours # ...
Python
# -*- coding: latin-1 -*- import sys,os #import numpy from Glitch import Glitch ## A Ala Alanine ## R Arg Arginine ## N Asn Asparagine ## D Asp Aspartic acid ## C Cys Cy...
Python
# A couple of Trees methods. The first one works. from Glitch import Glitch def trackSplitsFromTree(self, theTree, windowSize=200, stride=100, fName='trackSplitsOut.py'): """See how slits from theTree changes over the trees in self. This looks at how some splits change over the trees in self (self is a ...
Python
import pf, sys, random, math, types import func from Var import var from Glitch import Glitch import numpy class BigQAndEig(object): # not used def __init__(self, dim, comp, rMatrix): self.dim = dim self.comp = comp self.rMatrix = rMatrix self.bigR = numpy.zeros((dim,dim), numpy.fl...
Python
import sys, csv, random from Tree import Tree from func import read from Var import var from Glitch import Glitch from p4.ReducedStrictConsensus import Intersection, TreeBuilderFromSplits class SuperTreeInputTrees(object): def __init__(self, inputTree, distributionTrees=None): """ SuperTreeInputTr...
Python
import sys,re,string,os,cStringIO import func import copy from Var import var from Glitch import Glitch from subprocess import Popen,PIPE class Sequence(object): """A container for a single molecular sequence. We have - **sequence** a string, the molecular sequence - **name** a string, the name ...
Python
from Glitch import Glitch import pf,func from Var import var class Part: def __del__(self, freePart=pf.freePart): self.alignment = None #print "Part.__del__() here. cPart=%s" % self.cPart if self.cPart: #print "Part.__del__() about to free part %i" % self.cPart f...
Python
"""Various Tree methods for defining models.""" from Data import Data from Alignment import Part from Node import NodeBranch,NodePart,NodeBranchPart from Model import Model from Glitch import Glitch import random import func,sys,math,pf from Var import var import numpy def _setData(self, theData): """Sets self.da...
Python
import re,sys,string,array,types,os import func from Var import var from Alignment import ExcludeDelete from DistanceMatrix import DistanceMatrix from SequenceList import Sequence from Glitch import Glitch import numpy as np from NexusSets import CharSet import subprocess cListPat = re.compile('(\d+)-?(.+)?') cList2Pa...
Python
import sys,os,math import func from Var import var from Tree import Tree from Glitch import Glitch class Trees(object): """A bunch of trees, all with the same taxNames. This class would be good for doing things that you might want to do with a bunch of trees rather than just a single tree. For examp...
Python
"""Maximum likelihood and Bayesian phylogenetic analysis. P4 is a phylogenetic toolkit that does Bayesian and maximum likelihood phylogenetic analyses of molecular sequences. It's specialty is that you can use heterogeneous models, where the model parameters can differ in different parts of the tree, or over differen...
Python
from Tree import Tree from Node import Node from func import read from Var import var from Glitch import Glitch import sys, csv, operator, time multiProcessing = False try: from multiprocessing import Process as Process from multiprocessing import Queue, cpu_count cpu_count = cpu_count() multiPro...
Python
import string import sys class GeneticCode: """A container for NCBI translation tables. See the ncbi translation tables, which this week are at http://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi?mode=c (If they move, poke around the 'taxonomy browser' area.) This week we have - **1** ...
Python
import sys,string,types,cStringIO,math,copy import func from Var import var from Glitch import Glitch if var.usePfAndNumpy: import numpy from Model import Model from Node import Node,NodePart,NodeBranchPart import NexusToken class Tree(object): """A phylogenetic tree. **Some instance variables** * ...
Python
class QuartetSet(object): def __init__(self): self.quartetLogic = QuartetLogic() self.quartetSet = DualIndexNoDupes() self.closureSet = DualIndexNoDupes() self.conflictingSet = DualIndexNoDupes() self.compatibleSet = DualIndexNoDupes() self.compatibl...
Python
# Matrix representation / parsimony. from Tree import Tree from Alignment import Alignment from Glitch import Glitch import func from NexusSets import CharSet from Node import Node from TreePartitions import TreePartitions def mrpSlice(self, pos, zeroBasedNumbering=True): """Pretty-print a mrp site, with no '?'...
Python
import pf from Var import var import numpy,string from Glitch import Glitch """A faster version of nextTok(), using memory allocated (once only) using numpy, and using functions written in C. The slow, pure python module is NexusToken.py. This version is about twice as fast. Which one is used is under the control o...
Python
# Make the rst file scripts.rst from p4.Glitch import Glitch start = """ ======================== Scripts for common tasks ======================== This is a cook book of reminders, suggestions, and points of departure for customization. You can copy and paste these into your own files. Or you can use the p4 recipes...
Python
def hook(self, theTree): """Write stuff during the MCMC. You get the stuff from the Mcmc (which is self) or from the current tree. Write whatever you like, however you like it. You will need to know how to get it, tho ... In this demo, I write out the gen number+1, the composition, and the ...
Python
read("../d.nex") d = Data() t = func.randomTree(taxNames=d.taxNames) t.data = d t.newComp(free=1, spec='empirical') t.newRMatrix(free=1, spec='ones') t.setNGammaCat(nGammaCat=1) t.setPInvar(free=0, val=0.0) m = Mcmc(t, nChains=1, runNum=0, sampleInterval=10, checkPointInterval=2000) # Set up a strong prior on polytomi...
Python
tp = TreePartitions("mcmc_trees_0.nex", skip=200) t = tp.consensus() # put support on node.name's, for the text drawing for n in t.iterInternalsNoRoot(): n.name = "%.0f" % (100. * n.br.support) t.draw() # Save it t.writeNexus(fName='cons.nex')
Python
read("../../K_thermus/noTRuberNoGapsNoAmbiguities.nex") d = Data() t = func.randomTree(taxNames=d.taxNames) t.data = d t.newComp(free=1, spec='empirical') t.newRMatrix(free=1, spec='ones') t.setNGammaCat(nGammaCat=4) t.newGdasrv(free=1, val=0.5) t.setPInvar(free=0, val=0.0) m = Mcmc(t, nChains=1, runNum=0, sampleInterv...
Python
# Get the test quantity, X^2, from the original data. read("../../K_thermus/noTRuberNoGapsNoAmbiguities.nex") d = Data() ret = d.compoChiSquaredTest() #print ret originalStat = ret[0][0] # Get the sim stats n = Numbers('mcmc_sims_0', col=1, skip=500) # Evaluate the tail area probability n.tailAreaProbability(original...
Python
read("d.nex") read('sets.nex') a = var.alignments[0] a.setCharPartition('p1') d = Data() t = func.randomTree(taxNames=d.taxNames) t.data = d pNum = 0 t.newComp(partNum=pNum, free=1, spec='empirical') t.newRMatrix(partNum=pNum, free=0, spec='wag') t.setNGammaCat(partNum=pNum, nGammaCat=4) t.newGdasrv(partNum=pNum, free...
Python
nTax = 5 taxNames = list(string.uppercase[:nTax]) a = func.newEmptyAlignment(dataType='protein', taxNames=taxNames, length=200) b = func.newEmptyAlignment(dataType='protein', taxNames=taxNames, length=133) d = Data([a,b]) t = func.randomTree(taxNames=taxNames) t.data = d pNum = 0 t.newComp(partNum=pNum, free=0, spec=...
Python
from p4.PosteriorSamples import PosteriorSamples read("d.nex") read('sets.nex') a = var.alignments[0] a.setCharPartition('p1') d = Data() t = func.randomTree(taxNames=d.taxNames) t.data = d pNum=0 t.newComp(partNum=pNum, free=1, spec='wag') t.newRMatrix(partNum=pNum, free=0, spec='wag') t.setNGammaCat(partNum=pNum, n...
Python
read("d.nex") d = Data() t = func.randomTree(taxNames=d.taxNames) t.data = d t.newComp(free=1, spec='empirical') t.newRMatrix(free=1, spec='ones') t.setNGammaCat(nGammaCat=4) t.newGdasrv(free=1, val=0.5) t.setPInvar(free=0, val=0.0) m = Mcmc(t, nChains=1, runNum=0, sampleInterval=100, checkPointInterval=None) m.run(200...
Python
nTax = 11 taxNames = list(string.uppercase[:nTax]) a = func.newEmptyAlignment(dataType='dna', taxNames=taxNames, length=200) d = Data([a]) t = func.randomTree(taxNames=taxNames) t.data = d t.newComp(free=0, spec='specified', val=[0.4, 0.3, 0.0]) t.newRMatrix(free=0, spec='specified', val=[2., 3., 4., 5., 6., 7.]) t.s...
Python
from p4.PosteriorSamples import PosteriorSamples read("d.nex") d = Data() t = func.randomTree(taxNames=d.taxNames) t.data = d t.newComp(free=1, spec='empirical') t.newRMatrix(free=1, spec='specified', val=[2., 3., 4., 5., 6., 7.]) t.setNGammaCat(nGammaCat=4) t.newGdasrv(free=0, val=0.5) t.setPInvar(free=0, val=0.0) f...
Python
os.system("rm -f mcmc*") read("recoded.nex") d = Data() t = func.randomTree(taxNames=d.taxNames) t.data = d t.newComp(free=1, spec='empirical') t.newRMatrix(free=1, spec='ones') t.setNGammaCat(nGammaCat=4) t.newGdasrv(free=1, val=0.5) t.setPInvar(free=1, val=0.2) m = Mcmc(t, nChains=4, runNum=0, sampleInterval=10, chec...
Python
read('protein.nex') a=var.alignments[0] a.recodeDayhoff() a.writeNexus('recoded.nex')
Python
read("../d.nex") d = Data() t = func.randomTree(taxNames=d.taxNames) t.data = d t.newComp(free=1, spec='empirical') t.newRMatrix(free=1, spec='ones') t.setNGammaCat(nGammaCat=4) t.newGdasrv(free=1, val=0.5) t.setPInvar(free=1, val=0.2) m = Mcmc(t, nChains=4, runNum=0, sampleInterval=10, checkPointInterval=2000) m.run(4...
Python
tp = TreePartitions("mcmc_trees_0.nex", skip=200) t = tp.consensus() # put support on node.name's, for the text drawing for n in t.iterInternalsNoRoot(): n.name = "%.0f" % (100. * n.br.support) t.draw() # Save it t.writeNexus(fName='cons.nex')
Python
read("mcmc_trees_0.nex") tt = Trees() var.trees = [] read('cons.nex') t = var.trees[0] tt.trackSplitsFromTree(t)
Python
theRunNum = int(var.argvAfterDoubleDash[0]) read("../d.nex") d = Data() t = func.randomTree(taxNames=d.taxNames) t.data = d t.newComp(free=1, spec='empirical') t.newRMatrix(free=1, spec='ones') t.setNGammaCat(nGammaCat=1) #t.newGdasrv(free=1, val=0.5) t.setPInvar(free=0, val=0.0) m = Mcmc(t, nChains=4, runNum=theRunNu...
Python
skip=200 tp = TreePartitions("mcmc_trees_0.nex", skip=skip) tp.read("mcmc_trees_1.nex", skip=skip) tp.dump() t = tp.consensus() # put support on node.name's, for the text drawing for n in t.iterInternalsNoRoot(): n.name = "%.0f" % (100. * n.br.support) t.draw() # Save it t.writeNexus(fName='cons.nex')
Python
read("../d.nex") d = Data() m = func.unPickleMcmc(0, d) m.run(2000) m = func.unPickleMcmc(1, d) m.run(2000) #n = Numbers('mcmc_likes_0', col=1) #n.plot()
Python
cpr = McmcCheckPointReader() cpr.writeProposalAcceptances() cpr.writeSwapMatrices() #cpr.writeProposalProbs() m = cpr.mm[0] m.tunings.dump(advice=False) cpr.compareSplits(2, 3) print "\n\nComparing all splits from all pairs of checkPoints ..." cpr.compareSplitsAll()
Python
read("../d.nex") d = Data() t = func.randomTree(taxNames=d.taxNames) t.data = d t.newComp(free=1, spec='empirical') t.newRMatrix(free=1, spec='ones') t.setNGammaCat(nGammaCat=4) t.newGdasrv(free=1, val=0.5) t.setPInvar(free=1, val=0.2) m = Mcmc(t, nChains=4, runNum=0, sampleInterval=10, checkPointInterval=2000) m.autoT...
Python
tp = TreePartitions("mcmc_trees_0.nex", skip=200) t = tp.consensus() # put support on node.name's, for the text drawing for n in t.iterInternalsNoRoot(): n.name = "%.0f" % (100. * n.br.support) t.draw() # Save it t.writeNexus(fName='cons.nex')
Python
allTaxNames = ['t0', 't1', 't2', 't3', 't4', 't5', 't6', 't7', 't8', 't9', 't10', 't11', 't12', 't13', 't14', 't15', 't16', 't17', 't18', 't19', 't20', 't21', 't22', 't23', 't24', 't25', 't26', 't27', 't28', 't29', 't30', 't31', 't32', 't33', 't34', 't35', 't36', 't37', 't38', 't39', 't40', 't41', 't42', 't43', 't44'] ...
Python
nTax = int(var.argvAfterDoubleDash[0]) nTrees = int(var.argvAfterDoubleDash[1]) #taxNames = list(string.uppercase[:20]) t = func.randomTree(nTax=nTax) #t.draw() a = func.newEmptyAlignment(dataType='dna', taxNames=t.taxNames, length=10) t.data = Data([a]) t.newComp(spec='equal') t.newRMatrix() t.setPInvar() t.setNGamma...
Python
read('paupConTree.nex') t = var.trees[0] # The only point of the data is to get a taxNames list. read('d.nex') d = Data() t.taxNames = d.taxNames t.readBipartitionsFromPaupLogFile('paupLog') # The support gets put in node.br.support, as a float from 0-1. To # see it in a drawing or write it in newick format, we mov...
Python
tp = TreePartitions('tt.nex') tp.writeSplits() # If you like this sort of thing ... t = tp.consensus() t.draw()
Python
read(""" 2 2 one ac two gt """) read('(one,two);') t = var.trees[0] t.data = Data() t.newComp() t.newRMatrix() t.setPInvar() t.calcLogLike()
Python
taxNames = list(string.uppercase[:7]) for i in range(6): t = func.randomTree(taxNames) t.name = 't%i' % (i + 1) var.trees.append(t) tt = Trees(taxNames=taxNames) dm = tt.topologyDistanceMatrix('wrf') dm.writeNexus()
Python
read('t.nex') t1 = var.trees[0] t2 = var.trees[1] # See page 532 in Felsenstein print "The 'symmetric distance' = ", t1.topologyDistance(t2, metric='sd') print "The 'weighted Robinson Foulds distance' = ", t1.topologyDistance(t2, metric='wrf') ret = t1.topologyDistance(t2, metric='bld') print "The 'branch score' = %...
Python
var.warnReadNoFile = 0 var.verboseRead = 0 read('d.nex') d = Data() taxNames = list(string.uppercase[:5]) read('((A, B), C, (D, E));') read('((D, E), B, (C, A));') read('((C, E), (B, D), A);') for i in range(len(var.trees)): var.trees[i].name = 't%i' % (i + 1) for t in var.trees: t.taxNames = taxNames t.d...
Python
var.warnReadNoFile = 0 var.verboseRead = 0 read('((D:0.4, E:0.3):0.03, B:0.5, (C:0.3, A:0.4):0.03);') taxNames = list(string.uppercase[:5]) var.alignments.append(func.newEmptyAlignment(dataType='dna', taxNames=taxNames, length=500)) d = Data() t = var.trees[0] t.data = d t.taxNames = taxNames t.newComp(partNum=0, free...
Python
read('d.nex') d = Data() for i in range(3): read('t%i.p4_tPickle' % (i + 1)) tt = Trees() tt.data = d if 1: tt.consel() else: tt.rell()
Python
var.verboseRead = 0 var.warnReadNoFile = 0 if 1: read('((A, B), C, (D, E));') read('((A, B), D, (E, C));') read('((C, A), (D, B), E);') taxNames = list(string.uppercase[:5]) theSplitTax = ['A', 'C'] else: taxNames = list(string.uppercase[:7]) for i in range(30): var.trees.append(fun...
Python
var.warnReadNoFile = 0 var.verboseRead = 0 func.reseedCRandomizer(os.getpid()) nTax = 5 taxNames = list(string.uppercase[:nTax]) a = func.newEmptyAlignment(dataType='dna', taxNames=taxNames, length=400) d = Data([a]) t = func.randomTree(taxNames=taxNames) t.data = d c1 = t.newComp(free=1, spec='specified', val=[0.1, ...
Python
import sys nTrees = 15 nSites = 400 fIn = file('siteLikes') fOut = file('siteLikes.txt', 'w') fIn.readline() # skip the first line fOut.write('Tree\t-lnL\tSite\t-lnL\n') for i in range(nTrees): for j in range(nSites): aLine = fIn.readline() if not aLine: print 'no workee! Ran out of l...
Python
from p4.MRP import mrp read('inTrees.phy') a = mrp(var.trees) a.writeNexus('mr.nex')
Python
tp = TreePartitions("mcmc_trees_0.nex", skip=500) tp.read("mcmc_trees_1.nex", skip=500) t = tp.consensus(minimumProportion=0.5) for n in t.iterInternalsNoRoot(): n.name = "%.0f" % (100. * n.br.support) t.draw() t.name = 'stMcmc' t.writeNexus('stMcmcCons.nex')
Python
n = Numbers('mcmc_likes_0', col=1) n.plot() if os.path.isfile('mcmc_prams_0'): n = Numbers('mcmc_prams_0', col=1) n.plot()
Python
read('inTrees.phy') inTrees = var.trees var.trees = [] read('stMcmcCons.nex') read('mrpMajRuleConsTree.nex') read('mrpStrictConsTree.nex') var.trees[1].name = 'mrpMajRule' var.trees[2].name = 'mrpStrict' tt = Trees(taxNames=var.trees[0].taxNames) tt.inputTreesToSuperTreeDistances(inTrees)
Python
#os.system("rm -f mcmc*") # (self, inTrees, modelName='SR2008_rf_aZ', beta=1.0, stRFCalc='purePython1', runNum=0, sampleInterval=100, checkPointInterval=None) # Choose one of these, the fastest available myCalc='purePython1' myCalc='bitarray' #myCalc='fastReducedRF' read('inTrees.phy') stm = STMcmc(var.trees, modelN...
Python