Skip to content

cli

Module contains command line entry point function.

annotations_csv

annotations_csv(ctx: Context, chromosome: str, position: str, reference: str, alternative: str, info: list[str], separator: str = ',') -> None

Convert annotations store in csv file to compatible parquet file.

Source code in src/variantplaner/cli.py
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
@annotations_main.command("csv")
@click.pass_context
@click.option(
    "-c",
    "--chromosome",
    help="Name of chromosome column",
    type=str,
    required=True,
)
@click.option(
    "-p",
    "--position",
    help="Name of position column",
    type=str,
    required=True,
)
@click.option(
    "-r",
    "--reference",
    help="Name of reference column",
    type=str,
    required=True,
)
@click.option(
    "-a",
    "--alternative",
    help="Name of alternative column",
    type=str,
    required=True,
)
@click.option(
    "-i",
    "--info",
    multiple=True,
    help="List of columns that are kept if this list is empty all columns are kept",
    type=str,
)
@click.option(
    "-s",
    "--separator",
    help="Single byte character to use as delimiter in the file",
    type=str,
    default=",",
    show_default=True,
)
def annotations_csv(
    ctx: click.Context,
    chromosome: str,
    position: str,
    reference: str,
    alternative: str,
    info: list[str],
    separator: str = ",",
) -> None:
    """Convert annotations store in csv file to compatible parquet file."""
    logger = logging.getLogger("annotations-vcf")

    ctx.ensure_object(dict)

    input_path = ctx.obj["input_path"]
    output_path = ctx.obj["output_path"]
    chrom2length_path = ctx.obj["chrom2length_path"]

    logger.debug(
        f"parameter: {input_path=} {output_path=} {chrom2length_path=} {chromosome=} {position=} {reference=} {alternative=} {info=}",
    )

    lf = io.csv.into_lazyframe(
        input_path,
        chrom2length_path,
        chromosome,
        position,
        reference,
        alternative,
        info,
        separator=separator,
        dtypes={chromosome: polars.Utf8},
    )

    lf = lf.drop([chromosome, position, reference, alternative])

    lf.collect(streaming=True).write_parquet(output_path)

annotations_main

annotations_main(ctx: Context, input_path: Path, output_path: Path, chrom2length_path: Path) -> None

Convert an annotation variation file in a compatible parquet.

Source code in src/variantplaner/cli.py
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
@main.group("annotations")
@click.pass_context
@click.option(
    "-i",
    "--input-path",
    help="Path to input file",
    type=click.Path(
        exists=True,
        dir_okay=False,
        readable=True,
        allow_dash=True,
        path_type=pathlib.Path,
    ),
    required=True,
)
@click.option(
    "-o",
    "--output-path",
    help="Path where variants annotations will be written in parquet",
    type=click.Path(writable=True, path_type=pathlib.Path),
    required=True,
)
@click.option(
    "-c",
    "--chrom2length-path",
    help="CSV file that associates a chromosome name with its size",
    type=click.Path(dir_okay=False, writable=True, path_type=pathlib.Path),
    required=True,
)
def annotations_main(
    ctx: click.Context,
    input_path: pathlib.Path,
    output_path: pathlib.Path,
    chrom2length_path: pathlib.Path,
) -> None:
    """Convert an annotation variation file in a compatible parquet."""
    logger = logging.getLogger("annotations")

    ctx.obj = {
        "input_path": input_path,
        "output_path": output_path,
        "chrom2length_path": chrom2length_path,
    }

    logger.debug(f"parameter: {input_path=} {output_path=} {chrom2length_path=}")

annotations_vcf

annotations_vcf(ctx: Context, info: set[str] | None = None, rename_id: str | None = None) -> None

Convert a vcf file with INFO field in compatible parquet file.

Source code in src/variantplaner/cli.py
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
@annotations_main.command("vcf")
@click.pass_context
@click.option(
    "-i",
    "--info",
    multiple=True,
    help="List of info fields that are kept if this list is empty all fields are kept only the first vcf file header is read",
    type=str,
)
@click.option(
    "-r",
    "--rename-id",
    help="Set column name of variant id",
    type=str,
)
def annotations_vcf(
    ctx: click.Context,
    info: set[str] | None = None,
    rename_id: str | None = None,
) -> None:
    """Convert a vcf file with INFO field in compatible parquet file."""
    logger = logging.getLogger("annotations-vcf")

    ctx.ensure_object(dict)

    input_path = ctx.obj["input_path"]
    output_path = ctx.obj["output_path"]
    chrom2length_path = ctx.obj["chrom2length_path"]

    logger.debug(f"parameter: {input_path=} {output_path=} {chrom2length_path=} {info=} {rename_id}")

    try:
        vcf_header = io.vcf.extract_header(input_path)
        info_parser = io.vcf.info2expr(vcf_header, input_path, info)
        lf = io.vcf.into_lazyframe(input_path, chrom2length_path)
    except exception.NotAVCFError:
        logger.exception("")
        sys.exit(21)

    lf = lf.with_columns(info_parser).drop(["chr", "pos", "ref", "alt", "filter", "qual", "info"])

    if rename_id:
        logger.info(f"Rename vcf variant id in {rename_id}")
        lf = lf.rename({"vid": rename_id})

    lf.collect(streaming=True).write_parquet(output_path)

