Converting Data to Strings (strings)

The strings module provides some general and some specific functions which allow to convert data into strings which can then be imported by other software tools. You can import it by typing:

>>> from lingpy.convert.strings import *

Or by typing:

>>> from lingpy.convert import strings

Most of the functions are used internally, being triggered when writing, for example, data from a ~lingpy.basic.wordlist.Wordlist object to file. They can, however, also be used directly, and especially the ~lingpy.convert.strings.write_nexus function may prove useful to get a more flexible nexus-output of wordlist data.

Functions

scorer2str(scorer)

Convert a scoring function to a string.

msa2str(msa[, wordlist, comment, _arange, merge])

Function converts an MSA object into a string.

matrix2dst(matrix[, taxa, stamp, filename, ...])

Convert matrix to dst-format.

pap2nex(taxa, paps[, missing, filename, ...])

Function converts a list of paps into nexus file format.

pap2csv(taxa, paps[, filename])

Write paps created by the Wordlist class to a csv-file.

multistate2nex(taxa, matrix[, filename, missing])

Convert the data in a given wordlist to NEXUS-format for multistate analyses in PAUP.

write_nexus(wordlist[, mode, filename, ref, ...])

Write a nexus file for phylogenetic analyses.