Skip to content
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

Add contig header to VCF #426

Merged
merged 1 commit into from
Feb 5, 2024
Merged

Add contig header to VCF #426

merged 1 commit into from
Feb 5, 2024

Conversation

currocam
Copy link
Contributor

@currocam currocam commented Feb 5, 2024

Hi!

Thanks for this amazing software! I have a question related to VCF files. Is there any reason not include the contig header in the VCF file? According to the VCF spec, "it is highly recommended (but not required) that the header include tags describing the contigs referred to in the VCF file".

For example, I found it necessary when filtering the VCF file using bcftools. I made a simple example: model_vcf.txt

slim model_vcf.txt
 # creates results.vcf 
bcftools view --samples i1,i2 < results.vcf

The previous chunk of code gives me the error:

#CHROM  POS     ID      REF     ALT     QUAL    FILTER  INFO    FORMAT  i1      i2
[W::vcf_parse] Contig '1' is not defined in the header. (Quick workaround: index the file with tabix.)
Undefined tags in the header, cannot proceed in the sample subset mode.

As far as I understand from the source code, the CHROM column is fixed to be 1).

Would not the PR I made do the trick (although maybe it is a bit pretentious to say that a single line is a PR)?I built it locally (using the code snipped from the TO_DO file) and do some minimal testing:

mkdir build
cd build
cmake ..
make
./slim model_vcf.txt # creates results.vcf 
bcftools view --samples i1,i2 < results.vcf

I'm not sure if it is a breaking change, but the tests from the command line still works. I tried:

./slim -testEidos
SUCCESS count: 6885

and

./slim -testEidos
SUCCESS count: 36435

Please, let me know if I misunderstood something.

Best,
Curro

@bhaller
Copy link
Contributor

bhaller commented Feb 5, 2024

I don't know that much about VCF, but it seems reasonable to me. Thanks!

@bhaller bhaller merged commit 3eb134e into MesserLab:master Feb 5, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants