PHYLIP

Description

Reading

Schema-Specific Keyword Arguments

PhylipReader.__init__(**kwargs)[source]
Keyword Arguments:
  • data_type (str) – When reading into a DataSet object, the type of data must be specified: “dna”, “rna”, “protein”, “restriction”, “infinite”, “standard”, or “continuous”.

  • default_state_alphabet (StateAlphabet instance) – A StateAlphabet object to be used to manage the alphabet of the characters (StandardCharacterMatrix only).

  • strict (bool) – If True, then data is given in ‘strict’ format, where first 10 characters are the taxon label and remaining characters are the sequence. Default is False: relaxed format, where taxon labels are of arbitrary length and separation of sequences are is by one or more (if multispace_delimiter is False) or two or more (if multispace_delimiter is True) spaces.

  • interleaved (bool) – If True, then data is in interleaved format. Default is False: data is non-interleaved.

  • multispace_delimiter (bool) – If True (and strict is False), then at least two spaces are required to delimit taxon label and associated sequence. Default is False: one or more spaces delimit taxon label and associated sequence.

  • underscore_to_spaces (bool) – If True, then underscores in taxon labels are converted to spaces. Default is False: underscores are not converted.

  • ignore_invalid_chars (bool) – If True then any invalid characters in sequences will be ignored. Default is False: invalid characters result in errors.

  • ignore_unrecognized_keyword_arguments (boolean, default: False) – If True, then unsupported or unrecognized keyword arguments will not result in an error. Default is False: unsupported keyword arguments will result in an error.

Supported Methods

DnaCharacterMatrix.get

(method reference)

d = dendropy.DnaCharacterMatrix.get(
        path="data.phylip",
        schema="phylip",
        label=None,
        taxon_namespace=None,
        matrix_offset=None,
        strict=False,
        interleaved=False,
        multispace_delimiter=False,
        underscore_to_spaces=False,
        ignore_invalid_chars=False,
        ignore_unrecognized_keyword_arguments=False,
        )

RnaCharacterMatrix.get

(method reference)

d = dendropy.RnaCharacterMatrix.get(
        path="data.phylip",
        schema="phylip",
        label=None,
        taxon_namespace=None,
        matrix_offset=None,
        strict=False,
        interleaved=False,
        multispace_delimiter=False,
        underscore_to_spaces=False,
        ignore_invalid_chars=False,
        ignore_unrecognized_keyword_arguments=False,
        )

ProteinCharacterMatrix.get

(method reference)

d = dendropy.ProteinCharacterMatrix.get(
        path="data.phylip",
        schema="phylip",
        label=None,
        taxon_namespace=None,
        matrix_offset=None,
        strict=False,
        interleaved=False,
        multispace_delimiter=False,
        underscore_to_spaces=False,
        ignore_invalid_chars=False,
        ignore_unrecognized_keyword_arguments=False,
        )

RestrictionSitesCharacterMatrix.get

(method reference)

d = dendropy.RestrictionSitesCharacterMatrix.get(
        path="data.phylip",
        schema="phylip",
        label=None,
        taxon_namespace=None,
        matrix_offset=None,
        strict=False,
        interleaved=False,
        multispace_delimiter=False,
        underscore_to_spaces=False,
        ignore_invalid_chars=False,
        ignore_unrecognized_keyword_arguments=False,
        )

InfiniteSitesCharacterMatrix.get

(method reference)

d = dendropy.InfiniteSitesCharacterMatrix.get(
        path="data.phylip",
        schema="phylip",
        label=None,
        taxon_namespace=None,
        matrix_offset=None,
        strict=False,
        interleaved=False,
        multispace_delimiter=False,
        underscore_to_spaces=False,
        ignore_invalid_chars=False,
        ignore_unrecognized_keyword_arguments=False,
        )

StandardCharacterMatrix.get

(method reference)

d = dendropy.StandardCharacterMatrix.get(
        path="data.phylip",
        schema="phylip",
        label=None,
        taxon_namespace=None,
        matrix_offset=None,
        strict=False,
        interleaved=False,
        multispace_delimiter=False,
        underscore_to_spaces=False,
        ignore_invalid_chars=False,
        ignore_unrecognized_keyword_arguments=False,
        default_state_alphabet=None,
        )