generate_main

generate_main() -> None

Generate information.

Source code in src/variantplaner/cli.py
712
713
714
715
716
717
@main.group("generate")
def generate_main() -> None:
    """Generate information."""
    logger = logging.getLogger("generate")

    logger.debug("parameter: ")

generate_transmission

generate_transmission(input_path: Path, ped_path: Path | None, index: str | None, mother: str | None, father: str | None, transmission_path: Path) -> None

Generate transmission file from genotypes and pedigree.

Source code in src/variantplaner/cli.py
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
@generate_main.command("transmission")
@click.option(
    "-i",
    "--input-path",
    help="Path genotypes parquet file",
    type=click.Path(
        exists=True,
        dir_okay=False,
        readable=True,
        allow_dash=True,
        path_type=pathlib.Path,
    ),
    required=True,
)
@click.option(
    "-p",
    "--ped-path",
    help="Path to the ped file",
    type=click.Path(exists=True, dir_okay=False, readable=True, path_type=pathlib.Path),
)
@click.option(
    "-I",
    "--index",
    help="Sample name of index",
    type=str,
)
@click.option(
    "-m",
    "--mother",
    help="Sample name of mother",
    type=str,
)
@click.option(
    "-f",
    "--father",
    help="Sample name of father",
    type=str,
)
@click.option(
    "-t",
    "--transmission-path",
    help="Path transmission mode will be store",
    type=click.Path(dir_okay=False, writable=True, path_type=pathlib.Path),
)
def generate_transmission(
    input_path: pathlib.Path,
    ped_path: pathlib.Path | None,
    index: str | None,
    mother: str | None,
    father: str | None,
    transmission_path: pathlib.Path,
) -> None:
    """Generate transmission file from genotypes and pedigree."""
    logger = logging.getLogger("generate-origin")

    logger.debug(f"parameter: {input_path=} {ped_path=} {index=} {mother=} {father=} {transmission_path=}")

    genotypes_lf = polars.scan_parquet(input_path)

    if ped_path:
        ped_lf = io.ped.into_lazyframe(ped_path)
        transmission_lf = generate.transmission_ped(genotypes_lf, ped_lf)
    elif index and mother and father:
        transmission_lf = generate.transmission(genotypes_lf, index, mother, father)
    else:
        logging.error("You must specify ped file or index, mother and father sample name")
        sys.exit(31)

    transmission_lf.write_parquet(transmission_path)

main

main(*, threads: int = 1, verbose: int = 0, debug_info: bool = False) -> None

Run VariantPlanner.

Source code in src/variantplaner/cli.py
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
@click.group(name="variantplaner")
@click.option(
    "-t",
    "--threads",
    help="Number of threads usable",
    default=1,
    type=click.IntRange(0),
    show_default=True,
)
@click.option("-v", "--verbose", help="Verbosity level", count=True, type=click.IntRange(0, 4))
@click.option(
    "--debug-info",
    help="Get debug information",
    is_flag=True,
    show_default=True,
    default=False,
)
def main(*, threads: int = 1, verbose: int = 0, debug_info: bool = False) -> None:
    """Run VariantPlanner."""
    logging.basicConfig(
        style="{",
        format="{asctime} - {name}:{levelname}: {message}",
        encoding="utf-8",
        level=(4 - verbose) * 10,  # Python choose a bad logging levels order
        stream=sys.stderr,
    )

    logger = logging.getLogger("main")

    logger.debug(f"parameter: {threads=} {verbose=} {debug_info=}")

    if debug_info:
        debug.print_info()
        sys.exit(0)

    polars.set_random_seed(42)
    os.environ["POLARS_MAX_THREADS"] = str(threads)

metadata

metadata(ctx: Context, input_path: Path, output_path: Path) -> None

Convert metadata file in parquet file.

