wwpdb.apps.seqmodule 0.27.1__tar.gz → 0.27.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/PKG-INFO +1 -1
  2. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/__init__.py +1 -1
  3. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/io/BlastPlusReader.py +3 -0
  4. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/io/FetchSeqInfoUtils.py +85 -47
  5. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/io/PdbxIoUtils.py +4 -0
  6. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/update/UpdatePolymerEntityPartitions.py +1 -1
  7. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/util/FetchReferenceSequenceUtils.py +27 -29
  8. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/util/LocalBlastSearchUtils.py +8 -8
  9. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/util/SequenceReferenceData.py +3 -0
  10. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/webapp/SeqModWebApp_v2.py +6 -0
  11. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb.apps.seqmodule.egg-info/PKG-INFO +1 -1
  12. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/README.md +0 -0
  13. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/setup.cfg +0 -0
  14. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/setup.py +0 -0
  15. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/__init__.py +0 -0
  16. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/__init__.py +0 -0
  17. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/align/AlignmentBackEndEditingTools.py +0 -0
  18. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/align/AlignmentDepictionTools.py +0 -0
  19. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/align/AlignmentExport.py +0 -0
  20. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/align/AlignmentFrontEndUIEditor.py +0 -0
  21. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/align/AlignmentStatistics.py +0 -0
  22. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/align/AlignmentStatisticsTests.py +0 -0
  23. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/align/AlignmentToolUtils.py +0 -0
  24. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/align/AlignmentTools.py +0 -0
  25. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/align/__init__.py +0 -0
  26. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/control/DataImporter.py +0 -0
  27. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/control/SequenceDataAssembleExample.py +0 -0
  28. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/control/SequenceDataAssembleTests.py +0 -0
  29. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/control/SequenceDataAssemble_v2.py +0 -0
  30. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/control/SequenceDataPrepTests.py +0 -0
  31. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/control/SummaryViewDepiction.py +0 -0
  32. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/control/SummaryViewTests.py +0 -0
  33. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/control/SummaryView_v2.py +0 -0
  34. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/control/__init__.py +0 -0
  35. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/io/AlignmentDataStore.py +0 -0
  36. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/io/ModelSequenceUtils.py +0 -0
  37. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/io/ModelSequenceUtilsTests.py +0 -0
  38. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/io/SequenceDataExportTests.py +0 -0
  39. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/io/SequenceDataExport_v2.py +0 -0
  40. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/io/SequenceDataStore.py +0 -0
  41. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/io/SequenceDataStoreTests.py +0 -0
  42. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/io/SequenceEditStore.py +0 -0
  43. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/io/SequenceEditStoreTests.py +0 -0
  44. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/io/TaxonomyDbUtils.py +0 -0
  45. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/io/TaxonomyUtils.py +0 -0
  46. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/io/TaxonomyUtilsTests.py +0 -0
  47. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/io/__init__.py +0 -0
  48. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/io/testAuto.py +0 -0
  49. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/link/PolymerLinkageDepict.py +0 -0
  50. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/link/__init__.py +0 -0
  51. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/update/UpdatePolymerEntityReference_v2.py +0 -0
  52. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/update/UpdatePolymerEntitySourceDetails.py +0 -0
  53. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/update/__init__.py +0 -0
  54. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/util/Autodict.py +0 -0
  55. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/util/GetSameSeqAnnotationWithTaxIdOnly.py +0 -0
  56. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/util/MultiProcLimit.py +0 -0
  57. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/util/SearchEntityPolySeqs.py +0 -0
  58. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/util/SeqReferenceSearchUtils.py +0 -0
  59. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/util/SequenceAssign.py +0 -0
  60. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/util/SequenceExamples.py +0 -0
  61. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/util/SequenceFeatureDepict.py +0 -0
  62. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/util/SequenceLabel.py +0 -0
  63. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/util/UpdateSequenceDataStoreUtils.py +0 -0
  64. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/util/__init__.py +0 -0
  65. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/view3d/ModelViewer3D.py +0 -0
  66. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/view3d/__init__.py +0 -0
  67. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/webapp/SeqModWebRequest.py +0 -0
  68. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb/apps/seqmodule/webapp/__init__.py +0 -0
  69. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb.apps.seqmodule.egg-info/SOURCES.txt +0 -0
  70. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb.apps.seqmodule.egg-info/dependency_links.txt +0 -0
  71. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb.apps.seqmodule.egg-info/not-zip-safe +0 -0
  72. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb.apps.seqmodule.egg-info/requires.txt +0 -0
  73. {wwpdb.apps.seqmodule-0.27.1 → wwpdb_apps_seqmodule-0.27.3}/wwpdb.apps.seqmodule.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wwpdb.apps.seqmodule
