wwpdb.apps.seqmodule 0.26.1__tar.gz → 0.26.2__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.26.1 → wwpdb.apps.seqmodule-0.26.2}/PKG-INFO +1 -1
  2. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/__init__.py +1 -1
  3. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/align/AlignmentBackEndEditingTools.py +21 -6
  4. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/io/BlastPlusReader.py +2 -0
  5. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/util/LocalBlastSearchUtils.py +85 -15
  6. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb.apps.seqmodule.egg-info/PKG-INFO +1 -1
  7. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/README.md +0 -0
  8. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/setup.cfg +0 -0
  9. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/setup.py +0 -0
  10. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/__init__.py +0 -0
  11. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/__init__.py +0 -0
  12. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/align/AlignmentDepictionTools.py +0 -0
  13. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/align/AlignmentExport.py +0 -0
  14. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/align/AlignmentFrontEndUIEditor.py +0 -0
  15. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/align/AlignmentStatistics.py +0 -0
  16. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/align/AlignmentStatisticsTests.py +0 -0
  17. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/align/AlignmentToolUtils.py +0 -0
  18. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/align/AlignmentTools.py +0 -0
  19. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/align/__init__.py +0 -0
  20. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/control/DataImporter.py +0 -0
  21. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/control/SequenceDataAssembleExample.py +0 -0
  22. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/control/SequenceDataAssembleTests.py +0 -0
  23. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/control/SequenceDataAssemble_v2.py +0 -0
  24. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/control/SequenceDataPrepTests.py +0 -0
  25. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/control/SummaryViewDepiction.py +0 -0
  26. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/control/SummaryViewTests.py +0 -0
  27. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/control/SummaryView_v2.py +0 -0
  28. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/control/__init__.py +0 -0
  29. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/io/AlignmentDataStore.py +0 -0
  30. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/io/FetchSeqInfoUtils.py +0 -0
  31. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/io/ModelSequenceUtils.py +0 -0
  32. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/io/ModelSequenceUtilsTests.py +0 -0
  33. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/io/PdbxIoUtils.py +0 -0
  34. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/io/SequenceDataExportTests.py +0 -0
  35. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/io/SequenceDataExport_v2.py +0 -0
  36. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/io/SequenceDataStore.py +0 -0
  37. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/io/SequenceDataStoreTests.py +0 -0
  38. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/io/SequenceEditStore.py +0 -0
  39. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/io/SequenceEditStoreTests.py +0 -0
  40. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/io/TaxonomyDbUtils.py +0 -0
  41. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/io/TaxonomyUtils.py +0 -0
  42. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/io/TaxonomyUtilsTests.py +0 -0
  43. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/io/__init__.py +0 -0
  44. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/io/testAuto.py +0 -0
  45. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/link/PolymerLinkageDepict.py +0 -0
  46. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/link/__init__.py +0 -0
  47. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/update/UpdatePolymerEntityPartitions.py +0 -0
  48. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/update/UpdatePolymerEntityReference_v2.py +0 -0
  49. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/update/UpdatePolymerEntitySourceDetails.py +0 -0
  50. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/update/__init__.py +0 -0
  51. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/util/Autodict.py +0 -0
  52. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/util/FetchReferenceSequenceUtils.py +0 -0
  53. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/util/GetSameSeqAnnotationWithTaxIdOnly.py +0 -0
  54. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/util/MultiProcLimit.py +0 -0
  55. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/util/SearchEntityPolySeqs.py +0 -0
  56. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/util/SeqReferenceSearchUtils.py +0 -0
  57. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/util/SequenceAssign.py +0 -0
  58. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/util/SequenceExamples.py +0 -0
  59. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/util/SequenceFeatureDepict.py +0 -0
  60. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/util/SequenceLabel.py +0 -0
  61. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/util/SequenceReferenceData.py +0 -0
  62. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/util/UpdateSequenceDataStoreUtils.py +0 -0
  63. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/util/__init__.py +0 -0
  64. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/view3d/ModelViewer3D.py +0 -0
  65. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/view3d/__init__.py +0 -0
  66. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/webapp/SeqModWebApp_v2.py +0 -0
  67. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/webapp/SeqModWebRequest.py +0 -0
  68. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb/apps/seqmodule/webapp/__init__.py +0 -0
  69. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb.apps.seqmodule.egg-info/SOURCES.txt +0 -0
  70. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb.apps.seqmodule.egg-info/dependency_links.txt +0 -0
  71. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb.apps.seqmodule.egg-info/not-zip-safe +0 -0
  72. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/wwpdb.apps.seqmodule.egg-info/requires.txt +0 -0
  73. {wwpdb.apps.seqmodule-0.26.1 → wwpdb.apps.seqmodule-0.26.2}/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.26.1
