DistanceMatrix

class DistanceMatrix[source]

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, which is usually for sequence names.

bionj()[source]

Use bionj to make a neighbor-joining tree, which is returned.

The resulting tree is read in by p4, and is returned.

We interact with bionj by writing files, but care is taken that existing files are not overwritten, because new file names are made to be unique.

If the branch lengths are less than zero, they are made to be zero.

fastme()[source]

Use fastme to make a minimum-evolution tree, which is returned.

The resulting tree is read in by p4, and is returned.

We interact with fastme by writing files, but care is taken that existing files are not overwritten, because new file names are made to be unique.

If the branch lengths are less than zero, they are made to be zero.

njUsingPaup(paupPath='paup')[source]

Use paup to make a neighbor-joining tree, which is returned.

The resulting tree is read in by p4, and is returned.

We interact with paup by writing files, but care is taken that existing files are not overwritten, because new file names are made to be unique.

If this does not work well, try setting the paupPath arg.

readPhylipFile(theFileName)[source]

Read a distance matrix in phylip format.

setDim(dim)[source]
writeNexus(fName=None, writeTaxaBlock=1, append=0, digitsAfterDecimal=6)[source]

Write out self in Nexus format.

If writeTaxaBlock=1, then a Taxa block is written before the Distances block. Append, if 0, writes #NEXUS first. If 1, does not write #NEXUS.

writeNexusToOpenFile(flob, writeTaxaBlock, append, digitsAfterDecimal)[source]
writePhylip(fName=None, append=0, digitsAfterDecimal=6)[source]

Write out self in Phylip format

writePhylipToOpenFile(flob, digitsAfterDecimal)[source]