3
- Version: 0.27.1
3
+ Version: 0.27.3
4
4
  Summary: wwPDB sequence module
5
5
  Home-page: https://github.com/wwPDB/py-wwpdb_apps_seqmodule
6
6
  Author: Ezra Peisach
@@ -2,4 +2,4 @@ __docformat__ = "restructuredtext en"
2
2
  __author__ = "Ezra Peisach"
3
3
  __email__ = "ezra.peisach@rcsb.org"
4
4
  __license__ = "Apache 2.0"
5
- __version__ = "0.27.1"
5
+ __version__ = "0.27.3"
@@ -111,6 +111,9 @@ class BlastPlusReader(object):
111
111
  description = ""
112
112
  length = ""
113
113
  # _code = ""
114
+ dbName = ""
115
+ dbCode = ""
116
+ isoForm = ""
114
117
  for node in nodelist:
115
118
  if node.nodeType != node.ELEMENT_NODE:
116
119
  continue
@@ -21,6 +21,7 @@
21
21
  # 29-Sep-2022 zf Added input 'begin' & 'end' values checking from idTupleList in fetchUniProt() method.
22
22
  # 11-Nov-2022 zf Create FetchSeqInfoUtils class with fetchUniProt(), fetchNcbiGi(), fetchNcbiSummary(), and getRefInfo() methods.
23
23
  # getRefInfo() method is moved from FetchReferenceSequenceUtils.__getRefInfo() method.
24
+ # 2-Jun-2024 zf Added persistent objects self.__resultDicts & self.__multiResultDicts. Fixed the bug related to missing start & end sequence numbers.
24
25
  ##
25
26
  """
26
27
  Utility methods to retrieve information from NCBI & Uniprot databases
@@ -54,6 +55,8 @@ class FetchSeqInfoUtils(object):
54
55
  if not self.__srd:
55
56
  self.__srd = SequenceReferenceData(self.__verbose, self.__lfh)
56
57
  #
58
+ self.__resultDicts = {}
59
+ self.__multiResultDicts = {}
57
60
 
58
61
  def getRefInfo(self, dbName, dbAccession, dbIsoform, start, end, addMissingKeyFlag=True):
59
62
  """Fetch sequence data from Uniprot or GeneBank database.
