Closed Npaffen closed 3 months ago
Without more of your program I am not entirely sure if what you are trying to do will work.
Here is what I think is wrong with processOrigin
Put the file closing clean up code at the end of the function, outside of the while loop. Otherwise it may not be called and the filestream will not be flushed. I would also move the destroy functions till after the close ones. It may not make a difference but it is probably safer.
Move everything inside the if(line_count == 0)
to before the while loop, you only need to call it once.
I don't know what if (rec->unpacked == 0)
is meant to achieve.
There is probably other stuff but with the code fragments you have provided it is difficult to see how it fits together.
No response, closing.
I want to adjust the genotype of some large sample size vcf file by using global ancestry results. I have ancestry results for x origins so I want to recreate my vcf file with adjusted genotypes for those x origins. Since the filepointer in htslib are not threadsafe I used the POSIX library to create threads containing individual filepointer for each thread and then read the vcf, adjust the genotypes and write the vcf back to disk. Right now it looks like this:
with
processOrigin
:The output however seems to be truncated see:
It looks like there is a problem with the bcf_write function or, more likely, I made a mistake in my multi-threading logic. My singel-threading code is working without problems but since the file of tsvLines is very large I would like to read the file only once then use it in each thread to save some time.