Example #1
0
    def get_predefined_predicates(self):
        codon_preds = _CodonPredicates(self.get_alphabet().get_genetic_code())

        preds = _TimeReversibleNucleotide.get_predefined_predicates(self)
        preds.update(
            {
                "indel": predicate.parse("???/---"),
                "silent": predicate.UserPredicate(codon_preds.silent),
                "replacement": predicate.UserPredicate(codon_preds.replacement),
                "omega": predicate.UserPredicate(codon_preds.replacement),
            }
        )
        return preds
Example #2
0
 def adapt_predicate(self, pred, label=None):
     if isinstance(pred, str):
         pred = predicate.parse(pred)
     elif isinstance(pred, Callable):
         pred = predicate.UserPredicate(pred)
     pred_func = pred.make_model_predicate(self)
     label = label or repr(pred)
     mask = predicate2matrix(self.get_alphabet(),
                             pred_func,
                             mask=self._instantaneous_mask)
     return (label, mask)