@@ -115,54 +118,72 @@ class FetchSeqInfoUtils(object):
115
118
  """
116
119
  if idTupleList is None:
117
120
  idTupleList = []
121
+ #
118
122
  d = {}
119
123
  if not idTupleList:
120
124
  return d
121
125
  #
122
126
  idCodeList = []
127
+ foundCache = False
123
128
  for idTuple in idTupleList:
129
+ if idTuple[0] in self.__resultDicts:
130
+ foundCache = True
131
+ continue
132
+ #
124
133
  if idTuple[0] not in idCodeList:
125
134
  idCodeList.append(idTuple[0])
126
135
  #
127
136
  #
128
- if not idCodeList:
137
+ if (not foundCache) and (not idCodeList):
129
138
  return d
130
139
  #
131
- fobj = FetchUnpXml(verbose=self.__verbose, log=self.__lfh)
132
- ok = fobj.fetchList(idCodeList)
133
- if filePath is not None:
134
- fobj.writeUnpXml(filePath)
140
+ self.__fetchUniProtXmlFile(idCodeList, filePath)
135
141
  #
136
- if ok:
137
- resultDicts = fobj.getResult()
138
- multiResultDicts = fobj.getMultipleResultDict()
139
- # filter any redundant annotations --
142
+ # filter any redundant annotations --
143
+ #
144
+ for idTuple in idTupleList:
145
+ if idTuple[0] not in self.__resultDicts:
146
+ continue
140
147
  #
141
- for idTuple in idTupleList:
142
- if idTuple[0] not in resultDicts:
143
- continue
148
+ vd = self.__resultDicts[idTuple[0]]
149
+ seqLength = 0
150
+ if ("sequence" in vd) and vd["sequence"] and (len(vd["sequence"]) > 1):
151
+ seqLength = len(vd["sequence"])
152
+ #
153
+ if (idTuple[0] in self.__multiResultDicts) and self.__multiResultDicts[idTuple[0]]:
154
+ try:
155
+ idTuple1 = int(idTuple[1])
156
+ except: # noqa: E722 pylint: disable=bare-except
157
+ idTuple1 = 0
158
+ #
159
+ try:
160
+ idTuple2 = int(idTuple[2])
161
+ except: # noqa: E722 pylint: disable=bare-except
162
+ idTuple2 = 0
144
163
  #
145
- vd = resultDicts[idTuple[0]]
164
+ if ((idTuple1 == 0) or (idTuple2 == 0)) and (seqLength > 1):
165
+ idTuple1 = 1
166
+ idTuple2 = seqLength
146
167
  #
147
- if (idTuple[0] in multiResultDicts) and multiResultDicts[idTuple[0]]:
148
- found = False
168
+ found = False
169
+ if (idTuple1 > 0) and (idTuple2 > 0) and (idTuple1 <= idTuple2):
149
170
  diff = -1
150
- for retD in multiResultDicts[idTuple[0]]:
151
- if ("begin" not in retD) or ("end" not in retD) or (idTuple[1] and (idTuple[1] < retD["begin"])) or \
152
- (idTuple[2] and (idTuple[2] > retD["end"])):
171
+ for retD in self.__multiResultDicts[idTuple[0]]:
172
+ if ("begin" not in retD) or ("end" not in retD) or (idTuple1 and (idTuple1 < retD["begin"])) or \
173
+ (idTuple2 and (idTuple2 > retD["end"])):
153
174
  continue
154
175
  #
155
176
  if diff == -1:
156
177
  found = True
157
178
  vd = retD
158
179
  try:
159
- diff = (int(idTuple[1]) - int(retD["begin"])) + (int(retD["end"]) - int(idTuple[2]))
180
+ diff = (int(idTuple1) - int(retD["begin"])) + (int(retD["end"]) - int(idTuple2))
160
181
  except: # noqa: E722 pylint: disable=bare-except
161
182
  pass
162
183
  #
163
184
  else:
164
185
  try:
165
- diff1 = (int(idTuple[1]) - int(retD["begin"])) + (int(retD["end"]) - int(idTuple[2]))
186
+ diff1 = (int(idTuple1) - int(retD["begin"])) + (int(retD["end"]) - int(idTuple2))
166
187
  if diff1 < diff:
167
188
  diff = diff1
168
189
  vd = retD
@@ -172,40 +193,40 @@ class FetchSeqInfoUtils(object):
172
193
  #
173
194
  #
174
195
  #
175
- if (not found) and ("all" in multiResultDicts[idTuple[0]][-1]) and (multiResultDicts[idTuple[0]][-1]["all"] == "yes"):
176
- vd = multiResultDicts[idTuple[0]][-1]
177
- #
178
196
  #
179
- for k in vd.keys():
180
- if k in ["ec", "comments", "synonyms"]:
181
- v = vd[k]
182
- oL = []
183
- tL = v.split(",")
184
- for it in tL:
185
- sV = str(it).strip()
186
- if k == "ec":
187
- sVL = sV.split(".")
188
- oL1 = []
189
- for s1 in sVL:
190
- if str(s1).startswith("n"):
191
- oL1.append("-")
192
- else:
193
- oL1.append(s1)
194
- #
197
+ if (not found) and ("all" in self.__multiResultDicts[idTuple[0]][-1]) and (self.__multiResultDicts[idTuple[0]][-1]["all"] == "yes"):
198
+ vd = self.__multiResultDicts[idTuple[0]][-1]
199
+ #
200
+ #
201
+ for k in vd.keys():
202
+ if k in ["ec", "comments", "synonyms"]:
203
+ v = vd[k]
204
+ oL = []
205
+ tL = v.split(",")
206
+ for it in tL:
207
+ sV = str(it).strip()
208
+ if k == "ec":
209
+ sVL = sV.split(".")
210
+ oL1 = []
211
+ for s1 in sVL:
212
+ if str(s1).startswith("n"):
213
+ oL1.append("-")
214
+ else:
215
+ oL1.append(s1)
195
216
  #
196
- sV = ".".join(oL1)
197
- #
198
- if sV in oL:
199
- continue
200
- else:
201
- oL.append(sV)
202
217
  #
218
+ sV = ".".join(oL1)
219
+ #
220
+ if sV in oL:
221
+ continue
222
+ else:
223
+ oL.append(sV)
203
224
  #
204
- vd[k] = ",".join(oL)
205
225
  #
226
+ vd[k] = ",".join(oL)
206
227
  #
207
- d[idTuple] = vd
208
228
  #
229
+ d[idTuple] = vd
209
230
  #
210
231
  return d
211
232
 
@@ -255,3 +276,20 @@ class FetchSeqInfoUtils(object):
255
276
  #
256
277
  #
257
278
  return myD
279
+
280
+ def __fetchUniProtXmlFile(self, idCodeList=None, filePath=None):
281
+ """ Fetch Uniprot Xml File
282
+ """
283
+ # Handles empty list as well
284
+ if not idCodeList:
285
+ return
286
+ #
287
+ fobj = FetchUnpXml(verbose=self.__verbose, log=self.__lfh)
288
+ ok = fobj.fetchList(idCodeList)
289
+ if filePath is not None:
290
+ fobj.writeUnpXml(filePath)
291
+ #
292
+ if ok:
293
+ self.__resultDicts.update(fobj.getResult())
294
+ self.__multiResultDicts.update(fobj.getMultipleResultDict())
295
+ #
@@ -1304,6 +1304,8 @@ class ModelFileIo(object):
1304
1304
  def getEncapsulatedCoordinates(self):
1305
1305
  """_pdbx_original_pdb_coordinates.coord_section"""
1306
1306
  try:
1307
+ row = [""] # Keep pylint happy.
1308
+ encapCoordTable = [""] # For pylint
1307
1309
  if self.__currentContainer.exists("pdbx_original_pdb_coordinates"):
1308
1310
  encapCoordTable = self.__currentContainer.getObj("pdbx_original_pdb_coordinates")
1309
1311
  elif self.__currentContainer.exists("ndb_original_pdb_coordinates"):
@@ -1616,11 +1618,13 @@ class ModelFileIo(object):
1616
1618
  #
1617
1619
  i3L = colNames.index("label_seq_id")
1618
1620
  #
1621
+ i4 = 0 # For pylint - should never happen
1619
1622
  if "pdbx_PDB_model_num" in colNames:
1620
1623
  i4 = colNames.index("pdbx_PDB_model_num")
1621
1624
  elif "ndb_model" in colNames:
1622
1625
  i4 = colNames.index("ndb_model")
1623
1626
  #
1627
+ i8 = 0 # Should never happen - keep pylint happy
1624
1628
  if "pdbx_PDB_ins_code" in colNames:
1625
1629
  i8 = colNames.index("pdbx_PDB_ins_code")
1626
1630
  elif "ndb_ins_code" in colNames:
@@ -375,7 +375,6 @@ class UpdatePolymerEntityPartitions(object):
375
375
  dbIsoform = dbAccession
376
376
  dbAcc = tL[0]
377
377
  #
378
- fetchUtil.reset()
379
378
  fetchErr, refFeatureDict, _refSeqList = fetchUtil.fetchReferenceSequence("UNP", dbAcc, dbIsoform, polyTypeCode="AA",
380
379
  refSeqBeg=dbSeqBegin, refSeqEnd=dbSeqEnd)
381
380
  #
@@ -599,6 +598,7 @@ class UpdatePolymerEntityPartitions(object):
599
598
  #
600
599
  partIdList = self.__sds.getPartIds(seqId0, dataType="sequence", seqType="auth")
601
600
 
601
+ lastPart = "" # Keep pylint happy
602
602
  for partId in partIdList:
603
603
  vL = self.__sds.getVersionIds(seqId0, partId=partId, altId=1, dataType="sequence", seqType="auth")
604
604
  if len(vL) > 0:
@@ -6,7 +6,7 @@
6
6
  # 3-Oct-2022 zf update fetchReferenceSequenceWithSeqMatch() methods for better handling author provided reference sequence cases.
7
7
  # add runSeqAlignment() & __toList() methods
8
8
  # 11-Nov-2022 zf move __getRefInfo() method to FetchSeqInfoUtils class.
9
- # 6-Jan-2024 zf add reset() method
9
+ # 2-Jun-2024 zf add persistent object self.__fetchSeqUtil.
10
10
  ##
11
11
  """
