allpy
changeset 1121:835b55bfc6b2
structure.py: add error messages to asserts
author | Boris Nagaev <bnagaev@gmail.com> |
---|---|
date | Fri, 21 Dec 2012 15:04:53 +0400 |
parents | c9fa6904e3d0 |
children | 5f9c14e679c1 |
files | allpy/structure.py |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line diff
1.1 --- a/allpy/structure.py Wed Nov 28 18:26:43 2012 +0400 1.2 +++ b/allpy/structure.py Fri Dec 21 15:04:53 2012 +0400 1.3 @@ -198,8 +198,11 @@ 1.4 central_pdb.append(m) 1.5 if m is central_stop: 1.6 break 1.7 - assert len(set(central_pdb) - set(matched_pdb)) <= max_waste_in_pdb 1.8 - assert len(matched_pdb) >= min_match 1.9 + assert len(set(central_pdb) - set(matched_pdb)) <= max_waste_in_pdb,\ 1.10 + "too much waste in matched pdb (%i > %i)" %\ 1.11 + (len(set(central_pdb) - set(matched_pdb)), max_waste_in_pdb) 1.12 + assert len(matched_pdb) >= min_match,\ 1.13 + "too short match (%i < %i)" % (len(matched_pdb), min_match) 1.14 1.15 def pdb_unload(self): 1.16 """ Delete all pdb-connected links """ 1.17 @@ -238,7 +241,7 @@ 1.18 TODO: conformity_file 1.19 """ 1.20 match = pdb_id_parse(self.name) 1.21 - assert match 1.22 + assert match, "Can't parse seq id: %s" % self.name 1.23 if 'path' in match and read_local: 1.24 code = 'path' 1.25 pdb_file = open(match['path'])