

def __getitem__(self, seq):
    'return nlmsaID,NLMSASequence,offset for a given seq'
    if (not hasattr(seq, 'annotationType')):
        try:
            return self._cache[seq.pathForward]
        except AttributeError:
            raise KeyError('key must be a sequence interval!')
        except KeyError:
            pass
    seqID = self.getSeqID(seq)
    try:
        (nlmsaID, nsID, offset) = self.seqIDdict[seqID]
    except KeyError:
        raise KeyError('seq not found in this alignment')
    v = (nlmsaID, self.seqlist[nsID], offset)
    if (not hasattr(seq, 'annotationType')):
        self._cache[seq.pathForward] = _NLMSASeqDict_ValueWrapper(*v)
    return v

dataset/ETHPy150Open cjlee112/pygr/pygr/nlmsa_utils.py NLMSASeqDict.__getitem__/original