d = dendropy.StandardCharacterMatrix.get(
        path="data.phylip",
        schema="phylip",
        label=None,
        taxon_namespace=None,
        matrix_offset=None,
        strict=False,
        interleaved=False,
        multispace_delimiter=False,
        underscore_to_spaces=False,
        ignore_invalid_chars=False,
        ignore_unrecognized_keyword_arguments=False,
        default_state_alphabet=dendropy.new_standard_state_alphabet("0123456789"),
        )

DataSet.get

(method reference)

Note that the type of data needs to be specified using the data_type keyword argument.

d = dendropy.DataSet.get(
        path="data.phylip",
        schema="phylip",
        label=None,
        taxon_namespace=None,
        strict=False,
        interleaved=False,
        multispace_delimiter=False,
        underscore_to_spaces=False,
        ignore_invalid_chars=False,
        ignore_unrecognized_keyword_arguments=False,
        data_type="dna",
        )

d = dendropy.DataSet.get(
        path="data.phylip",
        schema="phylip",
        label=None,
        taxon_namespace=None,
        strict=False,
        interleaved=False,
        multispace_delimiter=False,
        underscore_to_spaces=False,
        ignore_invalid_chars=False,
        ignore_unrecognized_keyword_arguments=False,
        data_type="dna",
        )

d = dendropy.DataSet.get(
        path="data.phylip",
        schema="phylip",
        label=None,
        taxon_namespace=None,
        strict=False,
        interleaved=False,
        multispace_delimiter=False,
        underscore_to_spaces=False,
        ignore_invalid_chars=False,
        ignore_unrecognized_keyword_arguments=False,
        data_type="standard",
        )

d = dendropy.DataSet.get(
        path="data.phylip",
        schema="phylip",
        label=None,
        taxon_namespace=None,
        strict=False,
        interleaved=False,
        multispace_delimiter=False,
        underscore_to_spaces=False,
        ignore_invalid_chars=False,
        ignore_unrecognized_keyword_arguments=False,
        data_type="standard",
        default_state_alphabet=dendropy.new_standard_state_alphabet("01")
        )

DataSet.read

(method reference)

Note that the type of data needs to be specified using the data_type keyword argument.

d = dendropy.DataSet()
d.read(
        path="data.phylip",
        schema="phylip",
        label=None,
        taxon_namespace=None,
        strict=False,
        interleaved=False,
        multispace_delimiter=False,
        underscore_to_spaces=False,
        ignore_invalid_chars=False,
        ignore_unrecognized_keyword_arguments=False,
        data_type="dna",
        )

d = dendropy.DataSet()
d.read(
        path="data.phylip",
        schema="phylip",
        label=None,
        taxon_namespace=None,
        strict=False,
        interleaved=False,
        multispace_delimiter=False,
        underscore_to_spaces=False,
        ignore_invalid_chars=False,
        ignore_unrecognized_keyword_arguments=False,
        data_type="protein",
        )

d = dendropy.DataSet()
d.read(
        path="data.phylip",
        schema="phylip",
        label=None,
        taxon_namespace=None,
        strict=False,
        interleaved=False,
        multispace_delimiter=False,
        underscore_to_spaces=False,
        ignore_invalid_chars=False,
        ignore_unrecognized_keyword_arguments=False,
        data_type="standard",
        )

d = dendropy.DataSet()
d.read(
        path="data.phylip",
        schema="phylip",
        label=None,
        taxon_namespace=None,
        strict=False,
        interleaved=False,
        multispace_delimiter=False,
        underscore_to_spaces=False,
        ignore_invalid_chars=False,
        ignore_unrecognized_keyword_arguments=False,
        data_type="standard",
        default_state_alphabet=dendropy.new_standard_state_alphabet("abc"),
        )

Writing

Schema-Specific Keyword Arguments

PhylipWriter.__init__(**kwargs)[source]
Keyword Arguments:
  • strict (bool) – If True, use ‘strict’ format, i.e., taxon labels given in first 10 characters, followed by sequence starting at character 11. Default is False: use ‘relaxed’ format, with arbitrary-length taxon labels separated from sequences by two or more spaces.

  • spaces_to_underscores (bool) – If True, all spaces will be converted to underscores. Default is False: spaces will be preserved.

  • taxon_label_fn (function object) – If specified, then this function will be called everytime taxon label is required. It will be passed a Taxon object as an argument and should represent the string or string-like object that should serve as the label.

  • force_unique_taxon_labels (bool) – If True, then taxon labels will be modified to avoid duplicate labels. Default is False: taxon labels will not be modified.

  • suppress_missing_taxa (bool) – If True, then taxa with zero characters will not be printed Default is False: all taxa will be printed

  • ignore_unrecognized_keyword_arguments (boolean, default: False) – If True, then unsupported or unrecognized keyword arguments will not result in an error. Default is False: unsupported keyword arguments will result in an error.