3
+ Version: 0.26.2
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.26.1"
5
+ __version__ = "0.26.2"
@@ -178,14 +178,22 @@ class AlignmentBackEndEditingTools(AlignmentTools):
178
178
  authIdx = self._seqAlignLabelIndices[self.__local_authLabel]
179
179
  self._checkPartStartEndPosMap(authIdx, self.__local_authLabel)
180
180
  #
181
+ updatedSeqLabelIdList = []
181
182
  for seqType in ("auth", "xyz", "ref"):
182
183
  if seqType not in self.__editedSeqLabelMap:
183
184
  continue
184
185
  #
185
186
  for seqLabelId, editTypeList in self.__editedSeqLabelMap[seqType].items():
186
- self.__updateSequenceInfo(authIdx, seqLabelId, editTypeList)
187
+ self.__updateSequenceInfo(authIdx, seqLabelId, editTypeList, nextVersionFlag=True)
188
+ updatedSeqLabelIdList.append(seqLabelId)
187
189
  #
188
190
  #
191
+ for seqLabelId in inputAlignIdList:
192
+ if seqLabelId in updatedSeqLabelIdList:
193
+ continue
194
+ #
195
+ self.__updateSequenceInfo(authIdx, seqLabelId, "")
196
+ #
189
197
  if ("details" in self.__editedType) or ("replace" in self.__editedType) or ("delete" in self.__editedType) or ("insert" in self.__editedType):
190
198
  self.saveSequenceDataStore()
191
199
  #
@@ -260,9 +268,9 @@ class AlignmentBackEndEditingTools(AlignmentTools):
260
268
  #
261
269
  #
262
270
 
263
- def __updateSequenceInfo(self, authIdx, seqLabelId, editTypeList):
271
+ def __updateSequenceInfo(self, authIdx, seqLabelId, editTypeList, nextVersionFlag=False):
264
272
  """Propogate the alignment edits to new versions of the sequences in the sequence data store."""
265
- if (len(editTypeList) < 1) or ((len(editTypeList) == 1) and (editTypeList[0] == "replaceid")):
273
+ if nextVersionFlag and ((len(editTypeList) < 1) or ((len(editTypeList) == 1) and (editTypeList[0] == "replaceid"))):
266
274
  return
267
275
  #
268
276
  (seqType, seqInstId, seqPartId, seqAltId, seqVersion) = self._getUnpackSeqLabel(seqLabelId)
@@ -338,7 +346,8 @@ class AlignmentBackEndEditingTools(AlignmentTools):
338
346
  #
339
347
  alignTup[alignIdx][3] = codeIndex(seqIdx, comment)
340
348
  #
341
- self.setSequence(newSeqList, seqType, seqInstId, seqPartId, seqAltId, nextVersion)
349
+ if nextVersionFlag:
350
+ self.setSequence(newSeqList, seqType, seqInstId, seqPartId, seqAltId, nextVersion)
342
351
  #
343
352
  if seqType == "auth":
344
353
  if alignIdx == authIdx:
@@ -372,9 +381,15 @@ class AlignmentBackEndEditingTools(AlignmentTools):
372
381
  seqLen=len(newSeqList), alignLen=int(alignLength), seqSim=float(numMatch) / float(alignLength), seqSimWithGaps=float(numMatchGaps) / float(alignLength)
373
382
  )
374
383
  #
375
- self.setFeature(sFeature.get(), seqType, seqInstId, seqPartId, seqAltId, nextVersion)
384
+ if nextVersionFlag:
385
+ self.setFeature(sFeature.get(), seqType, seqInstId, seqPartId, seqAltId, nextVersion)
386
+ else:
387
+ self.setFeature(sFeature.get(), seqType, seqInstId, seqPartId, seqAltId, seqVersion)
388
+ #
389
+ #
390
+ if nextVersionFlag:
391
+ self.__newSeqLabelIdMap[seqLabelId] = self._getSeqLabelId((seqType, seqInstId, seqPartId, seqAltId, nextVersion))
376
392
  #
