wwpdb.apps.msgmodule 0.177__tar.gz → 0.178__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 (31) hide show
  1. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/PKG-INFO +11 -2
  2. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/__init__.py +1 -1
  3. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/util/DaInternalDb.py +48 -15
  4. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/webapp/MessagingWebApp.py +13 -8
  5. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb.apps.msgmodule.egg-info/PKG-INFO +11 -2
  6. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/README.md +0 -0
  7. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/setup.cfg +0 -0
  8. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/setup.py +0 -0
  9. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/__init__.py +0 -0
  10. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/__init__.py +0 -0
  11. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/depict/MessagingDepict.py +0 -0
  12. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/depict/MessagingTemplates.py +0 -0
  13. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/depict/__init__.py +0 -0
  14. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/io/DateUtil.py +0 -0
  15. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/io/EmHeaderUtils.py +0 -0
  16. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/io/MessagingDataExport.py +0 -0
  17. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/io/MessagingDataImport.py +0 -0
  18. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/io/MessagingIo.py +0 -0
  19. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/io/__init__.py +0 -0
  20. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/models/Message.py +0 -0
  21. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/models/__init__.py +0 -0
  22. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/util/AutoMessage.py +0 -0
  23. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/util/ExtractMessage.py +0 -0
  24. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/util/__init__.py +0 -0
  25. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/webapp/__init__.py +0 -0
  26. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb/apps/msgmodule/webapp/wsgi.py +0 -0
  27. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb.apps.msgmodule.egg-info/SOURCES.txt +0 -0
  28. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb.apps.msgmodule.egg-info/dependency_links.txt +0 -0
  29. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb.apps.msgmodule.egg-info/not-zip-safe +0 -0
  30. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb.apps.msgmodule.egg-info/requires.txt +0 -0
  31. {wwpdb_apps_msgmodule-0.177 → wwpdb_apps_msgmodule-0.178}/wwpdb.apps.msgmodule.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: wwpdb.apps.msgmodule
3
- Version: 0.177
3
+ Version: 0.178
4
4
  Summary: wwPDB messaging module
5
5
  Home-page: https://github.com/rcsb/py-wwpdb_apps_ann_tasks_v2
6
6
  Author: Ezra Peisach
@@ -31,5 +31,14 @@ Provides-Extra: dev
31
31
  Requires-Dist: check-manifest; extra == "dev"
32
32
  Provides-Extra: test
33
33
  Requires-Dist: coverage; extra == "test"
34
+ Dynamic: author
35
+ Dynamic: author-email
36
+ Dynamic: classifier
37
+ Dynamic: description
38
+ Dynamic: home-page
39
+ Dynamic: license
40
+ Dynamic: provides-extra
41
+ Dynamic: requires-dist
42
+ Dynamic: summary
34
43
 
35
44
  See: README.md
@@ -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.177"
5
+ __version__ = "0.178"
@@ -2,6 +2,7 @@
2
2
  # Author: Chenghua Shao
3
3
  # Date: 2024-08-30
4
4
  # Updates:
5
+ # 2024-12-23 CS Add support on extended PDB ID
5
6
  #
6
7
  # =============================================================================
7
8
  """
@@ -18,13 +19,13 @@ class DaInternalDb(object):
18
19
  """DA_INTERNAL DB class for data lookup
19
20
 
20
21
  Args:
21
- object (_type_): object
22
+ object (obj): object
22
23
  """
23
24
  def __init__(self, siteId=None):
24
25
  """Initiator
25
26
 
26
27
  Args:
27
- siteId (_type_, optional): SITE ID. Defaults to None that will use the SITE ID of the current server.
28
+ siteId (str, optional): SITE ID. Defaults to None that will use the SITE ID of the current server.
28
29
  """
29
30
  self.__mydb = None
30
31
  self.__siteId = siteId
@@ -42,7 +43,7 @@ class DaInternalDb(object):
42
43
  resource (str, optional): DB name. Defaults to "DA_INTERNAL".
43
44
 
44
45
  Returns:
45
- _type_: True/False for DB connection
46
+ bool: True/False for DB connection
46
47
  """
47
48
  self.__mydb = MyConnectionBase(siteId=self.__siteId)
48
49
  self.__mydb.setResource(resourceName=resource)
@@ -65,10 +66,10 @@ class DaInternalDb(object):
65
66
  """Simplified query runner
66
67
 
67
68
  Args:
68
- query (_type_): Full text of a query
69
+ query (str): Full text of a query
69
70
 
70
71
  Returns:
71
- _type_: raw query results as tuple of tuples, e.g. ((1,2),(3,4))
72
+ tuple: raw query results as tuple of tuples, e.g. ((1,2),(3,4))
72
73
  """
