Exemple #1
0
 def get_residue(self, seq):
     """Get the residue in ``seq`` that is at this alignment position,
        or None if a gap is present."""
     aln = self.__aln
     if not isinstance(seq, alnsequence.Sequence):
         raise TypeError("Expected an alignment 'Sequence' object for seq")
     if seq.aln != aln:
         raise ValueError("seq must be a sequence in the same alignment")
     ialn = _modeller.mod_alignment_ialn_get(aln.modpt)
     ires = _modeller.mod_int2_get(ialn, self.__indx, seq._num)
     if ires == 0:
         return None
     else:
         return seq.residues[ires-1]
Exemple #2
0
 def get_residue(self, seq):
     """Get the residue in C{seq} that is at this profile position, or None
        if a gap is present."""
     prf = self.__prf
     if not isinstance(seq, Sequence):
         raise TypeError("Expected a profile 'Sequence' object for seq")
     if seq._prf != prf:
         raise ValueError("seq must be a sequence in the same profile")
     sprofile = _modeller.mod_profile_sprofile_get(prf.modpt)
     irestyp = _modeller.mod_int2_get(sprofile, self.__indx, seq._num)
     if irestyp == 21:  # 21 = gap
         return None
     else:
         return Residue(prf, 0, irestyp)
 def _getfunc(self, indx):
     indarray = self.__getfunc(self.__mtp)
     inds = [_modeller.mod_int2_get(indarray, i, indx) \
             for i in range(self.__natm)]
     ats = self.__mdl.atoms
     return [ats[i - 1] for i in inds]
 def get_position(self):
     """Get the position in the alignment of this residue"""
     invaln = _modeller.mod_alignment_invaln_get(self.mdl.aln.modpt)
     num = _modeller.mod_int2_get(invaln, self._num, self.mdl._num)
     return self.mdl.aln.positions[num - 1]