Skip to content

Commit

Permalink
Merge pull request #18 from luponzo86/master
Browse files Browse the repository at this point in the history
update Oct. 2020
  • Loading branch information
luponzo86 authored Oct 8, 2020
2 parents a3fa8b7 + 11e09c4 commit 483ef2c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
15 changes: 11 additions & 4 deletions rhapsody/features/PolyPhen2.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,17 @@ def parsePolyPhen2output(pph2_output):
# discard invalid lines
lines = [l for l in lines if l.strip() and l[0] != '#']
if not lines:
msg = ("PolyPhen-2's output is empty. Please make sure that: \n"
"1) variants' format is correct "
'(\"UniprotID pos wt_aa mut_aa\") \n'
"2) query contains *human* variants \n")
msg = (
"PolyPhen-2's output is empty. Please check file 'pph2-log.txt' "
"in the output folder for error messages from PolyPhen-2. \n"
"Typical errors include: \n"
"1) query contains *non-human* variants \n"
"2) variants' format is incorrect (e.g. "
'"UniprotID pos wt_aa mut_aa") \n'
"3) wild-type amino acids are in the wrong position on the "
"sequence (please refer to Uniprot's canonical isoform) \n"
"4) Uniprot accession number is not recognized by PolyPhen-2. \n"
)
raise RuntimeError(msg)
# define a structured array
pl_dtype = np.dtype([(col, 'U25') for col in pph2_columns])
Expand Down
11 changes: 9 additions & 2 deletions rhapsody/features/Uniprot.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ def queryUniprot(*args, n_attempts=3, dt=1, **kwargs):
attempt = 0
while attempt < n_attempts:
try:
print(f'attempt {attempt}')
_ = openURL('http://www.uniprot.org/')
break
except:
LOGGER.info(
f'Attempt {attempt} to contact www.uniprot.org failed')
attempt += 1
time.sleep((attempt+1)*dt)
else:
Expand Down Expand Up @@ -172,7 +173,13 @@ def alignCustomPDB(self, PDB, chain='all', title=None, recover=False):
assert isinstance(title, str) or title is None
# parse/import pdb and assign title
if isinstance(PDB, str):
pdb = pd.parsePDB(PDB, subset='calpha')
try:
pdb = pd.parsePDB(PDB, subset='calpha')
except Exception as e:
msg = (
'Unable to import PDB: PDB ID might be invalid or '
f'PDB file might be corrupted. Error message: {e}')
LOGGER.error(msg)
if title is None:
title = os.path.basename(PDB.strip())
title = title.replace(' ', '_')
Expand Down
2 changes: 1 addition & 1 deletion rhapsody/predict/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def getUniqueSAVcoords(self):
except Exception:
LOGGER.warn(
'Invalid Uniprot coordinates at line {}: {}'.format(
i, SAV['unique SAV coords']))
i, SAV['unique SAV coords']))
uSAVcoords[i] = tuple(['?', '?', '?', -999, '?', '?'])
return uSAVcoords

Expand Down
2 changes: 1 addition & 1 deletion rhapsody/predict/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def rhapsody(query, query_type='SAVs',
:type custom_PDB: str, :class:`AtomGroup`
:arg force_env: force a specific environment model for GNM/ANM
calculations, among ``'chain'``, ``'reduced'`` and ``'PolyPhen2'``.
calculations, among ``'chain'``, ``'reduced'`` and ``'sliced'``.
If **None** (default), the model of individual dynamical features will
match that found in the classifier's feature set
:type force_env: str
Expand Down

0 comments on commit 483ef2c

Please sign in to comment.