12
12
  Methods to get reference sequence data from reference database based database name and identifier.
@@ -40,27 +40,22 @@ class FetchReferenceSequenceUtils(object):
40
40
  self.__accCode = ""
41
41
  self.__refInfoD = {}
42
42
  #
43
- self.reset()
44
-
45
- def reset(self):
46
- self.__accCode = ""
47
- self.__refInfoD = {}
43
+ self.__fetchSeqUtil = FetchSeqInfoUtils(siteId=self.__siteId, seqReferenceData=self.__srd, verbose=self.__verbose, log=self.__lfh)
48
44
 
49
45
  def fetchReferenceSequence(self, dbName, dbAccession, dbIsoform, polyTypeCode="AA", refSeqBeg=None, refSeqEnd=None):
50
- """return error message, sequence feature dictionary, sequence list"""
51
- if not self.__refInfoD:
52
- try:
53
- start = int(str(refSeqBeg))
54
- except: # noqa: E722 pylint: disable=bare-except
55
- start = 0
56
- #
57
- try:
58
- end = int(str(refSeqEnd))
59
- except: # noqa: E722 pylint: disable=bare-except
60
- end = 0
61
- #
62
- fetchSeqUtil = FetchSeqInfoUtils(siteId=self.__siteId, seqReferenceData=self.__srd, verbose=self.__verbose, log=self.__lfh)
63
- self.__accCode, self.__refInfoD = fetchSeqUtil.getRefInfo(dbName, dbAccession, dbIsoform, start, end)
46
+ """return error message, sequence feature dictionary, sequence list
47
+ """
48
+ try:
49
+ start = int(str(refSeqBeg))
50
+ except: # noqa: E722 pylint: disable=bare-except
51
+ start = 0
52
+ #
53
+ try:
54
+ end = int(str(refSeqEnd))
55
+ except: # noqa: E722 pylint: disable=bare-except
56
+ end = 0
57
+ #
58
+ self.__accCode, self.__refInfoD = self.__fetchSeqUtil.getRefInfo(dbName, dbAccession, dbIsoform, start, end)
64
59
  #