377
- self.__newSeqLabelIdMap[seqLabelId] = self._getSeqLabelId((seqType, seqInstId, seqPartId, seqAltId, nextVersion))
378
393
 
379
394
  def __updateXyzAlignList(self):
380
395
  """Re-create self._xyzAlignLabelIndices, self._reverseXyzAlignLabelIndices & self._xyzAlignList from
@@ -38,6 +38,8 @@ class BlastPlusReader(object):
38
38
  dict['hitTo']
39
39
  dict['alignLen']
40
40
  dict['match_length']
41
+ dict['query_length']
42
+ dict['db_length']
41
43
 
42
44
  """
43
45
 
@@ -36,6 +36,7 @@ except ImportError:
36
36
  import pickle as pickle
37
37
  #
38
38
  import multiprocessing
39
+ import copy
39
40
  import os
40
41
  import sys
41
42
  import time
@@ -49,6 +50,7 @@ from wwpdb.apps.seqmodule.util.FetchReferenceSequenceUtils import FetchReference
49
50
  from wwpdb.apps.seqmodule.util.SequenceReferenceData import SequenceReferenceData
50
51
  from rcsb.utils.multiproc.MultiProcUtil import MultiProcUtil
51
52
  from wwpdb.io.locator.PathInfo import PathInfo
53
+ from wwpdb.utils.config.ConfigInfoApp import ConfigInfoAppCommon
52
54
  from wwpdb.utils.dp.RcsbDpUtility import RcsbDpUtility
53
55
 
54
56
 
@@ -65,7 +67,7 @@ class LocalBlastSearchUtils(object):
65
67
  self.__ncbilock = ncbilock
66
68
  #
67
69
  self.__minRnaSequenceSearchLength = 50
68
- self.__maxHitsSearch = 100
70
+ self.__maxHitsSearch = 250
69
71
  self.__maxHitsSave = 50
70
72
  self.__shortSequenceLengthLimit = 20
71
73
  self.__cleanUp = True
@@ -87,6 +89,9 @@ class LocalBlastSearchUtils(object):
87
89
  self.__taxUtils = TaxonomyUtils(siteId=self.__siteId, verbose=self.__verbose, log=self.__lfh)
88
90
  self.__srd = SequenceReferenceData(self.__verbose, self.__lfh)
89
91
  #
