Skip to content

Commit

Permalink
fix fetch cif from http
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmkrieger committed Nov 8, 2024
1 parent 87c5de6 commit a3b9298
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions prody/proteins/wwpdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,22 @@ def fetchPDBviaHTTP(*pdb, **kwargs):
output_folder = kwargs.pop('folder', None)
compressed = bool(kwargs.pop('compressed', True))

extension = '.pdb'
format = kwargs.get('format', 'pdb')
noatom = bool(kwargs.pop('noatom', False))
if format == 'pdb':
extension = '.pdb'
elif format == 'xml':
if noatom:
extension = '-noatom.xml'
else:
extension = '.xml'
elif format == 'cif':
extension = '.cif'
elif format == 'emd' or format == 'map':
extension = '.map'
else:
raise ValueError(repr(format) + ' is not valid format')

local_folder = pathPDBFolder()
if local_folder:
local_folder, is_divided = local_folder
Expand Down Expand Up @@ -294,7 +309,10 @@ def fetchPDBviaHTTP(*pdb, **kwargs):
filenames.append(None)
continue
try:
handle = openURL(getURL(pdb))
url = getURL(pdb)
if kwargs['format'] != 'pdb':
url = url.replace('.pdb', extension)
handle = openURL(url)
except Exception as err:
LOGGER.warn('{0} download failed ({1}).'.format(pdb, str(err)))
failure += 1
Expand Down

0 comments on commit a3b9298

Please sign in to comment.