65
60
  if (not self.__refInfoD) or ("sequence" not in self.__refInfoD):
66
61
  error = "Fetch reference sequence [ dbName=" + dbName + ", Accession=" + self.__accCode + "] failed."
@@ -137,12 +132,11 @@ class FetchReferenceSequenceUtils(object):
137
132
  dbAccession = tL[0]
138
133
  #
139
134
  #
140
- fetchSeqUtil = FetchSeqInfoUtils(siteId=self.__siteId, seqReferenceData=self.__srd, verbose=self.__verbose, log=self.__lfh)
141
- self.__accCode, self.__refInfoD = fetchSeqUtil.getRefInfo(dbName, dbAccession, dbIsoform, 0, 0)
135
+ self.__accCode, self.__refInfoD = self.__fetchSeqUtil.getRefInfo(dbName, dbAccession, dbIsoform, 0, 0)
142
136
  #
143
137
  if (not self.__refInfoD) or ("sequence" not in self.__refInfoD) or (not self.__refInfoD["sequence"]):
144
138
  if dbCode:
145
- self.__accCode, self.__refInfoD = fetchSeqUtil.getRefInfo(dbName, dbCode, "", 0, 0)
139
+ self.__accCode, self.__refInfoD = self.__fetchSeqUtil.getRefInfo(dbName, dbCode, "", 0, 0)
146
140
  if (not self.__refInfoD) or ("sequence" not in self.__refInfoD) or (not self.__refInfoD["sequence"]):