92
+ self.__cICommon = ConfigInfoAppCommon(self.__siteId)
93
+ self.__seqDbPath = self.__cICommon.get_site_refdata_sequence_db_path()
94
+ #
90
95
  self.__matchEntityAttribNameList = [
91
96
  "id",
92
97
  "fragment_id",
@@ -290,11 +295,21 @@ class LocalBlastSearchUtils(object):
290
295
  taxId = fD["SOURCE_TAXID"]
291
296
  searchSequence = oneLetterSearchSeq[(int(seqNumBeg) - 1) : int(seqNumEnd)]
292
297
  #
298
+ searchResultFileList = []
293
299
  xmlFilePath = os.path.join(self.__sessionPath, self.__dataSetId + "_blast-match_E" + self.__entityId + "_P" + str(partNum) + ".xml")
294
300
  if os.access(xmlFilePath, os.F_OK):
295
301
  os.remove(xmlFilePath)
296
302
  #
297
- partDataList.append((str(partNum), searchSequence, seqNumBeg, seqNumEnd, taxId, xmlFilePath))
303
+ searchResultFileList.append(xmlFilePath)
304
+ if self.__seqType in ["polypeptide(L)", "polypeptide(D)", "polypeptide"]:
305
+ xmlFilePath = os.path.join(self.__sessionPath, self.__dataSetId + "_blast-match_E" + self.__entityId + "_P" + str(partNum) + ".1.xml")
306
+ #
307
+ if os.access(xmlFilePath, os.F_OK):
308
+ os.remove(xmlFilePath)
309
+ #
310
+ searchResultFileList.append(xmlFilePath)
311
+ #
312
+ partDataList.append((str(partNum), searchSequence, seqNumBeg, seqNumEnd, taxId, searchResultFileList))
298
313
  #
299
314
  mutationList = []
300
315
  if ("MUTATION_DETAILS" in self.__entityD) and self.__entityD["MUTATION_DETAILS"]:
@@ -328,13 +343,13 @@ class LocalBlastSearchUtils(object):
328
343
  continue
329
344
  #
330
345
  # Skip blast search for short sequence
331
- if len(searchSequence) <= self.__shortSequenceLengthLimit:
332
- continue
333
- #
346
+ # if len(searchSequence) <= self.__shortSequenceLengthLimit:
347
+ # continue
348
+ # #
334
349
  else:
335
350
  foundPerfectMatch = False
336
351
  #
337
- blastDataList.append((str(partNum), searchSequence, seqNumBeg, seqNumEnd, taxId, xmlFilePath))
352
+ blastDataList.append((str(partNum), searchSequence, seqNumBeg, seqNumEnd, taxId, searchResultFileList))
338
353
  #
339
354
  if not partDataList:
340
355
  return foundPerfectMatch, authRefD
@@ -351,11 +366,32 @@ class LocalBlastSearchUtils(object):
351
366
  #
352
367
  id_count = 1
353
368
  for partTup in partDataList:
354
- hitList = []
355
- if os.access(partTup[5], os.F_OK):
356
- hitList = self.__readBlastResultXmlFile(seqNumBeg=partTup[2], seqNumEnd=partTup[3], seqPartId=partTup[0], authTaxId=partTup[4],
357
- blastResultXmlPath=partTup[5])
369
+ mergedhitList = []
370
+ uniqueIdList = []
371
+ for resultFile in partTup[5]:
372
+ if not os.access(resultFile, os.F_OK):
373
+ continue
374
+ #
375
+ returnHitList = self.__readBlastResultXmlFile(seqNumBeg=partTup[2], seqNumEnd=partTup[3], seqPartId=partTup[0], \
376
+ authTaxId=partTup[4], blastResultXmlPath=resultFile)
377
+ if len(returnHitList) == 0:
378
+ continue
379
+ #
380
+ for hitD in returnHitList:
381
+ refID = ""
382
+ if ("db_isoform" in hitD) and hitD["db_isoform"]:
383
+ refID = hitD["db_isoform"]
384
+ elif ("db_accession" in hitD) and hitD["db_accession"]:
385
+ refID = hitD["db_accession"]
386
+ #
387
+ if (refID == "") or (refID in uniqueIdList):
388
+ continue
389
+ #
390
+ uniqueIdList.append(refID)
391
+ mergedhitList.append(hitD)
392
+ #
358
393
  #
394
+ hitList = self.__getHitList(mergedhitList, partTup[4])
359
395
  if hitList:
360
396
  SeqAlignmentMap = self.__getRefSeqAlignments(hitList)
361
397
  for hit in hitList:
@@ -515,27 +551,42 @@ class LocalBlastSearchUtils(object):
515
551
  )
516
552
  self.__lfh.write("+LocalBlastSearchUtils.runMultiLocalBlasts() ncbilock %s\n" % ncbilock)
517
553
  #
518
- self.__runSingleLocalBlast(oneLetterCodeSeq=tupL[1], blastResultXmlPath=tupL[5], partNum=tupL[0], taxId=tupL[4])
554
+ if self.__seqType in ["polypeptide(L)", "polypeptide(D)", "polypeptide"]:
555
+ swissprotDBPath = os.path.join(self.__seqDbPath, "my_swissprot_all.pjs")
556
+ if os.access(swissprotDBPath, os.F_OK):
557
+ self.__runSingleLocalBlast(oneLetterCodeSeq=tupL[1], searchResultFile=tupL[5][0], partNum=tupL[0], taxId=tupL[4], dbName="my_swissprot_all")
558
+ if not self.__findPerfectMath(begSeqNum=tupL[2], endSeqNum=tupL[3], partId=tupL[0], taxId=tupL[4], searchResultFile=tupL[5][0]):
559
+ self.__runSingleLocalBlast(oneLetterCodeSeq=tupL[1], searchResultFile=tupL[5][1], partNum=tupL[0], taxId=tupL[4], dbName="my_uniprot_all")
560
+ #
561
+ else:
562
+ self.__runSingleLocalBlast(oneLetterCodeSeq=tupL[1], searchResultFile=tupL[5][0], partNum=tupL[0], taxId=tupL[4], dbName="my_uniprot_all")
563
+ #
564
+ else:
565
+ self.__runSingleLocalBlast(oneLetterCodeSeq=tupL[1], searchResultFile=tupL[5][0], partNum=tupL[0], taxId=tupL[4], dbName="my_ncbi_nt")
566
+ #
519
567
  rList.append(tupL[0])
