def mol_seq(self, elem): """Create molecular sequence object.""" is_aligned = elem.get("is_aligned") if is_aligned is not None: is_aligned = _str2bool(is_aligned) return PX.MolSeq(elem.text.strip(), is_aligned=is_aligned)
def mol_seq(self, elem): is_aligned = elem.get('is_aligned') if is_aligned is not None: is_aligned = _str2bool(is_aligned) return PX.MolSeq(elem.text.strip(), is_aligned=is_aligned)
calculator = DistanceCalculator('identity') dm = calculator.get_distance(aln) print(dm) constructor = DistanceTreeConstructor(calculator, 'nj') tree = constructor.build_tree(aln) print(tree) scorer = ParsimonyScorer() searcher = NNITreeSearcher(scorer) constructor = ParsimonyTreeConstructor(searcher, tree) pars_tree = constructor.build_tree(aln) egfr_phy = pars_tree.as_phyloxml() print(pars_tree) print(egfr_phy) print(list(pars_tree.find_elements('Inner3'))) for clade in egfr_phy.get_terminals(): key = clade.name accession = PhyloXML.Accession(key, 'NCBI') mol_seq = PhyloXML.MolSeq(lookup[key], is_aligned=True) sequence = PhyloXML.Sequence(type='aa', accession=accession, mol_seq=mol_seq) clade.sequences.append(sequence) Phylo.write(egfr_phy, 'egfr-family-annotated.xml', 'phyloxml')