147
141
  return False, {}
148
142
  #
@@ -171,17 +165,16 @@ class FetchReferenceSequenceUtils(object):
171
165
  #
172
166
  #
173
167
  #
174
- autoMatchStatus, alignInfoD = self.runSeqAlignment(self.__refInfoD["sequence"], authSeq, seqNumBeg, mutationList, mutationMap)
168
+ autoMatchStatus, skipBlastSearch, alignInfoD = self.runSeqAlignment(self.__refInfoD["sequence"], authSeq, seqNumBeg, mutationList, mutationMap)
175
169
  if alignInfoD:
176
170
  # Check Taxonomy ID information
177
171
  if ("taxonomy_id" in self.__refInfoD) and (self.__refInfoD["taxonomy_id"]) and taxId and (self.__refInfoD["taxonomy_id"] != taxId):
178
172
  autoMatchStatus = False
179
173
  #
180
- self.__lfh.write("autoMatchStatus=%r alignInfoD=%d\n" % (autoMatchStatus, len(alignInfoD)))
181
174
  self.__refInfoD.update(alignInfoD)
182
- return autoMatchStatus, self.__refInfoD
175
+ return autoMatchStatus, skipBlastSearch, self.__refInfoD
183
176
  else:
184
- return False, {}
177
+ return False, False, {}
185
178
  #
186
179
 
187
180
  def runSeqAlignment(self, refSeq, authSeq, seqNumBeg, mutationList, mutationMap):
@@ -307,9 +300,14 @@ class FetchReferenceSequenceUtils(object):
307
300
  retD["sort_order"] = "1"
308
301
  #
309
302
  if (identity + mutation) == len(authSeqList):
310
- return True, retD
303
+ # Add for DAOTHER-9536
304
+ if gaps == 0:
305
+ return True, True, retD
306
+ else:
307
+ return False, True, retD
308
+ #
311
309
  else:
312
- return False, retD
310
+ return False, False, retD
313
311
  #
314
312
 
315
313
  def __getReferenceList(self, sequence, polyTypeCode, refSeqBeg, refSeqEnd, reverseOrder):
@@ -355,15 +355,15 @@ class LocalBlastSearchUtils(object):
355
355
  #
356
356
  #
357
357
  #
358
- autoMatchStatus, authHitList = self.__fetchAuthProvidedRefSequence(searchSequence, seqNumBeg, seqNumEnd, str(partNum), taxId, mutationList,
359
- len(self.__entityD["PART_LIST"]))
358
+ autoMatchStatus, skipBlastSearch, authHitList = self.__fetchAuthProvidedRefSequence(searchSequence, seqNumBeg, seqNumEnd, str(partNum), \
359
+ taxId, mutationList, len(self.__entityD["PART_LIST"]))
360
360
  if not autoMatchStatus:
361
361
  foundPerfectMatch = False
362
362
  #
363
363
  if authHitList:
364
364
  authRefD[str(partNum)] = authHitList
365
365
  # Skip blast search if found perfect author provided reference sequence match
366
- if autoMatchStatus:
366
+ if autoMatchStatus or skipBlastSearch:
367
367
  continue
368
368
  #
369
369
  # Skip blast search for short sequence
@@ -468,7 +468,7 @@ class LocalBlastSearchUtils(object):
468
468
  def __fetchAuthProvidedRefSequence(self, sequence, seqNumBeg, seqNumEnd, seqPartId, taxId, mutationList, partNumbers):
469
469
  """Fetch reference sequence based on author provided ref IDs"""
470
470
  if (not self.__authRefDataList) or (len(self.__authRefDataList) > partNumbers):
471
- return False, []
471
+ return False, False, []
472
472
  #
473
473
  refData = []
474
474
  if partNumbers > 1:
@@ -482,10 +482,10 @@ class LocalBlastSearchUtils(object):
482
482
  refData = self.__authRefDataList[0]
483
483
  #
484
484
  if not refData:
485
- return False, []
485
+ return False, False, []
486
486
  #