Source code in src/variantplaner/cli.py
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
@main.group()
@click.pass_context
@click.option(
    "-i",
    "--input-path",
    help="Path to input file",
    type=click.Path(
        exists=True,
        dir_okay=False,
        readable=True,
        allow_dash=True,
        path_type=pathlib.Path,
    ),
    required=True,
)
@click.option(
    "-o",
    "--output-path",
    help="Path where variants annotations will be written in parquet",
    type=click.Path(writable=True, path_type=pathlib.Path),
    required=True,
)
def metadata(ctx: click.Context, input_path: pathlib.Path, output_path: pathlib.Path) -> None:
    """Convert metadata file in parquet file."""
    logger = logging.getLogger("metadata")

    ctx.obj = {"input_path": input_path, "output_path": output_path}

    logger.debug(f"parameter: {input_path=} {output_path=}")

metadata_csv

metadata_csv(ctx: Context, columns: list[str], separator: str = ',') -> None

Convert metadata csv file in parquet file.

Source code in src/variantplaner/cli.py
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
@metadata.command("csv")
@click.pass_context
@click.option(
    "-c",
    "--columns",
    multiple=True,
    help="List of columns that are kept if this list is empty all columns are kept",
    type=str,
)
@click.option(
    "-s",
    "--separator",
    help="Single byte character to use as delimiter in the file",
    type=str,
    default=",",
    show_default=True,
)
def metadata_csv(ctx: click.Context, columns: list[str], separator: str = ",") -> None:
    """Convert metadata csv file in parquet file."""
    logger = logging.getLogger("metadata-csv")

    ctx.ensure_object(dict)

    input_path = ctx.obj["input_path"]
    output_path = ctx.obj["output_path"]

    logger.debug(f"parameter: {input_path=} {output_path=} {columns=}")

    lf = polars.scan_csv(input_path, separator=separator)

    if columns:
        lf = lf.select(columns)

    lf.sink_parquet(output_path, maintain_order=False)

metadata_json

metadata_json(ctx: Context, fields: list[str], json_line: bool) -> None

Convert metadata json file in parquet file.

Source code in src/variantplaner/cli.py
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
@metadata.command("json")
@click.pass_context
@click.option(
    "-f",
    "--fields",
    multiple=True,
    help="List of fields that are kept if this list is empty all fields are kept",
    type=str,
)
@click.option(
    "-l",
    "--json-line",
    help="Input are in json lines format",
    type=bool,
    is_flag=True,
)
def metadata_json(
    ctx: click.Context,
    fields: list[str],
    json_line: bool,  # noqa: FBT001 it's a cli function with flag input
) -> None:
    """Convert metadata json file in parquet file."""
    logger = logging.getLogger("metadata-json")

    ctx.ensure_object(dict)

    input_path = ctx.obj["input_path"]
    output_path = ctx.obj["output_path"]

    logger.debug(f"parameter: {input_path=} {output_path=} {fields=}")

    lf = polars.read_ndjson(input_path) if json_line else polars.read_json(input_path)

    if fields:
        lf = lf.select(fields)

    lf.write_parquet(output_path)

parquet2vcf

parquet2vcf(input_path: Path, output: Path, genotypes_path: Path | None = None, chromosome: str = 'chr', position: str = 'pos', identifier: str = 'id', reference: str = 'ref', alternative: str = 'alt', quality: str | None = None, filter_col: str | None = None, format_str: str | None = None) -> None

Convert some parquet file in vcf.

