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) – AStateAlphabet
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 isFalse
: relaxed format, where taxon labels are of arbitrary length and separation of sequences are is by one or more (ifmultispace_delimiter
isFalse
) or two or more (ifmultispace_delimiter
isTrue
) spaces.interleaved (bool) – If
True
, then data is in interleaved format. Default isFalse
: data is non-interleaved.multispace_delimiter (bool) – If
True
(andstrict
isFalse
), then at least two spaces are required to delimit taxon label and associated sequence. Default isFalse
: 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 isFalse
: underscores are not converted.ignore_invalid_chars (bool) – If
True
then any invalid characters in sequences will be ignored. Default isFalse
: invalid characters result in errors.ignore_unrecognized_keyword_arguments (boolean, default:
False
) – IfTrue
, then unsupported or unrecognized keyword arguments will not result in an error. Default isFalse
: unsupported keyword arguments will result in an error.
Supported Methods¶
DnaCharacterMatrix.get
¶
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
¶
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
¶
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
¶
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
¶
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
¶
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
¶
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
¶
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 isFalse
: 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 isFalse
: 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 isFalse
: taxon labels will not be modified.suppress_missing_taxa (bool) – If
True
, then taxa with zero characters will not be printed Default isFalse
: all taxa will be printedignore_unrecognized_keyword_arguments (boolean, default:
False
) – IfTrue
, then unsupported or unrecognized keyword arguments will not result in an error. Default isFalse
: unsupported keyword arguments will result in an error.
Supported Methods¶
DnaCharacterMatrix.write
¶
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
¶
s = d.as_string(
schema="phylip",
strict=False,
spaces_to_underscores=False,
force_unique_taxon_labels=False,
ignore_unrecognized_keyword_arguments=False,
)
RnaCharacterMatrix.write
¶
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
¶
s = d.as_string(
schema="phylip",
strict=False,
spaces_to_underscores=False,
force_unique_taxon_labels=False,
ignore_unrecognized_keyword_arguments=False,
)
ProteinCharacterMatrix.write
¶
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
¶
s = d.as_string(
schema="phylip",
strict=False,
spaces_to_underscores=False,
force_unique_taxon_labels=False,
ignore_unrecognized_keyword_arguments=False,
)
RestrictionSitesCharacterMatrix.write
¶
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
¶
s = d.as_string(
schema="phylip",
strict=False,
spaces_to_underscores=False,
force_unique_taxon_labels=False,
ignore_unrecognized_keyword_arguments=False,
)
InfiniteSitesCharacterMatrix.write
¶
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
¶
s = d.as_string(
schema="phylip",
strict=False,
spaces_to_underscores=False,
force_unique_taxon_labels=False,
ignore_unrecognized_keyword_arguments=False,
)
StandardCharacterMatrix.write
¶
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
¶
s = d.as_string(
schema="phylip",
strict=False,
spaces_to_underscores=False,
force_unique_taxon_labels=False,
ignore_unrecognized_keyword_arguments=False,
)
DataSet.write
¶
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
¶
s = d.as_string(
schema="phylip",
strict=False,
spaces_to_underscores=False,
force_unique_taxon_labels=False,
ignore_unrecognized_keyword_arguments=False,
)