487
487
  fetchUtil = FetchReferenceSequenceUtils(siteId=self.__siteId, seqReferenceData=self.__srd, verbose=self.__verbose, log=self.__lfh)
488
- autoMatchStatus, hitD = fetchUtil.fetchReferenceSequenceWithSeqMatch(refData[0], refData[1], refData[2], taxId, sequence, seqNumBeg, mutationList)
488
+ autoMatchStatus, skipBlastSearch, hitD = fetchUtil.fetchReferenceSequenceWithSeqMatch(refData[0], refData[1], refData[2], taxId, sequence, seqNumBeg, mutationList)
489
489
  if hitD:
490
490
  hitD["beg_seq_num"] = seqNumBeg
491
491
  hitD["end_seq_num"] = seqNumEnd
@@ -500,12 +500,12 @@ class LocalBlastSearchUtils(object):
500
500
  if autoMatchStatus:
501
501
  hitD["auto_match_status"] = True
502
502
  #
503
- return autoMatchStatus, [hitD]
503
+ return autoMatchStatus, skipBlastSearch, [hitD]
504
504
  else:
505
505
  self.__lfh.write("+LocalBlastSearchUtils.__fetchAuthProvidedRefSequence() get sequence alignment index error: %s\n" % error)
506
506
  #
507
507
  #
508
- return False, []
508
+ return False, False, []
509
509
 
510
510
  def __writeSearchResult(self, rD):
511
511
  """Write out the current search result pickle file"""
@@ -287,6 +287,7 @@ class SequenceReferenceData(object):
287
287
  return r1L, r3L
288
288
 
289
289
  inP = False
290
+ r3 = "" # For pylint
290
291
  for s in ss:
291
292
  if s in string.whitespace:
292
293
  continue
@@ -325,6 +326,7 @@ class SequenceReferenceData(object):
325
326
  return r1L, r3L
326
327
 
327
328
  inP = False
329
+ r3 = "" # For pylint
328
330
  for s in ss:
329
331
  if s in string.whitespace:
330
332
  continue
@@ -363,6 +365,7 @@ class SequenceReferenceData(object):
363
365
  return r1L, r3L
364
366
 
365
367
  inP = False
368
+ r3 = "" # To keep pylint happy
366
369
  for s in ss:
367
370
  if s in string.whitespace:
368
371
  continue
@@ -512,6 +512,8 @@ class SeqModWebAppWorker(object):
512
512
  if authId is not None and len(authId) > 1:
513
513
  tL = str(authId).split("_")
514
514
  entityId = tL[2]
515
+ else:
516
+ entityId = "???" # keep pylint happy
515
517
  cD = self.__makeTaxonomyEditForm(entityId=entityId, entryId=identifier)
516
518
  self.__reqObj.setReturnFormat(return_format="json")
517
519
  rC = SeqModResponseContent(reqObj=self.__reqObj, verbose=self.__verbose, log=self.__lfh)
@@ -571,6 +573,9 @@ class SeqModWebAppWorker(object):
571
573
  tL = str(refId).split("_")
572
574
  entityId = str(tL[1])
573
575
  partId = str(tL[3])
576
+ else:
577
+ entityId = ""
578
+ partId = ""
574
579
  #
575
580
  sdU = UpdatePolymerEntityReference(reqObj=self.__reqObj, verbose=self.__verbose, log=self.__lfh)
576
581
  cD = sdU.makeSeqdbrefEditForm(entityId, partId, entryId=identifier)
@@ -1298,6 +1303,7 @@ class SeqModWebAppWorker(object):
1298
1303
  if self.__verbose:
1299
1304
  self.__lfh.write("\n\n+SeqModWebApp.__closeSeqEditor() - starting with operation %s\n" % mode)
1300
1305
 
1306
+ state = "???" # pylint noted could be unset
1301
1307
  if mode == "completed":
1302
1308
  state = "closed(0)"
1303
1309
  elif mode == "unfinished":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wwpdb.apps.seqmodule
3
- Version: 0.27.1
3
+ Version: 0.27.3
4
4
  Summary: wwPDB sequence module
5
5
  Home-page: https://github.com/wwPDB/py-wwpdb_apps_seqmodule
6
6
  Author: Ezra Peisach