Source code in src/variantplaner/cli.py
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
@main.command()
@click.option(
    "-i",
    "--input-path",
    help="Path to variants in parquet format",
    type=click.Path(
        exists=True,
        dir_okay=False,
        readable=True,
        allow_dash=True,
        path_type=pathlib.Path,
    ),
    required=True,
)
@click.option(
    "-g",
    "--genotypes-path",
    help="Path to genotypes in parquet format",
    type=click.Path(exists=True, dir_okay=False, readable=True, path_type=pathlib.Path),
)
@click.option(
    "-o",
    "--output",
    help="Path where the vcf is written",
    type=click.Path(dir_okay=False, writable=True, path_type=pathlib.Path),
    required=True,
)
@click.option(
    "-c",
    "--chromosome",
    help="Name of chromosome column",
    type=str,
    default="chr",
    show_default=True,
)
@click.option(
    "-p",
    "--position",
    help="Name of position column",
    type=str,
    default="pos",
    show_default=True,
)
@click.option(
    "-I",
    "--identifier",
    help="Name of identity column",
    type=str,
    default="id",
    show_default=True,
)
@click.option(
    "-r",
    "--reference",
    help="Name of reference column",
    default="ref",
    show_default=True,
)
@click.option(
    "-a",
    "--alternative",
    help="Name of alternative column",
    default="alt",
    show_default=True,
)
@click.option(
    "-q",
    "--quality",
    help="Name of quality column",
    type=str,
)
@click.option(
    "-f",
    "--filter",
    "filter_col",
    help="Name of filter column",
    type=str,
)
@click.option(
    "-F",
    "--format",
    "format_str",
    help="Value of format column",
    type=str,
)
def parquet2vcf(
    input_path: pathlib.Path,
    output: pathlib.Path,
    genotypes_path: pathlib.Path | None = None,
    chromosome: str = "chr",
    position: str = "pos",
    identifier: str = "id",
    reference: str = "ref",
    alternative: str = "alt",
    quality: str | None = None,
    filter_col: str | None = None,
    format_str: str | None = None,
) -> None:
    """Convert some parquet file in vcf."""
    logger = logging.getLogger("parquet2vcf")

    logger.debug(f"parameter: {input_path=} {output=}")

    variants_lf = polars.scan_parquet(input_path)

    if genotypes_path and format_str:
        genotypes_lf = polars.scan_parquet(genotypes_path)
        sample_name = genotypes_lf.select("sample").collect().get_column("sample").to_list()
        merge_lf = extract.merge_variants_genotypes(variants_lf, genotypes_lf, sample_name)
        sample2vcf_col2polars_col: dict[str, dict[str, str]] = {}
        for sample in sample_name:
            sample2vcf_col2polars_col[sample] = {}
            for format_col in format_str.split(":"):
                sample2vcf_col2polars_col[sample][format_col] = f"{sample}_{format_col.lower()}"

        io.vcf.from_lazyframe(
            merge_lf,
            output,
            io.vcf.build_rename_column(
                chromosome,
                position,
                identifier,
                reference,
                alternative,
                quality,
                filter_col,
                [],
                format_str,
                sample2vcf_col2polars_col,
            ),
        )
    else:
        io.vcf.from_lazyframe(
            variants_lf,
            output,
            io.vcf.build_rename_column(
                chromosome,
                position,
                identifier,
                reference,
                alternative,
                quality,
                filter_col,
            ),
        )

struct_genotypes

struct_genotypes(ctx: Context, prefix_path: Path, file_per_thread: int) -> None

Convert set of genotype parquet in hive like files structures.

Source code in src/variantplaner/cli.py
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
@struct_main.command("genotypes")
@click.pass_context
@click.option(
    "-p",
    "--prefix-path",
    help="Path prefix",
    type=click.Path(file_okay=False, dir_okay=True, path_type=pathlib.Path),
    required=True,
)
@click.option(
    "-f",
    "--file-per-thread",
    help="Number of file manage by one threads",
    type=click.IntRange(1),
    default=15,
)
def struct_genotypes(ctx: click.Context, prefix_path: pathlib.Path, file_per_thread: int) -> None:
    """Convert set of genotype parquet in hive like files structures."""
    logger = logging.getLogger("struct.genotypes")

    ctx.ensure_object(dict)

    input_paths = ctx.obj["input_paths"]

    threads = int(os.environ["POLARS_MAX_THREADS"])
    if threads == 1:
        os.environ["POLARS_MAX_THREADS"] = "1"
    else:
        threads //= 2
        os.environ["POLARS_MAX_THREADS"] = "2"

    logger.debug(f"parameter: {prefix_path=}")

    struct.genotypes.hive(input_paths, prefix_path, threads=threads, file_per_thread=file_per_thread)

struct_main

struct_main(ctx: Context, input_paths: list[Path]) -> None

Subcommand to made struct operation on parquet file.

Source code in src/variantplaner/cli.py
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
@main.group("struct")
@click.pass_context
@click.option(
    "-i",
    "--input-paths",
    help="Paths of the variant files to be merged",
    multiple=True,
    type=click.Path(exists=True, dir_okay=False, readable=True, path_type=pathlib.Path),
    required=True,
)
def struct_main(ctx: click.Context, input_paths: list[pathlib.Path]) -> None:
    """Subcommand to made struct operation on parquet file."""
    logger = logging.getLogger("struct")

    ctx.obj = {"input_paths": input_paths}

    logger.debug(f"parameter: {input_paths=}")

struct_variants

struct_variants(ctx: Context, output_path: Path, bytes_memory_limit: int = 10000000000, polars_threads: int = 4) -> None

Merge multiple variants parquet file in one.

If you set TMPDIR, TEMP or TMP environment variable you can control where temp file is created.

