Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_seq_motif(self, refseq_id, residue, pos_str):
seq = self.seq_dict[refseq_id]
pos_1ix = int(pos_str)
pos_0ix = pos_1ix - 1
if seq[pos_0ix] != residue:
self.invalid_site_pos.append((refseq_id, residue, pos_str))
if seq[pos_0ix + 1] == residue:
self.off_by_one.append((refseq_id, residue, pos_str))
motif, respos = \
ProtMapper.motif_from_position_seq(seq, pos_1ix + 1,
self.motif_window)
return {'site_motif': {'motif': motif, 'respos': respos,
'off_by_one': True}}
else:
return {}
else:
# The index of the residue at the start of the window
motif, respos = ProtMapper.motif_from_position_seq(seq, pos_1ix,
self.motif_window)
return {'site_motif': {'motif': motif, 'respos': respos,
'off_by_one': False}}
pos_1ix = int(pos_str)
pos_0ix = pos_1ix - 1
if seq[pos_0ix] != residue:
self.invalid_site_pos.append((refseq_id, residue, pos_str))
if seq[pos_0ix + 1] == residue:
self.off_by_one.append((refseq_id, residue, pos_str))
motif, respos = \
ProtMapper.motif_from_position_seq(seq, pos_1ix + 1,
self.motif_window)
return {'site_motif': {'motif': motif, 'respos': respos,
'off_by_one': True}}
else:
return {}
else:
# The index of the residue at the start of the window
motif, respos = ProtMapper.motif_from_position_seq(seq, pos_1ix,
self.motif_window)
return {'site_motif': {'motif': motif, 'respos': respos,
'off_by_one': False}}