alifedata-phyloinformatics-convert

raw JSON →
0.19.3 verified Fri May 01 auth: no python

A library for converting standardized ALife (artificial life) phylogenetic data formats (e.g., from hstrat, phylotrackpy) into formats compatible with traditional phyloinformatics software (e.g., Newick, Nexus, FASTA). Current version 0.19.3, requires Python >=3.8. Active development with monthly releases.

pip install alifedata-phyloinformatics-convert
error ModuleNotFoundError: No module named 'alifedata_phyloinformatics_convert'
cause The package was installed with hyphens in the name but Python import expects underscores.
fix
pip install alifedata-phyloinformatics-convert Then in Python: import alifedata_phyloinformatics_convert
error TypeError: convert() missing 2 required positional arguments: 'source_format' and 'target_format'
cause Code written for older version where these arguments were optional; now required as of 0.19.0.
fix
Update call to include both arguments, e.g., converter.convert(newick_str, source_format='newick', target_format='nexus')
gotcha The package name uses hyphens, but Python import requires underscores. Use pip install with hyphens, but import with underscores.
fix Install: pip install alifedata-phyloinformatics-convert Import: import alifedata_phyloinformatics_convert
breaking Version 0.19.0 changed the signature of AlifeDataConvert.convert() – the 'source_format' and 'target_format' parameters are now required (previously optional). Code that relied on defaults will break.
fix Always provide both source_format and target_format explicitly in the call to convert().
gotcha The library only supports specific format pairs (e.g., newick->nexus, newick->fasta). Check the documentation for the exact list of supported conversions before use.
fix Consult the official GitHub README for supported conversion matrix. Currently supports: newick, nexus, fasta, phylip (some combinations).

Initialize the converter and convert between formats. The source and target formats can be 'newick', 'nexus', 'fasta', etc.

from alifedata_phyloinformatics_convert import AlifeDataConvert

# Example: convert a simple Newick string to Nexus
newick_str = "(A:0.1,B:0.2):0.3;"
converter = AlifeDataConvert()
nexus = converter.convert(newick_str, source_format='newick', target_format='nexus')
print(nexus)