520
568
  #
521
569
  return rList, rList, []
522
570
 
523
- def __runSingleLocalBlast(self, oneLetterCodeSeq, blastResultXmlPath, partNum, taxId):
571
+ def __runSingleLocalBlast(self, oneLetterCodeSeq, searchResultFile, partNum, taxId, dbName):
524
572
  """Internal method to execute the sequence search according to input polymer type."""
525
573
  if self.__verbose:
526
574
  self.__lfh.write("+LocalBlastSearchUtils.__runSingleLocalBlast() STARTING %s Launch search for %s sequence = %s\n" % (self.__siteId, self.__seqType, oneLetterCodeSeq))
527
575
  self.__lfh.flush()
528
576
  #
529
577
  timeBegin = time.time()
530
- resultPath = os.path.abspath(blastResultXmlPath)
578
+ resultPath = os.path.abspath(searchResultFile)
531
579
  tmpPathAbs = os.path.abspath(self.__sessionPath)
532
580
  #
533
581
  if self.__seqType in ["polypeptide(L)", "polypeptide(D)", "polypeptide"]:
534
582
  dp = RcsbDpUtility(tmpPath=tmpPathAbs, siteId=self.__siteId, verbose=True)
535
583
  dp.addInput(name="one_letter_code_sequence", value=oneLetterCodeSeq)
536
- dp.addInput(name="db_name", value="my_uniprot_all")
584
+ dp.addInput(name="db_name", value=dbName)
537
585
  dp.addInput(name="num_threads", value="4")
538
586
  dp.addInput(name="max_hits", value=self.__maxHitsSearch)
587
+ if len(oneLetterCodeSeq) <= self.__shortSequenceLengthLimit:
588
+ dp.addInput(name="short_seq", value=True)
589
+ #
539
590
  if taxId:
540
591
  dp.addInput(name="tax_id", value=taxId)
541
592
  #
@@ -572,6 +623,25 @@ class LocalBlastSearchUtils(object):
572
623
  self.__lfh.flush()
573
624
  #
574
625
 
626
+ def __findPerfectMath(self, begSeqNum="", endSeqNum="", partId="", taxId="", searchResultFile=None):
627
+ """ Check if there is a perfect match
628
+ """
629
+ if (not begSeqNum) or (not endSeqNum) or (not partId) or (not taxId) or (not searchResultFile) or (not os.access(searchResultFile, os.F_OK)):
630
+ return False
631
+ #
632
+ hitList = self.__readBlastResultXmlFile(seqNumBeg=begSeqNum, seqNumEnd=endSeqNum, seqPartId=partId, authTaxId=taxId, \
633
+ blastResultXmlPath=searchResultFile)
634
+ for hitD in hitList:
635
+ if ("query_length" not in hitD) or (not hitD["query_length"]) or ("identity" not in hitD) or (not hitD["identity"]) or \
636
+ ("taxonomy_id" not in hitD) or (not hitD["taxonomy_id"]):
637
+ continue
638
+ #
639
+ if (hitD["query_length"] == hitD["identity"]) and (hitD["taxonomy_id"] == taxId):
640
+ return True
641
+ #
642
+ #
643
+ return False
644
+
575
645
  def __readBlastResultXmlFile(self, seqNumBeg, seqNumEnd, seqPartId, authTaxId, blastResultXmlPath):
576
646
  """Read blast result"""
577
647
  hitList = []
@@ -710,7 +780,7 @@ class LocalBlastSearchUtils(object):
710
780
  hit["end_seq_num"] = seqNumEnd
711
781
  hit["fragment_id"] = seqPartId
712
782
  #
713
- return self.__getHitList(hitList, authTaxId)
783
+ return hitList
714
784
 
715
785
  def __getHitList(self, hitList, authTaxId):
716
786
  """ """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wwpdb.apps.seqmodule
3
- Version: 0.26.1
3
+ Version: 0.26.2
4
4
  Summary: wwPDB sequence module
5
5
  Home-page: https://github.com/wwPDB/py-wwpdb_apps_seqmodule
6
6
  Author: Ezra Peisach