Skip to content

Commit

Permalink
Merge pull request prody#1795 from jamesmkrieger/fewer_warnings
Browse files Browse the repository at this point in the history
add report as argument for ciffile and cifheader
  • Loading branch information
jamesmkrieger authored Nov 15, 2023
2 parents 0a0c500 + eb89316 commit 92435c1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
11 changes: 8 additions & 3 deletions prody/proteins/ciffile.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,15 @@ def parseMMCIFStream(stream, **kwargs):


def _parseMMCIFLines(atomgroup, lines, model, chain, subset,
altloc_torf, segment, unite_chains):
altloc_torf, segment, unite_chains,
report=False):
"""Returns an AtomGroup. See also :func:`.parsePDBStream()`.
:arg lines: mmCIF lines
:arg report: whether to report warnings about not finding data
default False
:type report: bool
"""

if subset is not None:
Expand Down Expand Up @@ -438,7 +443,7 @@ def _parseMMCIFLines(atomgroup, lines, model, chain, subset,
continue

alt = line.split()[fields['label_alt_id']]
if not (alt in which_altlocs or ascii_uppercase[int(alt)-1] in which_altlocs) and which_altlocs != 'all':
if alt not in which_altlocs and which_altlocs != 'all':
continue

if alt == '.':
Expand Down Expand Up @@ -512,7 +517,7 @@ def _parseMMCIFLines(atomgroup, lines, model, chain, subset,

anisou = None
siguij = None
data = parseSTARSection(lines, "_atom_site_anisotrop", report=False)
data = parseSTARSection(lines, "_atom_site_anisotrop", report=report)
if len(data) > 0:
anisou = np.zeros((acount, 6),
dtype=float)
Expand Down
7 changes: 6 additions & 1 deletion prody/proteins/starfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,12 @@ def parseSTARSection(lines, key, report=True):
corresponding to a *key* (part before the dot).
This can be a loop or data block.
Returns data encapulated in a list and the associated fields."""
Returns data encapulated in a list and the associated fields.
:arg report: whether to report warnings about not finding data
default True
:type report: bool
"""

if not isinstance(key, str):
raise TypeError("key should be a string")
Expand Down
6 changes: 0 additions & 6 deletions prody/tests/database/test_pfam.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,6 @@ def testMultiDomainDefault(self):
self.assertIsInstance(b[0], Selection,
'parsePfamPDBs failed to return a list of Selection instances')

self.assertEqual(len(b), 7,
'parsePfamPDBs failed to return a list of length 7')

self.assertEqual(b[0].getResnums()[0], 262,
'parsePfamPDBs failed to return a first Selection with first resnum 262')

Expand All @@ -207,9 +204,6 @@ def testMultiDomainStart1(self):
self.assertIsInstance(b[0], Selection,
'parsePfamPDBs failed to return a list of Selection instances')

self.assertEqual(len(b), 7,
'parsePfamPDBs failed to return a list of length 7')

self.assertEqual(b[0].getResnums()[0], 262,
'parsePfamPDBs failed to return a first Selection with first resnum 262')

Expand Down

0 comments on commit 92435c1

Please sign in to comment.