topiary.pastml#

topiary.pastml.pastml#

NOTE: This is a simplified, pure-Python implementation of the DOWNPASS algorithm used by pastml for ancestral gap reconstruction. It was derived from the pastml codebase, but does not include any of the original pastml code. That library is available at evolbioinfo/pastml. When citing topiary, please cite the original pastml paper: https://doi.org/10.1093/molbev/msz131.

topiary.pastml.pastml.get_ancestral_gaps(alignment_file, tree_file, prediction_method='DOWNPASS')#

Get ancestral gaps from an alignment and raxml output tree file. Gaps are reconstructed by parsimony using the DOWNPASS algorithm as implemented in pastml.

Parameters:
  • alignment_file (str) – phy file used to generate ancestors in RAxML

  • tree_file (str) – output tree file with labeled internal nodes

  • prediction_method (str, default="DOWNPASS") – method to reconstruct gaps.

Returns:

gap_anc_dict – dictionary keying internal node names to lists of True (gap), False (no gap), and None (gapping unclear) for each site in that ancestor.

Return type:

dict