73
74
  cur = self.__mydb.getCursor()
74
75
  cur.execute(query)
@@ -80,10 +81,10 @@ class DaInternalDb(object):
80
81
  """Verify if an id is deposition id
81
82
 
82
83
  Args:
83
- dep_id (_type_): presumed dep id input
84
+ dep_id (str): presumed dep id input
84
85
 
85
86
  Returns:
86
- _type_: True/False
87
+ bool: True/False
87
88
  """
88
89
  query = "select structure_id from rcsb_status where structure_id = '%s'" % dep_id
89
90
  rows = self.run(query)
@@ -96,10 +97,10 @@ class DaInternalDb(object):
96
97
  """Verify if an id is PDB ID
97
98
 
98
99
  Args:
99
- pdb_id (_type_): presumed PDB id input
100
+ pdb_id (str): presumed PDB id input
100
101
 
101
102
  Returns:
102
- _type_: True/False
103
+ bool: True/False
103
104
  """
104
105
  query = "select structure_id from rcsb_status where pdb_id = '%s'" % pdb_id
105
106
  rows = self.run(query)
@@ -108,14 +109,30 @@ class DaInternalDb(object):
108
109
  else:
109
110
  return False
110
111
 
112
+ def verifyExtendedPdbId(self, pdb_ext_id):
113
+ """Verify if an id is extended PDB ID
114
+
115
+ Args:
116
+ pdb_ext_id (str): presumed extended PDB id input
117
+
118
+ Returns:
119
+ bool: True/False
120
+ """
121
+ query = "select structure_id from database_2 where database_id = 'PDB' and pdbx_database_accession = '%s'" % pdb_ext_id
122
+ rows = self.run(query)
123
+ if rows:
124
+ return True
125
+ else:
126
+ return False
127
+
111
128
  def verifyEmdbId(self, emdb_id):
112
129
  """Verify if an id is EMDB ID
113
130
 
114
131
  Args:
115
- emdb_id (_type_): presumed EMDB ID input
132
+ emdb_id (str): presumed EMDB ID input
116
133
 
117
134
  Returns:
118
- _type_: True/False
135
+ bool: True/False
119
136
  """
120
137
  query = "select structure_id from database_2 where database_id = 'EMDB' and database_code = '%s'" % emdb_id
121
138
  rows = self.run(query)
@@ -128,10 +145,10 @@ class DaInternalDb(object):
128
145
  """Convert PDB ID to deposition id
129
146
 
130
147
  Args:
131
- pdb_id (_type_): presumed PDB ID
148
+ pdb_id (str): presumed PDB ID
132
149
 
133
150
  Returns:
134
- _type_: valid deposition id at this site, or None
151
+ str: valid deposition id at this site, or None
135
152
  """
136
153
  query = "select structure_id from rcsb_status where pdb_id = '%s'" % pdb_id
137
154
  rows = self.run(query)
@@ -140,14 +157,30 @@ class DaInternalDb(object):
140
157
  else:
141
158
  return None
142
159
 
160
+ def convertExtendedPdbIdToDepId(self, pdb_ext_id):
161
+ """Convert extended PDB ID to deposition id
162
+
163
+ Args:
164
+ pdb_id (str): presumed PDB ID
165
+
166
+ Returns:
167
+ str: valid deposition id at this site, or None
168
+ """
169
+ query = "select structure_id from database_2 where database_id = 'PDB' and pdbx_database_accession = '%s'" % pdb_ext_id
170
+ rows = self.run(query)
171
+ if rows:
172
+ return rows[0][0]
173
+ else:
174
+ return None
175
+
143
176
  def convertEmdbIdToDepId(self, emdb_id):
144
177
  """Convert EMDB ID to deposition id
145
178
 
146
179
  Args:
147
- pdb_id (_type_): presumed EMDB ID
180
+ pdb_id (str): presumed EMDB ID
148
181
 
149
182
  Returns:
150
- _type_: valid deposition id at this site, or None
183
+ str: valid deposition id at this site, or None
151
184
  """
152
185
  query = "select structure_id from database_2 where database_id = 'EMDB' and database_code = '%s'" % emdb_id
153
186
  rows = self.run(query)
@@ -38,6 +38,7 @@
38
38
  # 2023-11-20 EP Added __checkAnyApprovalFlags() and set approriate database flags if set
39
39
  # 2024-04-04 CS Add process on context_type/context_value of message-to-depositor recorded by frontend JavaScript and passed here through wsgi message submit URL
40
40
  # 2024-08-30 CS Add MessagingWebAppWorker._verifyOrConvertId() used by _propagateMsg("archive") to archive messages by PDB or EMDB IDs
41
+ # 2024-12-23 CS Add support on extended PDB ID for _verifyOrConvertId() to convert ID for archiving
41
42
  ##
42
43
  """
43
44
  wwPDB Messaging web request and response processing modules.
@@ -1250,28 +1251,32 @@ class MessagingWebAppWorker(object):
1250
1251
  if id_to_check.startswith("D_"): # format of deposition id
1251
1252
  dep_id = id_to_check
1252
1253
  if db_da_internal.verifyDepId(dep_id):
1253
- logger.debug("%s is valid deposition id at this site", id_to_check)
1254
+ logger.debug("%s is valid deposition id at this site", dep_id)
1254
1255
  return dep_id # return the input id itself is vefified
1255
1256
  else:
1256
1257
  return None
1257
1258
  elif id_to_check.startswith("EMD-"): # format of EMDB ID
1258
1259
  emdb_id = id_to_check
1259
1260
  if db_da_internal.verifyEmdbId(emdb_id):
1260
- logger.debug("%s is valid EMDB ID, convert it to deposition id", id_to_check)
1261
+ logger.debug("%s is valid EMDB ID, convert it to deposition id", emdb_id)
1261
1262
  return db_da_internal.convertEmdbIdToDepId(emdb_id) # EMDB->dep conversion
1262
1263
  else:
1263
1264
  return None
1264
- elif id_to_check.startswith("PDB_0000") and len(id_to_check) == 12: # format of extended PDB ID
1265
- pdb_id = id_to_check[-4:] # truncate the last 4 chars as temporary solution
1266
- if db_da_internal.verifyPdbId(pdb_id):
1267
- logger.debug("%s is valid extended PDB ID, convert it to deposition id", id_to_check)
1268
- return db_da_internal.convertPdbIdToDepId(pdb_id) # PDB->dep conversion
1265
+ elif id_to_check.startswith("PDB_") and len(id_to_check) == 12: # format of extended PDB ID
1266
+ # pdb_id = id_to_check[-4:] # truncate the last 4 chars as temporary solution
1267
+ # if db_da_internal.verifyPdbId(pdb_id):
1268
+ # logger.debug("%s is valid extended PDB ID, convert it to deposition id", id_to_check)
1269
+ # return db_da_internal.convertPdbIdToDepId(pdb_id) # PDB->dep conversion
1270
+ pdb_ext_id = id_to_check
1271
+ if db_da_internal.verifyExtendedPdbId(pdb_ext_id):
1272
+ logger.debug("%s is valid extended PDB ID, convert it to deposition id", pdb_ext_id)
1273
+ return db_da_internal.convertExtendedPdbIdToDepId(pdb_ext_id) # PDB extended->dep conversion
1269
1274
  else:
1270
1275
  return None
1271
1276
  elif len(id_to_check) == 4: # format of PDB ID
1272
1277
  pdb_id = id_to_check
1273
1278
  if db_da_internal.verifyPdbId(pdb_id):
1274
- logger.debug("%s is valid PDB ID, convert it to deposition id", id_to_check)
1279
+ logger.debug("%s is valid PDB ID, convert it to deposition id", pdb_id)
1275
1280
  return db_da_internal.convertPdbIdToDepId(pdb_id) # PDB->dep conversion
1276
1281
  else:
1277
1282
  return None
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: wwpdb.apps.msgmodule
3
- Version: 0.177
3
+ Version: 0.178
4
4
  Summary: wwPDB messaging module
5
5
  Home-page: https://github.com/rcsb/py-wwpdb_apps_ann_tasks_v2
6
6
  Author: Ezra Peisach
@@ -31,5 +31,14 @@ Provides-Extra: dev
31
31
  Requires-Dist: check-manifest; extra == "dev"
32
32
  Provides-Extra: test
33
33
  Requires-Dist: coverage; extra == "test"
34
+ Dynamic: author
35
+ Dynamic: author-email
36
+ Dynamic: classifier
37
+ Dynamic: description
38
+ Dynamic: home-page
39
+ Dynamic: license
40
+ Dynamic: provides-extra
41
+ Dynamic: requires-dist
42
+ Dynamic: summary
34
43
 
35
44
  See: README.md