Closed andreforesight closed 4 months ago
I've met the same issue as you have mentioned. filter function may result in mistakes. It may results from generator feature. See here: [https://daler.github.io/pybedtools/FAQs.html#i-m-getting-an-empty-bedtool]()
Right, this is expected behavior which can save a lot on I/O and memory. Checking the length will consume the generator. but if you want to store a copy then you need to use .saveas()
as you've done in your example.
I am filtering a bed on length, but when I look at the bed length after that it makes the bed empty. A small reproducible example is:
Yields
So the first length after that works, but the one after breaks it. If I add a
saveas
it seems to work:Yields the expected