diff --git a/prody/database/pfam.py b/prody/database/pfam.py index 5b178aaee..77ad08d2c 100644 --- a/prody/database/pfam.py +++ b/prody/database/pfam.py @@ -3,6 +3,7 @@ __author__ = 'Anindita Dutta, Ahmet Bakan, Cihan Kaya' +from prody.dynamics.analysis import calcFracDimension import re from numbers import Integral @@ -222,6 +223,7 @@ def searchPfam(query, **kwargs): elif xml.find(b'No valid UniProt accession or ID') > 0: try: url = prefix + 'protein/' + accession + '?output=xml' + LOGGER.debug('Retrieving Pfam search results: ' + url) xml = openURL(url, timeout=timeout).read() except: try: @@ -230,6 +232,19 @@ def searchPfam(query, **kwargs): return searchPfam(ag_seq) except: raise ValueError('No valid UniProt accession or ID for: ' + seq) + + if xml.find(b'No valid UniProt accession or ID') > 0: + try: + url = 'https://uniprot.org/uniprot/' + accession + '.xml' + xml = openURL(url, timeout=timeout).read() + root = ET.XML(xml) + accession = root[0][0].text + + url = prefix + 'protein/' + accession + '?output=xml' + LOGGER.debug('Retrieving Pfam search results: ' + url) + xml = openURL(url, timeout=timeout).read() + except: + raise ValueError('No valid UniProt accession or ID for: ' + seq) try: root = ET.XML(xml)