Skip to content

Commit

Permalink
check _isSaturationMutagenesis() offline
Browse files Browse the repository at this point in the history
  • Loading branch information
luponzo86 committed Feb 29, 2020
1 parent 936d083 commit 802a8ba
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions rhapsody/predict/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,21 +145,32 @@ def _isColSet(self, column):
assert self.data is not None, 'Data array not initialized.'
return self.data[column].count() != 0

def _isSaturationMutagenesis(self):
def _isSaturationMutagenesis(self, queryUniprot=False):
assert self._isColSet('SAV coords'), 'SAV list not set.'
if self.saturation_mutagenesis is None:
self.saturation_mutagenesis = False
try:
SAVs = self.getUniqueSAVcoords()
SAV_list = list(SAVs['unique SAV coords'])
acc = SAVs[0]['Uniprot ID']
acc = list(set(SAVs['Uniprot ID']))
if len(acc) != 1:
raise RuntimeError('Multiple accession numbers found')
else:
acc = acc[0]
pos = list(set(SAVs['position']))
if len(pos) == 1:
query = f'{acc} {pos[0]}'
else:
query = acc
generated_SAV_list = Uniprot.seqScanning(query)
if SAV_list == generated_SAV_list:
# generate target scanning list
if queryUniprot:
print(1)
target_SAV_list = Uniprot.seqScanning(query)
else:
print(2)
seq = ''.join(SAVs['wt. aa'][range(0, len(SAVs), 19)])
target_SAV_list = Uniprot.seqScanning(query, sequence=seq)
if SAV_list == target_SAV_list:
self.saturation_mutagenesis = True
else:
raise RuntimeError('Missing SAVs detected.')
Expand Down

0 comments on commit 802a8ba

Please sign in to comment.