Supported Methods

DnaCharacterMatrix.write

(method reference)

d.write(
        path="data.phylip",
        schema="phylip",
        strict=False,
        spaces_to_underscores=False,
        force_unique_taxon_labels=False,
        suppress_missing_taxa=False,
        ignore_unrecognized_keyword_arguments=False,
        )

DnaCharacterMatrix.as_string

(method reference)

s = d.as_string(
        schema="phylip",
        strict=False,
        spaces_to_underscores=False,
        force_unique_taxon_labels=False,
        ignore_unrecognized_keyword_arguments=False,
        )

RnaCharacterMatrix.write

(method reference)

d.write(
        path="data.phylip",
        schema="phylip",
        strict=False,
        spaces_to_underscores=False,
        force_unique_taxon_labels=False,
        suppress_missing_taxa=False,
        ignore_unrecognized_keyword_arguments=False,
        )

RnaCharacterMatrix.as_string

(method reference)

s = d.as_string(
        schema="phylip",
        strict=False,
        spaces_to_underscores=False,
        force_unique_taxon_labels=False,
        ignore_unrecognized_keyword_arguments=False,
        )

ProteinCharacterMatrix.write

(method reference)

d.write(
        path="data.phylip",
        schema="phylip",
        strict=False,
        spaces_to_underscores=False,
        force_unique_taxon_labels=False,
        suppress_missing_taxa=False,
        ignore_unrecognized_keyword_arguments=False,
        )

ProteinCharacterMatrix.as_string

(method reference)

s = d.as_string(
        schema="phylip",
        strict=False,
        spaces_to_underscores=False,
        force_unique_taxon_labels=False,
        ignore_unrecognized_keyword_arguments=False,
        )

RestrictionSitesCharacterMatrix.write

(method reference)

d.write(
        path="data.phylip",
        schema="phylip",
        strict=False,
        spaces_to_underscores=False,
        force_unique_taxon_labels=False,
        suppress_missing_taxa=False,
        ignore_unrecognized_keyword_arguments=False,
        )

RestrictionSitesCharacterMatrix.as_string

(method reference)

s = d.as_string(
        schema="phylip",
        strict=False,
        spaces_to_underscores=False,
        force_unique_taxon_labels=False,
        ignore_unrecognized_keyword_arguments=False,
        )

InfiniteSitesCharacterMatrix.write

(method reference)

d.write(
        path="data.phylip",
        schema="phylip",
        strict=False,
        spaces_to_underscores=False,
        force_unique_taxon_labels=False,
        suppress_missing_taxa=False,
        ignore_unrecognized_keyword_arguments=False,
        )

InfiniteSitesCharacterMatrix.as_string

(method reference)

s = d.as_string(
        schema="phylip",
        strict=False,
        spaces_to_underscores=False,
        force_unique_taxon_labels=False,
        ignore_unrecognized_keyword_arguments=False,
        )

StandardCharacterMatrix.write

(method reference)

d.write(
        path="data.phylip",
        schema="phylip",
        strict=False,
        spaces_to_underscores=False,
        force_unique_taxon_labels=False,
        suppress_missing_taxa=False,
        ignore_unrecognized_keyword_arguments=False,
        )

StandardCharacterMatrix.as_string

(method reference)

s = d.as_string(
        schema="phylip",
        strict=False,
        spaces_to_underscores=False,
        force_unique_taxon_labels=False,
        ignore_unrecognized_keyword_arguments=False,
        )

DataSet.write

(method reference)

d.write(
        path="data.phylip",
        schema="phylip",
        strict=False,
        spaces_to_underscores=False,
        force_unique_taxon_labels=False,
        suppress_missing_taxa=False,
        ignore_unrecognized_keyword_arguments=False,
        )

DataSet.as_string

(method reference)

s = d.as_string(
        schema="phylip",
        strict=False,
        spaces_to_underscores=False,
        force_unique_taxon_labels=False,
        ignore_unrecognized_keyword_arguments=False,
        )