From 802a8baf33b9be57d1d0e7ff4a79b2074d5c4777 Mon Sep 17 00:00:00 2001 From: luponzo86 Date: Sat, 29 Feb 2020 12:37:53 -0800 Subject: [PATCH] check _isSaturationMutagenesis() offline --- rhapsody/predict/core.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/rhapsody/predict/core.py b/rhapsody/predict/core.py index 87a2005..fb3cc97 100644 --- a/rhapsody/predict/core.py +++ b/rhapsody/predict/core.py @@ -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.')