biopython/biopython — pull request #166 by bow (2013-02-28 07:34:06+00:00)
Title: SearchIO improvements

This pull request was triggered by https://redmine.open-bio.org/issues/3400

There are several changes in the object model, which now allows for empty Hit objects and more consistent __init__ between QueryResult and Hit. To summarize:

1. QueryResult can now be created with or without an ID:

```python
qresult = QueryResult('my_id') # empty object
qresult = QueryResult([list_of_hits]) # filled object, ID retrieved from hits
qresult = QueryResult([list_of_hits], id='my_id') # filled object, ID retrieved from hits and has to be 'my_id'
```

2. Hit behaves similary, except there's another `query_id` parameter in its `__init__`.

3. The default ID and description values for `QueryResult` and `Hit` have been changed from strings to `None` so it's easier to do the validation. If the values are None, these objects will set their ID and description from its contained items. Otherwise, an error is raised.

4. The validations in both cascading property functions (`optionalcascade` and `fullcascade`) have been refactored out into the SearchIO objects. This was done mainly because I was starting to see the SearchIO test suite slowing down when the cascaders handle validation (~41 seconds vs ~12 seconds without validation).

5. `partialcascade` has been merged into `optionalcascade`, since they overlap a lot.