示例#1
0
 def getLocalViterbiScoreAndAlignment(self, posterior_probs=False, **kw):
     # Only for pairwise.  Merge with getViterbiScoreAndAlignable above.
     # Local and POGs doesn't mix well.
     (vscore, tb) = self._getDPResult(viterbi=True, local=True, **kw)
     (state_directions, T) = self._transition_matrix
     aligned_positions = tb.asBinPosTuples(state_directions)
     seqs = self.emission_probs.pair.getSeqNamePairs()
     aligned_positions = [posn for (bin, posn) in aligned_positions]
     word_length = self.emission_probs.pair.alphabet.getMotifLen()
     align = alignment_traceback(seqs, aligned_positions, word_length)
     if posterior_probs:
         pp = self._getPosteriorProbs(tb, use_cost_function=False)
         return (vscore, align, numpy.exp(pp))
     else:
         return (vscore, align)
示例#2
0
 def getLocalViterbiScoreAndAlignment(self, posterior_probs=False, **kw):
     # Only for pairwise.  Merge with getViterbiScoreAndAlignable above.
     # Local and POGs doesn't mix well.
     (vscore, tb) = self._getDPResult(viterbi=True, local=True, **kw)
     (state_directions, T) = self._transition_matrix
     aligned_positions = tb.asBinPosTuples(state_directions)
     seqs = self.emission_probs.pair.getSeqNamePairs()
     aligned_positions = [posn for (bin, posn) in aligned_positions]
     word_length = self.emission_probs.pair.alphabet.getMotifLen()
     align = alignment_traceback(seqs, aligned_positions, word_length)
     if posterior_probs:
         pp = self._getPosteriorProbs(tb, use_cost_function=False)
         return (vscore, align, numpy.exp(pp))
     else:
         return (vscore, align)
示例#3
0
 def getAlignment(self):
     """The alignment as a standard PyCogent Alignment object"""
     seqs = self.pair_hmm.emission_probs.pair.getSeqNamePairs()
     word_length = self.pair_hmm.emission_probs.pair.alphabet.getMotifLen()
     aligned_positions = [posn for (bin, posn) in self.aligned_positions]
     return alignment_traceback(seqs, aligned_positions, word_length)
示例#4
0
 def getAlignment(self):
     """The alignment as a standard PyCogent Alignment object"""
     seqs = self.pair_hmm.emission_probs.pair.getSeqNamePairs()
     word_length = self.pair_hmm.emission_probs.pair.alphabet.getMotifLen()
     aligned_positions = [posn for (bin, posn) in self.aligned_positions]
     return alignment_traceback(seqs, aligned_positions, word_length)