code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
cpr = STMcmcCheckPointReader()
cpr.writeProposalAcceptances()
cpr.compareSplits(-2, -1)
| 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'
from p4.SuperTreeSupport import SuperTreeSupport
print "%20s %6s %6s %6s %6s %6s" % (' ', 'S', 'P', 'Q', 'R',... | Python |
read('inTrees.phy')
stm = STMcmc(var.trees, sampleInterval=10, beta=2.0)
stm.run(500)
tp = TreePartitions("mcmc_trees_0.nex", skip=25)
t = tp.consensus(minimumProportion=0.5)
for n in t.iterInternalsNoRoot():
n.name = "%.0f" % (100. * n.br.support)
t.draw()
| Python |
read('master.nex')
t = var.trees[0]
for n in t.iterInternalsNoRoot():
n.name = None
if 1:
one = t.dupe()
one.draw()
one.collapseNode(one.node(36))
| Python |
read('t.1111.nex')
read('t555.nex')
read('t43.nex')
read('t39.nex')
read('sets1.nex')
if 1:
t = var.trees[0]
t.setNexusSets()
t.btv()
t = var.trees[1]
t.btv()
# Out with the old nexusSets, in with the new.
var.nexusSets = None
read('sets2.nex')
t = var.trees[2]
t.setNexusSets()
t.tv()
t = var.t... | Python |
read('dB.nex')
a = var.alignments[0]
read('mbout.con')
tMB = var.trees[0]
var.trees.pop()
read('paupBootTree.nex')
tPAUP = var.trees[1]
tMB.taxNames = a.taxNames
tPAUP.taxNames = a.taxNames
tMB.tvTopologyCompare(tPAUP)
read('combinedSupportsTree.nex')
tCombined = var.trees[2]
tCombined.tv()
| Python |
# Use the mb cons tree as the master, and add supports from the paup boot tree.
# We need an ordered list of taxNames.
read('dB.nex')
a = var.alignments[0]
# a.taxNames is the list we want.
# Read in the two trees. The mrbayes con file has 2 trees; we only
# want the first one.
read('mbout.con')
tMB = var.trees[0] #... | Python |
t = func.randomTree(nTax=20)
t.eps()
t.write()
t.draw()
#os.system('sleep 1; rm random.eps')
| Python |
var.doCheckForDuplicateSequences = False
read('ds.nex')
a=var.alignments[0]
a.writePhylip(None)
b = a.subsetUsingCharSet('cs2')
b.writePhylip(None)
if 0: # Turn on to see some details
a.nexusSets.dump()
| Python |
read('d.nex')
a=var.alignments[0]
a.writePhylip()
m = func.maskFromNexusCharacterList("1 3-5 7 11", a.length, invert=0)
print m
b = a.subsetUsingMask(m)
b.writePhylip()
| Python |
var.doCheckForDuplicateSequences=False
read('d.nex')
a=var.alignments[0]
a.setCharPartition('cp1')
d = Data()
d.alignments[0].writePhylip()
oneBoot = d.bootstrap()
oneBoot.alignments[0].writePhylip()
| Python |
var.verboseRead = 0
var.doCheckForDuplicateSequences=False
read('ds.nex')
if 0:
var.nexusSets.dump()
if 1:
a=var.alignments[0]
a.writePhylip(None)
c = a.subsetUsingCharSet('cs2', inverse=True)
c.writePhylip(None)
if 1:
b = var.alignments[1]
b.writePhylip(None)
c = b.subsetUsingCharSet... | Python |
var.doCheckForDuplicateSequences = False
var.verboseRead = 0
read('ds.nex')
b = var.alignments[1]
b.writePhylip()
b.excludeCharSet('cs2')
b.writePhylip()
b.setCharPartition('cD')
d = Data()
d.dump()
b.setCharPartition(None)
d = Data()
d.dump()
| Python |
# Do an MCMC.
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=1000, checkPointInterval=... | Python |
# Simulate data
if 0:
read("d.nex")
d = Data()
if 1:
nTax = 5
taxNames = list(string.uppercase[:nTax])
a = func.newEmptyAlignment(dataType='dna', taxNames=taxNames, length=200)
d = Data([a])
if 0:
read("t.nex")
t = var.trees[0]
#t.taxNames = taxNames
if 0:
read('(B:0.5, ((D:0.4,... | Python |
# Make a consensus tree, with variations.
mySkip = 500
tp = TreePartitions("mcmc_trees_0.nex", skip=mySkip)
# read another file
tp.read("mcmc_trees_1.nex", skip=mySkip)
t = tp.consensus()
# Re-root
t.reRoot(t.node('myOutTaxon').parent)
# Collapse poorly supported nodes
toCollapse = [n for n in t.iterInternalsNoRoot... | Python |
# Make a consensus tree, uncomplicated.
tp = TreePartitions("mcmc_trees_0.nex", skip=500)
t = tp.consensus()
for n in t.iterInternalsNoRoot():
n.name = "%.0f" % (100. * n.br.support)
t.draw()
t.writeNexus('cons.nex')
| Python |
# Calculate likelihood with more than one data partition.
read("d.nex")
a = var.alignments[0]
a.setCharPartition('p1')
d = Data()
#d.dump()
read("t.nex")
t = var.trees[0]
t.data = d
pNum = 0
t.newComp(partNum=pNum, free=0, spec='empirical')
t.newRMatrix(partNum=pNum, free=1, spec='ones')
t.setNGammaCat(partNum=pNum, ... | Python |
# Calculate a likelihood.
read("d.nex")
d = Data()
read("t.nex")
t = var.trees[0]
t.data = d
t.newComp(free=1, spec='empirical')
t.newRMatrix(free=0, spec='ones')
t.setNGammaCat(nGammaCat=4)
t.newGdasrv(free=1, val=0.5)
t.setPInvar(free=1, val=0.2)
t.optLogLike()
t.writeNexus('optTree.nex')
t.model.dump()
| Python |
# Restart an MCMC.
read("d.nex")
d = Data()
m = func.unPickleMcmc(0, d)
if 0:
m.tunings.chainTemp = 0.15
m.tunings.relRate = 1.2
#m.tunings.parts[0].rMatrix = 1000.0
#m.tunings.parts[0].comp = 50.
#m.prob.comp = 0
m.run(4000)
| Python |
# Simulate very hetero data
# Below you specify the dataType, length, and relRate of each data
# partition (and symbols, if it is standard dataType). There is one
# part per alignment, in this example. You also specify the number of
# taxa in the tree
import random
import math
def randomNumbersThatSumTo1(length, m... | Python |
# Read checkPoints from an MCMC.
# Read them in ...
cpr = McmcCheckPointReader(theGlob='*')
# A table of acceptances
cpr.writeProposalAcceptances()
# Compare splits using average std deviation of split frequencies
#cpr.compareSplitsAll()
# or between only two checkpoints ...
#cpr.compareSplits(0, 1)
# How was swapp... | Python |
# Do an MCMC with more than one data partition.
read("d.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=1, spec='ones')
t.setNGammaCat(partNum=pNum, nGammaCat=4... | Python |
# Simulate data with more than one data partition.
nTax = 5
taxNames = list(string.uppercase[:nTax])
dnaAlign = func.newEmptyAlignment(dataType='dna', taxNames=taxNames, length=300)
read(r"#nexus begin sets; charpartition p1 = first:1-100, second:101-.; end;")
dnaAlign.setCharPartition('p1')
d = Data([dnaAlign])
#d.du... | Python |
read("d3_noDupes.phy")
a = var.alignments[0]
dm = a.pDistances()
t = dm.njUsingPaup()
t.draw(addToBrLen=0.0)
t.writeNexus('njTree.nex')
| Python |
nTax = 10
taxNames = list(string.uppercase[:nTax])
a = func.newEmptyAlignment(dataType='dna', taxNames=taxNames, length=96)
d = Data([a])
t = func.randomTree(taxNames=taxNames)
t.data = d
t.newComp(free=0, spec='specified', val=[0.1, 0.2, 0.3])
t.newRMatrix(free=0, spec='specified', val=[2., 3., 4., 5., 6., 7.])
t.setN... | Python |
read('d3.nex')
a = var.alignments[0]
a.checkForDuplicateSequences(removeDupes=True, makeDict=True)
a.writePhylip(fName='d3_noDupes.phy')
| Python |
read('njTree.nex')
t = var.trees[0]
t.restoreDupeTaxa()
t.draw(addToBrLen=0.0)
t.writeNexus(fName='restoredNJTree.nex')
| Python |
var.warnReadNoFile = False
instring = """CLUSTAL W (1.83) multiple sequence alignment
two ACCGTATGCTATCGTATTAGCGTATCGTATTAGGCTATT-ATGCGTAATCG---------
four ACCGTATTCT-TAGCGT-AGCTTAGCGGCATTCGGTACG-ATTCGTATTCGGTTAGCTAG
three ACCGTATCGTATCGTAT--TCGGTACGTAGTATATTACGTATGCTTATTACGTATTATCG
o... | Python |
from p4.LeafSupport import CherryRemover
#These three lines removes the cherries and saves the resulting trees in a file.
rc = CherryRemover('../input.nex')
rc.removeCherries()
rc.saveTrees('input.cherries.removed.nex')
ls = LeafSupport('input.cherries.removed.nex')
ls.defineClade(['Pholiderpeton','Proterogyrinus',... | Python |
from p4.LeafSupport import CherryRemover
#These three lines removes the cherries and saves the resulting trees in a file.
rc = CherryRemover('../input.nex')
rc.removeCherries()
rc.saveTrees('input.cherries.removed.nex')
#The file is then used to calculate the leaf stabilities
ls = LeafSupport('input.cherries.removed... | Python |
ls = LeafSupport('../input.nex')
# Defining a tax set will create a list of stabilities using only
# quartets or triplets defined by the members of set. This allows the
# user to investigate any set of taxa and there relative stabilities.
ls.defineTaxSet(['Eusthenoperon','Baphetes', 'Megalocephalus',
... | Python |
ls = LeafSupport('../input.nex')
# A group of taxa is defined like so. Defining a group will create a
# list of stabilities based on the quartets or triplets defined by the
# boundary of the group, i.e. only quartets that have one side in the
# group and the other outside the group will be included. This will
# make i... | Python |
ls = LeafSupport('../input.nex')
#Set writeCsv to true to output the resulting lists to a csv file.
ls.writeCsv = False
#The csv filename can be specified, default name is leafSupport.csv
ls.csvFilename='leafSupport.csv'
ls.leafSupport()
| Python |
ls = LeafSupport('../input.nex')
#Setting the proportion of quartets or triplets to sample, range 0.0 - 1.0
ls.useAllQuartets = False
ls.noQuartetsToUse=0.4
ls.leafSupport()
| Python |
ls = LeafSupport('../input.nex')
# A clade can be specified using the taxon names in the following
# way. This will produce a list of stabilities using only the quartets
# or triplets that are defined by the taxa in the clade.
ls.defineClade(['Pholiderpeton', 'Proterogyrinus', 'Baphetes',
'Megalocephal... | Python |
read('../../noTRuberNoGapsNoAmbiguities.nex')
d = Data()
read('../../tt.nex')
for t in var.trees:
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)
t.optLogLike()
tt = Trees... | Python |
theRunNum = 0
read('../../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=4, runNum=theRunNum... | Python |
tp = TreePartitions('mcmc_trees_0.nex', skip=1000)
t = tp.consensus()
for n in t.iterInternalsNoRoot():
n.name = '%.0f' % (100.0 * n.br.support)
t.write()
t.draw(width=30, showNodeNums=0)
| Python |
read('../../noTRuberNoGapsNoAmbiguities.nex')
d = Data()
# Unconstrained likelihood
d.calcUnconstrainedLogLikelihood2() # Installs the result in d.unconstrainedLogLikelihood
unk = d.unconstrainedLogLikelihood
n = Numbers('mcmc_sims_0', col=1, skip=1000)
print 'Original unconstrained log like is %s' % unk
print 'Here i... | Python |
read('../../tt.nex')
t = var.trees[1] # Under this model, the attract tree is the ML tree
read('../../noTRuberNoGapsNoAmbiguities.nex')
t.data = Data()
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)
t.optLogLike... | Python |
var.verboseRead = 0
read('../../noTRuberNoGapsNoAmbiguities.nex')
d = Data()
read('opt.p4_tPickle')
t = var.trees[0]
t.data = d
t.compoTestUsingSimulations(nSims=100, doIndividualSequences=0, doChiSquare=1, verbose=1)
| Python |
read('../../noTRuberNoGapsNoAmbiguities.nex')
d = Data()
read('../../tt.nex')
for t in var.trees:
t.data = d
c1 = t.newComp(free=1, spec='empirical')
c2 = t.newComp(free=1, spec='empirical')
t.newRMatrix(free=1, spec='ones')
t.setNGammaCat(nGammaCat=4)
t.newGdasrv(free=1, val=0.5)
t.setPInv... | Python |
read('../../noTRuberNoGapsNoAmbiguities.nex')
d = Data()
t = func.randomTree(taxNames=d.taxNames)
t.data = d
t.newComp(free=1, spec='empirical')
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)
t.setModelThingsRa... | Python |
tp = TreePartitions('mcmc_trees_0.nex', skip=1000)
t = tp.consensus()
for n in t.iterInternalsNoRoot():
n.name = '%.0f' % (100.0 * n.br.support)
t.write()
t.draw(width=30, showNodeNums=0)
| Python |
read('../../noTRuberNoGapsNoAmbiguities.nex')
d = Data()
# Unconstrained likelihood
d.calcUnconstrainedLogLikelihood2() # Installs the result in d.unconstrainedLogLikelihood
unc = d.unconstrainedLogLikelihood
n = Numbers('mcmc_sims_0', col=1, skip=1000)
print 'Original unconstrained log like is %s' % unc
print 'Here i... | Python |
read('../noTRuberNoGapsNoAmbiguities.nex')
a=var.alignments[0]
dm = a.compositionEuclideanDistanceMatrix()
dm.writeNexus('compDistMatrix.nex')
| Python |
read('../noTRuberNoGapsNoAmbiguities.nex')
a = var.alignments[0]
d = Data()
print 'Using all sites ...'
d.compoChiSquaredTest(verbose=1)
a.setNexusSets()
a.excludeCharSet('constant')
d = Data()
print 'After constant sites removal ...'
d.compoChiSquaredTest(verbose=1)
| Python |
read('../noTRuberNoGapsNoAmbiguities.nex')
a=var.alignments[0]
tList = []
print "Doing bootstrap ..."
for i in range(200):
b = a.bootstrap()
dm = b.compositionEuclideanDistanceMatrix()
t = dm.njUsingPaup()
tList.append(t)
tt = Trees(tList, taxNames=a.taxNames)
tp = TreePartitions(tt)
t = tp.consensus()... | Python |
read('noOpt.p4_tPickle')
t = var.trees[0]
read('d.nex')
t.data = Data()
t.optLogLike(newtAndBrentPowell=1, allBrentPowell=0, verbose=1)
t.model.dump()
t.tPickle('opt')
| Python |
var.verboseRead = 0
read('d.nex')
d = Data()
d.compoChiSquaredTest(verbose=1, skipColumnZeros=1, useConstantSites=1, skipTaxNums=None, getRows=0)
read('opt.p4_tPickle')
t = var.trees[0]
t.data = d
t.simsForModelFitTests(reps=83)
t.modelFitTests()
| Python |
read('t.nex')
t = var.trees[0]
var.alignments.append(func.newEmptyAlignment(dataType='dna', symbols=None, taxNames=t.taxNames, length=1000))
d = Data()
t.data = d
c1 = t.newComp(free=1, spec='specified', val=[0.1, 0.2, 0.3])
c2 = t.newComp(free=1, spec='specified', val=[0.4, 0.3, 0.1])
t.setModelThing(c1, node=0, clad... | Python |
taxNames = list(string.uppercase[:4])
t = func.randomTree(taxNames)
t.writeNexus('t.nex')
| Python |
var.doCheckForBlankSequences=False
read('noOpt.p4_tPickle')
t = var.trees[0]
read('d.nex')
t.data = Data()
t.optLogLike(newtAndBrentPowell=1, allBrentPowell=0, verbose=1)
t.tPickle('opt')
| Python |
var.doCheckForBlankSequences=False
var.verboseRead = 0
read('d.nex')
d = Data()
read('opt.p4_tPickle')
t = var.trees[0]
t.data = d
t.simsForModelFitTests(reps=11)
t.modelFitTests()
| Python |
read('t.nex')
t = var.trees[0]
var.alignments.append(func.newEmptyAlignment(dataType='dna', symbols=None, taxNames=t.taxNames, length=1000))
var.alignments.append(func.newEmptyAlignment(dataType='dna', symbols=None, taxNames=t.taxNames, length=700))
d = Data()
t.data = d
c1 = t.newComp(partNum=0, free=1, spec='specifi... | Python |
taxNames = list(string.uppercase[:5])
t = func.randomTree(taxNames)
t.writeNexus('t.nex')
| Python |
from p4.SuperTreeSupport import SuperTreeInputTrees
stit = SuperTreeInputTrees('balanced64.nex')
stit.writeInputTreesToFile = True
stit.outputFile = 'inputtrees.tre'
stit.noTaxaToRemove = 32
stit.noOutputTrees = 20
stit.generateInputTrees()
| Python |
from p4.SuperTreeSupport import SuperTreeInputTrees
stit = SuperTreeInputTrees('balanced64.nex', distributionTrees='FelidaeRVS.tre')
stit.writeInputTreesToFile = True
stit.outputFile = 'inputtreesBuiltDist.tre'
stit.noOutputTrees = 20
stit.generateInputTrees()
| Python |
from p4.SuperTreeSupport import SuperTreeInputTrees
stit = SuperTreeInputTrees('balanced64.nex')
stit.writeInputTreesToFile = True
stit.outputFile = 'inputtreesWithDist.tre'
stit.useTaxonDistribution = True
stit.noOutputTrees = 20
stit.generateInputTrees()
| Python |
from p4.SuperTreeSupport import SuperTreeSupport
sts = SuperTreeSupport('supertree.nex', 'input.nex')
sts.doSaveDecoratedTree = False
sts.decoratedFilename='mytree.nex'
sts.verbose=2
sts.doDrawTree=True
sts.superTreeSupport() | Python |
read("mcmc_trees_0.nex")
tt = Trees()
# Use a previously-made cons tree
var.trees = []
read("cons.nex")
t = var.trees[0]
tt.trackSplitsFromTree(t)
| Python |
read("d.nex")
a = var.alignments[0]
dm = a.logDet(correction='L94', doPInvarOfConstants=True,
pInvar=None, pInvarOfConstants=None,
missingCharacterStrategy='fudge', minCompCount=1,
nonPositiveDetStrategy='invert')
dm.writeNexus("dm.nex")
t = dm.bionj()
#t.taxNames = a.taxNames
... | Python |
read('noOpt.p4_tPickle')
t = var.trees[0]
read('d.nex')
t.data = Data()
t.optLogLike(newtAndBrentPowell=1, allBrentPowell=0, verbose=1)
t.model.dump()
t.tPickle('opt')
| Python |
var.verboseRead = 0
read('d.nex')
d = Data()
d.compoChiSquaredTest(verbose=1, skipColumnZeros=1, useConstantSites=1, skipTaxNums=None, getRows=0)
read('opt.p4_tPickle')
t = var.trees[0]
t.data = d
t.compoTestUsingSimulations(nSims=100, doIndividualSequences=0, doChiSquare=0, verbose=1)
| Python |
read('t.nex')
t = var.trees[0]
var.alignments.append(func.newEmptyAlignment(dataType='dna', symbols=None, taxNames=t.taxNames, length=300))
d = Data()
t.data = d
c1 = t.newComp(free=1, spec='specified', val=[0.0, 0.2, 0.3])
t.newRMatrix(free=1, spec='specified', val=[1.2, 6.5, 1.3, 9.8, 1.1, 1.0])
t.setPInvar(free=1, ... | Python |
taxNames = list(string.uppercase[:4])
t = func.randomTree(taxNames)
t.writeNexus('t.nex')
| Python |
# We need to have a tree with its data. The tree needs a model, and
# it needs to have model parameters optimized.
# Read in the tree and give it a name
read("myTree.nex")
t = var.trees[0]
# Read in the data and give it a name
read("myData.nex")
d = Data()
# Attach the data and a model to the tree.
t.data = d
t.new... | Python |
var.verboseRead = 0
read('d.nex')
d = Data()
print "\n" # put in a couple of spaces
ret = d.compoChiSquaredTest(verbose=1)
print """
The p4 output above is there because 'verbose' was turned on. For
programmatic usage, you would want to turn it off. In that case you
can get the numbers from the list of lists that the... | Python |
read('noOpt.p4_tPickle')
t = var.trees[0]
var.doCheckForBlankSequences = False
read('dA.nex')
read('dB.nex')
t.data = Data()
t.optLogLike(newtAndBrentPowell=1, allBrentPowell=0, verbose=1)
t.tPickle('opt')
| Python |
var.verboseRead = 0
var.doCheckForBlankSequences = False
read('dA.nex')
read('dB.nex')
d = Data()
d.compoChiSquaredTest(verbose=1, skipColumnZeros=1, useConstantSites=1, skipTaxNums=[[2], []], getRows=1)
read('opt.p4_tPickle')
t = var.trees[0]
t.data = d
t.compoTestUsingSimulations(nSims=100, doIndividualSequences=1, ... | Python |
read('t.nex')
t = var.trees[0]
var.alignments.append(func.newEmptyAlignment(dataType='dna', symbols=None, taxNames=t.taxNames, length=1000))
var.alignments.append(func.newEmptyAlignment(dataType='dna', symbols=None, taxNames=t.taxNames, length=700))
d = Data()
t.data = d
t.newComp(partNum=0, free=1, spec='specified', ... | Python |
taxNames = list(string.uppercase[:5])
t = func.randomTree(taxNames)
t.writeNexus('t.nex')
| Python |
read('sim.p4_tPickle')
t = var.trees[0]
read('d.nex')
t.data = Data()
t.optLogLike(newtAndBrentPowell=True, allBrentPowell=False)
t.model.dump()
| 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=100)
d = Data([a])
read('(B:0.5, ((D:0.4, A:0.3), C:0.5), E:0.5);')
t = var.trees[0]
t.taxNames = taxNames
t.data = d
c... | Python |
var.verboseRead = 0
var.warnReadNoFile = 0
read('data.nex')
d = Data()
d.compoSummary()
read('(A,B,C,D,E);')
t = var.trees[0]
t.data = d
c1 = t.newComp(free=1, spec='empirical')
c2 = t.newComp(free=1, spec='empirical')
# Put the c1 comp on all the nodes of the tree. Then put c2 on the
# root, over-riding c1 that is ... | Python |
var.verboseRead = 0
var.warnReadNoFile = 0
func.reseedCRandomizer(os.getpid())
taxNames = list(string.uppercase[:5])
a = func.newEmptyAlignment(dataType='dna', taxNames=taxNames, length=3000)
d = Data([a])
read('(A:0.3, B:0.3, C:0.3, D:0.3, E:0.3);')
t = var.trees[0]
t.data = d
c1 = t.newComp(free=0, spec='specified', ... | Python |
var.warnReadNoFile = 0
var.verboseRead = 0
func.reseedCRandomizer(os.getpid())
read('d.nex')
d = Data()
read('((A:0.4, B:0.4), C:0.4, D:0.4);')
t = var.trees[0]
t.data = d
print '==== Homogeneous model ========================='
t.newComp(free=1, spec='empirical')
t.newRMatrix(free=1, spec='ones')
t.setNGammaCat(nGam... | Python |
var.warnReadNoFile = 0
var.verboseRead = 0
func.reseedCRandomizer(os.getpid())
nTax = 4
taxNames = list(string.uppercase[:nTax])
a = func.newEmptyAlignment(dataType='dna', taxNames=taxNames, length=500)
d = Data([a])
read('((A:0.4, B:0.4), C:0.4, D:0.4);')
t = var.trees[0]
t.data = d
c1 = t.newComp(free=1, spec='speci... | Python |
var.verboseRead = 0
read('t.nex')
t = var.trees[0]
read('d.nex')
t.data = Data()
t.newComp(free=1, spec='empirical')
t.newRMatrix(free=1, spec='ones')
t.setPInvar(free=1, val=0.0)
t.setNGammaCat(nGammaCat=4)
t.newGdasrv(free=1, val=1.0)
t.optLogLike()
# If I wanted to save the tree (with branch lengths, of course), I ... | Python |
def pepper(self, proportion=0.1, andAmbiguities=1):
"""Pepper the alignment (self) with random gaps and ambiguities."""
import random
import math
ambigs = 'rymkswhbvdnnn'
#ambigs = 'n'
for s in self.sequences:
s.sequence = list(s.sequence)
for i in range(self.length):
... | Python |
taxNames = list(string.uppercase[:7])
t = func.randomTree(taxNames)
t.writeNexus('t.nex')
| Python |
read('../A_NavidiAlignFromYang/navidiSSRNA.nex')
a = var.alignments[0]
print '%20s %7s%7s%7s%7s%7s' % ('species', 'T', 'C', 'A', 'G', 'G + C')
for i in range(len(a.sequences)):
s = a.sequences[i]
c = a.composition([i]) # comp of an individual sequence
print '%20s ' % s.name,
for b in [3, 1, 0, 2]: ... | Python |
read('../A_NavidiAlignFromYang/navidiSSRNA.nex')
read('t.nex')
d = Data()
d.calcUnconstrainedLogLikelihood1()
u = d.unconstrainedLogLikelihood
#fResults = open('results', 'w')
fResults = sys.stdout
fResults.write('\nYang and Roberts Table 3, HKY + dG + N1\n\n')
fResults.write('tree diff kappa shape\n')
for t... | Python |
read('../A_NavidiAlignFromYang/navidiSSRNA.nex')
d = Data()
read('t.nex')
#readFile('t31.WithRates.nex')
t=var.trees[0]
t.data = d
t.newComp(free=1, spec='empirical')
t.newComp(free=1, spec='empirical')
t.newComp(free=1, spec='empirical')
t.newComp(free=1, spec='empirical')
t.newComp(free=1, spec='empirical')
t.newCom... | Python |
read('../A_NavidiAlignFromYang/navidiSSRNA.nex')
read('t.nex')
d=Data()
d.calcUnconstrainedLogLikelihood1()
u = d.unconstrainedLogLikelihood
#fResults = open('results', 'w')
fResults = sys.stdout
fResults.write('\nTable 2\n=======\n\nHKY, no rates\n\n')
fResults.write(' tree diff kapp... | Python |
var.warnReadNoFile = 0
var.verboseRead = 0
read('protein.nex')
a = var.alignments[0]
a.recodeDayhoff()
#a.writePhylip(None)
read('(((A:0.4, (B:0.4, C:0.4):0.05):0.05, D:0.4):0.1, E:0.4, F:0.4);')
t = var.trees[0]
t.data = Data()
t.newComp(free=1, spec='empirical')
t.newRMatrix(free=1, spec='ones')
t.setNGammaCat(nGamma... | Python |
# Read in the tree and the data
read('t.nex')
t = var.trees[0]
read('d.nex')
# Make a Data object and attach it to the tree.
t.data = Data()
# Define the model. This is the Juke-Cantor model with no among-site
# rate variation.
t.newComp(free=0, spec='equal')
t.newRMatrix(free=0, spec='ones')
t.setPInvar(free=0, val... | Python |
var.verboseRead = 0
read('t.nex')
t = var.trees[0]
read('d.nex')
var.alignments[0].setCharPartition('cp1')
t.data = Data()
# Model for Part 0
pNum = 0
t.newComp(partNum=pNum, free=1, spec='empirical')
t.newRMatrix(partNum=pNum, free=1, spec='ones')
t.setPInvar(partNum=pNum, free=1, val=0.1)
t.setNGammaCat(partNum=pNum... | Python |
read('t.nex')
t = var.trees[0]
a = func.newEmptyAlignment(dataType='dna', symbols=None, taxNames=t.taxNames, length=1500)
b = func.newEmptyAlignment(dataType='standard', symbols='xyz', taxNames=t.taxNames, length=1000)
read('setsForSim.nex')
a.setCharPartition('cp1')
d = Data([a,b])
t.data = d
# Model for Part 0
pNum... | Python |
read('opt.p4_tPickle')
t = var.trees[0]
print 'The rate matrix for the second partition is:'
print t.model.parts[1].rMatrices[0].val
print 'The composition of the model in the last partition is:'
print t.model.parts[2].comps[0].val
print 'The relative rate of the first partition is:'
print t.model.parts[0].relRate
... | Python |
taxNames = list(string.uppercase[:5])
t = func.randomTree(taxNames)
t.writeNexus('t.nex')
| Python |
from distutils.core import setup
from distutils.extension import Extension
setup(name="p4",
ext_modules=[
Extension("fastReducedRF", ['fastReducedRF.cpp'],
# Adjust the following to be able to find pyublas, numpy, and boost. Maybe need library_dirs as well?
include_dirs = ["/usr/lo... | Python |
import fastReducedRF
import numpy
import pyublas # not explicitly used--but makes converters available
nTax = 7
import string
tNames = list(string.uppercase[:nTax])
# Here is a supertree, the first of many.
var.warnReadNoFile = False
read("(((D, E), A), B, (C, (F, G)));")
bigT = var.trees.pop()
bigT.taxNames = tNames... | Python |
#!/usr/bin/python
# Optimized for yEd 3.7.0.2
# Author: Jinho D. Choi (choijd@colorado.edu)
import Tkinter
import tkFont
import operator
import sys
PREFIX = '\n'.join([\
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>',\
'<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/... | Python |
#!/usr/bin/python
# Optimized for yEd 3.7.0.2
# Author: Jinho D. Choi (choijd@colorado.edu)
import Tkinter
import tkFont
import operator
import sys
import re
PREFIX = '\n'.join([\
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>',\
'<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3... | Python |
#!/usr/bin/python
import sys
fin = open(sys.argv[1])
fout = open(sys.argv[2],'w')
vpos = sys.argv[3]
tree = []
pred = []
for line in fin:
l = line.split()
if not l:
rTree = []
for node in tree:
args = []
for i,arg in enumerate(node[7:]):
if arg == '_': continue
predId = pred[i]
if not tree[... | Python |
#!/usr/bin/python
#
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | Python |
#!/usr/bin/python
#
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | Python |
#!/usr/bin/env python
#
# Copyright (c) 2002, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this ... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.