Source code in src/variantplaner/cli.py
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
@struct_main.command("variants")
@click.pass_context
@click.option(
    "-o",
    "--output-path",
    help="Path where merged variants will be written",
    type=click.Path(writable=True, path_type=pathlib.Path),
    required=True,
)
@click.option(
    "-b",
    "--bytes-memory-limit",
    help="Number of bytes used to build chunk of merge file",
    type=click.IntRange(0),
    show_default=True,
    default=10_000_000_000,
)
@click.option(
    "-p",
    "--polars-threads",
    help="Number of threads use to merge one block of file",
    type=click.IntRange(1),
    show_default=True,
    default=4,
)
def struct_variants(
    ctx: click.Context,
    output_path: pathlib.Path,
    bytes_memory_limit: int = 10_000_000_000,
    polars_threads: int = 4,
) -> None:
    """Merge multiple variants parquet file in one.

    If you set TMPDIR, TEMP or TMP environment variable you can control where temp file is created.
    """
    logger = logging.getLogger("struct.variants")

    ctx.ensure_object(dict)

    input_paths = ctx.obj["input_paths"]

    logger.debug(f"parameter: {output_path=} {bytes_memory_limit}")

    struct.variants.merge(input_paths, output_path, bytes_memory_limit, polars_threads)

vcf2parquet

vcf2parquet(input_path: Path, chrom2length_path: Path, variants: Path, genotypes: Path | None, annotations: Path | None, format_string: str = 'GT:AD:DP:GQ') -> None

Convert a vcf in multiple parquet file.

Source code in src/variantplaner/cli.py
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
@main.command()
@click.option(
    "-i",
    "--input-path",
    help="Path to vcf input file",
    type=click.Path(
        exists=True,
        dir_okay=False,
        readable=True,
        allow_dash=True,
        path_type=pathlib.Path,
    ),
    required=True,
)
@click.option(
    "-c",
    "--chrom2length-path",
    help="CSV file that associates a chromosome name with its size",
    type=click.Path(dir_okay=False, writable=True, path_type=pathlib.Path),
    required=True,
)
@click.option(
    "-v",
    "--variants",
    help="Path where the variants will be written in parquet",
    type=click.Path(dir_okay=False, writable=True, path_type=pathlib.Path),
    required=True,
)
@click.option(
    "-g",
    "--genotypes",
    help="Path where the genotypes will be written in parquet",
    type=click.Path(dir_okay=False, writable=True, path_type=pathlib.Path),
)
@click.option(
    "-a",
    "--annotations",
    help="Path where the annotations will be written in parquet (if no info file is empty)",
    type=click.Path(dir_okay=False, writable=True, path_type=pathlib.Path),
)
@click.option(
    "-f",
    "--format-string",
    help="Value of FORMAT column, line not match with this are ignored",
    type=str,
    default="GT:AD:DP:GQ",
    show_default=True,
)
def vcf2parquet(
    input_path: pathlib.Path,
    chrom2length_path: pathlib.Path,
    variants: pathlib.Path,
    genotypes: pathlib.Path | None,
    annotations: pathlib.Path | None,
    format_string: str = "GT:AD:DP:GQ",
) -> None:
    """Convert a vcf in multiple parquet file."""
    logger = logging.getLogger("vcf2parquet")

    logger.debug(
        f"parameter: {input_path=} {chrom2length_path=} {variants=} {genotypes=} {annotations=} {format_string=}",
    )

    try:
        vcf_header = io.vcf.extract_header(input_path)
    except exception.NotAVCFError:
        logger.exception("")
        sys.exit(11)

    # Read vcf and manage structural variant
    lf = io.vcf.into_lazyframe(input_path, chrom2length_path, extension=io.vcf.IntoLazyFrameExtension.MANAGE_SV)

    extract.variants(lf).sink_parquet(variants, maintain_order=False)
    logger.info(f"finish write {variants}")

    if genotypes:
        try:
            genotypes_lf = extract.genotypes(lf, io.vcf.format2expr(vcf_header, input_path), format_string)
        except exception.NoGenotypeError:
            logger.exception("")
            sys.exit(12)

        genotypes_lf.sink_parquet(genotypes, maintain_order=False)

    if annotations:
        annotations_lf = lf.with_columns(io.vcf.info2expr(vcf_header, input_path))
        annotations_lf = annotations_lf.drop(["chr", "pos", "ref", "alt", "filter", "qual", "info"])
        annotations_lf.sink_parquet(annotations, maintain_order=False)

    logger.info(f"finish write {genotypes}")