Skip to content

write_vcf returning position 0 #2838

@andrewkern

Description

@andrewkern

hey team-

working with @mufernando on some stdpopsim coding we stumbled upon a bug with write_vcf. using the default position_transform value, write_vcf can return position 0 which isn't allowed under the vcf spec i believe. e.g., this tree sequence

print(ts.tables.sites)
╔═════╤════════╤═══════════════╤════════╗
║id   │position│ancestral_state│metadata║
╠═════╪════════╪═══════════════╪════════╣
║0    │       0│              C│        ║
║1    │     534│              C│        ║
║2    │     991│              T│        ║
║3    │    1188│              G│        ║
║4    │    1281│              C│        ║
║5    │    1301│              A│        ║

will return the following vcf

##fileformat=VCFv4.2
##source=tskit 0.5.5
##FILTER=<ID=PASS,Description="All filters passed">
##contig=<ID=1,length=5000000>
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	tsk_0	tsk_1	tsk_2	tsk_3	tsk_4	tsk_5	tsk_6	tsk_7	tsk_8	tsk_9	tsk_10	tsk_11	tsk_12	tsk_13	tsk_14	tsk_15	tsk_16	tsk_17	tsk_18	tsk_19
1	0	0	C	G	.	PASS	.	GT	0|0	0|0	0|0	0|0	0|0	0|0	0|0	1|0	0|0	0|0	0|0	0|0	0|0	0|0	0|0	0|0	0|0	0|0	0|0	0|0
1	534	1	C	G	.	PASS	.	GT	0|0	0|0	0|0	0|0	0|0	0|0	0|0	0|0	0|0	0|0	0|0	0|0	0|0	0|0	0|1	0|0	0|0	0|0	0|0	0|0
1
.
.
.

i'm guessing we should not have been using the default position_transform here but instead legacy? either way i think this is a bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions