Refactor utils.py: add GvfFileReader class - #52
Open
khetherin wants to merge 13 commits into
Open
Conversation
tcezard
reviewed
Aug 1, 2026
| if not line.startswith("#"): | ||
| f_list = line.rstrip().split("\t") | ||
| yield GvfFeatureline(f_list[0], f_list[1], f_list[2], f_list[3], f_list[4], f_list[5], f_list[6], f_list[7], f_list[8]) | ||
| class GvfFileReader: |
Member
There was a problem hiding this comment.
If you are going to create a reader class, you might as well make it pythoninc and implement __iter__ to make it iterable. That would allow you to user is like.
for gvf_line in gvf_file_reader:
...…base, check_ref, get_alt)
Collaborator
Author
|
Merge conflicts have been resolved, ready for review. |
apriltuesday
approved these changes
Aug 6, 2026
Comment on lines
+288
to
+289
| for _ in header_reader: | ||
| break # stops at first data line |
There was a problem hiding this comment.
For this you can also do
Suggested change
| for _ in header_reader: | |
| break # stops at first data line | |
| next(header_reader) |
| # fresh instance | ||
| gvf_reader = GvfFileReader(self.input_file) | ||
| reader_iter = iter(gvf_reader) | ||
| reader_iter = iter(gvf_reader) |
There was a problem hiding this comment.
Suggested change
| reader_iter = iter(gvf_reader) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Another minor PR to refactor utils.py, this time to pull read_in_gvf_header and read_in_gvf_data into a GvfFileReader class.
Files changed: