Skip to content

iterator interface (v0.3)#34

Draft
kose-y wants to merge 26 commits into
OpenMendel:masterfrom
kaitlynmarlor:v0.3
Draft

iterator interface (v0.3)#34
kose-y wants to merge 26 commits into
OpenMendel:masterfrom
kaitlynmarlor:v0.3

Conversation

@kose-y

@kose-y kose-y commented Jul 21, 2023

Copy link
Copy Markdown
Member

No description provided.

Comment thread src/iterator.jl Outdated
VCFRow
end

function Base.iterate(itr::VCFIterator, state=1)

Copy link
Copy Markdown
Member Author

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.

Comment thread src/iterator.jl Outdated
if state <= 0 || state > rows
return nothing
else
reader = VCF.Reader(openvcf(itr.vcffile, "r"))

Copy link
Copy Markdown
Member Author

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.

Comment thread src/iterator.jl Outdated
reader = VCF.Reader(openvcf(itr.vcffile, "r"))
count = 0

for record in reader

Copy link
Copy Markdown
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants