-
Notifications
You must be signed in to change notification settings - Fork 7
/
vcf_generator.py
31 lines (24 loc) · 959 Bytes
/
vcf_generator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Development script to automate generating multi-contig
# VCFs of various lenghts for testing the indexing code.
# TODO should move to a "scripts" directory or something
import sys
import click
def write_header(num_contigs):
click.echo("##fileformat=VCFv4.2")
click.echo(f"##source={' '.join(sys.argv)}")
click.echo('##FILTER=<ID=PASS,Description="All filters passed">')
for contig in range(num_contigs):
click.echo(f"##contig=<ID={contig}>")
header = "\t".join(["#CHROM", "POS", "ID", "REF", "ALT", "QUAL", "FILTER", "INFO"])
click.echo(header)
@click.command
@click.argument("contigs", type=int)
@click.argument("rows-per-contig", type=int)
def cli(contigs, rows_per_contig):
write_header(contigs)
for j in range(contigs):
for k in range(rows_per_contig):
pos = str(k + 1)
click.echo("\t".join([str(j), pos, "A", "T", ".", ".", ".", "."]))
if __name__ == "__main__":
cli()