Bug #796
xboa inconsistent features?
100%
Description
Hi,
xboa Hit.new_from_read_builtin seems to not like a formatted file with header lines
whereas
Bunch.new_dict_from_read_builtin assumes header lines and skips them
Feature? Or bug? Or am I missing something?
Attached python script and input files with & without header
Files
Updated by Rogers, Chris about 12 years ago
It's a feature. Hit.new_from_read_builtin reads one "hit", which in most file formats corresponds to a single line. Bunch.new_dict_from_read_builtin reads in an entire bunch or set of bunches, so reads in the entire file. I could imagine some feature in Hit.read_blah to auto-detect when the read is on a header line and ignore it. But the difference is Hit read function is reading line-by-line whereas bunch read function is reading file-by-file.
Does that answer the question?
Updated by Rajaram, Durga about 12 years ago
Thanks.
I realized that Hit.read works line by line but was not sure if it was designed to return an error
on encountering a header line -- instead of maybe skipping or returning something which can interpreted
as a header read; but that's probably more complicated than code just skipping before calling Hit.read
Updated by Rogers, Chris about 12 years ago
- Assignee set to Rogers, Chris
It's difficult because sometimes header lines just don't have a specific format. I would rather throw an error if there is an unexpected string in the input (e.g. nan or inf) and ask the use to skip any header lines. I'll try to update the documentation to make this explicit.
Updated by Rogers, Chris almost 12 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Documentation updated