本文整理匯總了Python中prody.SETTINGS.pop方法的典型用法代碼示例。如果您正苦於以下問題:Python SETTINGS.pop方法的具體用法?Python SETTINGS.pop怎麽用?Python SETTINGS.pop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類prody.SETTINGS
的用法示例。
在下文中一共展示了SETTINGS.pop方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: pathPDBMirror
# 需要導入模塊: from prody import SETTINGS [as 別名]
# 或者: from prody.SETTINGS import pop [as 別名]
def pathPDBMirror(path=None, format=None):
"""Returns or specify PDB mirror path to be used by :func:`.fetchPDB`.
To release the current mirror, pass an invalid path, e.g. ``path=''``.
If you are keeping a partial mirror, such as PDB files in
:file:`/data/structures/divided/pdb/` folder, specify *format*, which is
``'pdb'`` in this case."""
if path is None:
path = SETTINGS.get('pdb_mirror_path')
format = SETTINGS.get('pdb_mirror_format', None)
if path:
if isdir(path):
if format is None:
return path
else:
return path, format
else:
LOGGER.warning('PDB mirror path {0} is not a accessible.'
.format(repr(path)))
else:
if isdir(path):
path = abspath(path)
LOGGER.info('Local PDB mirror path is set: {0}'
.format(repr(path)))
SETTINGS['pdb_mirror_path'] = path
SETTINGS['pdb_mirror_format'] = format
SETTINGS.save()
else:
current = SETTINGS.pop('pdb_mirror_path')
if current:
LOGGER.info('PDB mirror {0} is released.'
.format(repr(current)))
SETTINGS.save()
else:
raise IOError('{0} is not a valid path.'.format(repr(path)))
示例2: pathPDBFolder
# 需要導入模塊: from prody import SETTINGS [as 別名]
# 或者: from prody.SETTINGS import pop [as 別名]
def pathPDBFolder(folder=None, divided=False):
"""Returns or specify local PDB folder for storing PDB files downloaded from
`wwPDB <http://www.wwpdb.org/>`_ servers. Files stored in this folder can
be accessed via :func:`.fetchPDB` from any working directory. To release
the current folder, pass an invalid path, e.g. ``folder=''``.
If *divided* is **True**, the divided folder structure of wwPDB servers
will be assumed when reading from and writing to the local folder. For
example, a structure with identifier **1XYZ** will be present as
:file:`pdblocalfolder/yz/pdb1xyz.pdb.gz`.
If *divided* is **False**, a plain folder structure will be expected and
adopted when saving files. For example, the same structure will be
present as :file:`pdblocalfolder/1xyz.pdb.gz`.
Finally, in either case, lower case letters will be used and compressed
files will be stored."""
if folder is None:
folder = SETTINGS.get('pdb_local_folder')
if folder:
if isdir(folder):
return folder, SETTINGS.get('pdb_local_divided', True)
else:
LOGGER.warn('PDB local folder {0} is not a accessible.'
.format(repr(folder)))
else:
if isdir(folder):
folder = abspath(folder)
LOGGER.info('Local PDB folder is set: {0}'.format(repr(folder)))
if divided:
LOGGER.info('wwPDB divided folder structure will be assumed.')
else:
LOGGER.info('A plain folder structure will be assumed.')
SETTINGS['pdb_local_folder'] = folder
SETTINGS['pdb_local_divided'] = bool(divided)
SETTINGS.save()
else:
current = SETTINGS.pop('pdb_local_folder')
if current:
LOGGER.info('PDB folder {0} is released.'
.format(repr(current)))
SETTINGS.pop('pdb_local_divided')
SETTINGS.save()
else:
raise IOError('{0} is not a valid path.'.format(repr(folder)))
示例3: resetDefinitions
# 需要導入模塊: from prody import SETTINGS [as 別名]
# 或者: from prody.SETTINGS import pop [as 別名]
def resetDefinitions(flag):
if flag == 'all':
SETTINGS.pop(DEFINITIONS_KEY, None)
SETTINGS.pop(NONSTANDARD_KEY, None)
SETTINGS[TIMESTAMP_KEY] = int(time())
SETTINGS.save()
updateDefinitions()
elif flag == 'nonstdaa':
SETTINGS.pop(NONSTANDARD_KEY, None)
SETTINGS[TIMESTAMP_KEY] = int(time())
SETTINGS.save()
updateDefinitions()
else:
try:
SETTINGS.pop(DEFINITIONS_KEY, {}).pop(flag)
except KeyError:
pass
else:
SETTINGS[TIMESTAMP_KEY] = int(time())
SETTINGS.save()
updateDefinitions()