Skip to content

Conversation

@kose-y
Copy link
Member

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

No description provided.

src/iterator.jl Outdated
VCFRow
end

function Base.iterate(itr::VCFIterator, state=1)
Copy link
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.

src/iterator.jl Outdated
if state <= 0 || state > rows
return nothing
else
reader = VCF.Reader(openvcf(itr.vcffile, "r"))
Copy link
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.

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

for record in reader
Copy link
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