diff --git a/src/bundles/pdb/src/pdb.py b/src/bundles/pdb/src/pdb.py
index 05ceec21e..2e7519b72 100644
a
|
b
|
_pdb_sources = {
|
125 | 125 | # "pdbj": "https://pdbj.org/rest/downloadPDBfile?format=pdb&id=%s", |
126 | 126 | } |
127 | 127 | |
128 | | def fetch_pdb(session, pdb_id, *, fetch_source="rcsb", ignore_cache=False, **kw): |
| 128 | def fetch_pdb(session, pdb_id, *, fetch_source="rcsb", ignore_cache=False, |
| 129 | structure_factors=False, over_sampling=1.5, # for ChimeraX-Clipper plugin |
| 130 | **kw): |
129 | 131 | if len(pdb_id) != 4: |
130 | 132 | from chimerax.core.errors import UserError |
131 | 133 | raise UserError('PDB identifiers are 4 characters long, got "%s"' % pdb_id) |
| 134 | if structure_factors: |
| 135 | try: |
| 136 | from chimerax.clipper.io import fetch_cif |
| 137 | except ImportError: |
| 138 | raise UserError('Working with structure factors requires the ' |
| 139 | 'ChimeraX_Clipper plugin, available from the Tool Shed') |
132 | 140 | import os |
133 | 141 | pdb_id = pdb_id.lower() |
134 | 142 | # check on local system -- TODO: configure location |
… |
… |
def fetch_pdb(session, pdb_id, *, fetch_source="rcsb", ignore_cache=False, **kw)
|
149 | 157 | session.logger.status("Opening PDB %s" % (pdb_id,)) |
150 | 158 | from chimerax.core import io |
151 | 159 | models, status = io.open_data(session, filename, format='pdb', name=pdb_id, **kw) |
| 160 | if structure_factors: |
| 161 | sf_file = fetch_cif.fetch_structure_factors(session, pdb_id, fetch_source=fetch_source, |
| 162 | ignore_cache=ignore_cache) |
| 163 | from chimerax.clipper import get_map_mgr |
| 164 | mmgr = get_map_mgr(models[0], create=True) |
| 165 | if over_sampling < 1: |
| 166 | warn_str = ('Map over-sampling rate cannot be less than 1. Resetting to 1.0') |
| 167 | session.logger.warning(warn_str) |
| 168 | over_sampling = 1 |
| 169 | mmgr.add_xmapset_from_file(sf_file, oversampling_rate = over_sampling) |
| 170 | return [mmgr.crystal_mgr], status |
| 171 | |
152 | 172 | return models, status |
153 | 173 | |
154 | 174 | def fetch_pdb_pdbe(session, pdb_id, **kw): |
… |
… |
def _process_src(src, caption):
|
587 | 607 | html += ' <td>%s</td>\n' % formatted |
588 | 608 | html += ' </tr>\n' |
589 | 609 | return html |
590 | | |