-
Notifications
You must be signed in to change notification settings - Fork 5
iterator interface (v0.3) #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
src/iterator.jl
Outdated
| VCFRow | ||
| end | ||
|
|
||
| function Base.iterate(itr::VCFIterator, state=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use VariantCallFormat.Reader as a state instead of an integer.
src/iterator.jl
Outdated
| if state <= 0 || state > rows | ||
| return nothing | ||
| else | ||
| reader = VCF.Reader(openvcf(itr.vcffile, "r")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This opens a VCF file, and if we do this, we are opening/decompressing(vcf.gz) n times from the beginning of the file, which is very slow.
src/iterator.jl
Outdated
| reader = VCF.Reader(openvcf(itr.vcffile, "r")) | ||
| count = 0 | ||
|
|
||
| for record in reader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This for loop should be removed, and each call to this function should be O(N) time, where N is the number of samples. It should be constant in terms of number of genetic variants.
No description provided.