|
10 | 10 |
|
11 | 11 | from . import icf as icf_mod
|
12 | 12 | from . import plink, provenance, vcf_utils
|
| 13 | +from . import tskit as tskit_mod |
13 | 14 |
|
14 | 15 | logger = logging.getLogger(__name__)
|
15 | 16 |
|
@@ -630,3 +631,52 @@ def vcfpartition(vcfs, verbose, num_partitions, partition_size):
|
630 | 631 | )
|
631 | 632 | for region in regions:
|
632 | 633 | click.echo(f"{region}\t{vcf_path}")
|
| 634 | + |
| 635 | + |
| 636 | +@click.command(name="convert") |
| 637 | +@click.argument("ts_path", type=click.Path(exists=True)) |
| 638 | +@click.argument("zarr_path", type=click.Path()) |
| 639 | +@click.option("--contig-id", type=str, help="Contig/chromosome ID (default: '1')") |
| 640 | +@click.option( |
| 641 | + "--isolated-as-missing", is_flag=True, help="Treat isolated nodes as missing" |
| 642 | +) |
| 643 | +@variants_chunk_size |
| 644 | +@samples_chunk_size |
| 645 | +@verbose |
| 646 | +@progress |
| 647 | +@worker_processes |
| 648 | +@force |
| 649 | +def convert_tskit( |
| 650 | + ts_path, |
| 651 | + zarr_path, |
| 652 | + contig_id, |
| 653 | + isolated_as_missing, |
| 654 | + variants_chunk_size, |
| 655 | + samples_chunk_size, |
| 656 | + verbose, |
| 657 | + progress, |
| 658 | + worker_processes, |
| 659 | + force, |
| 660 | +): |
| 661 | + setup_logging(verbose) |
| 662 | + check_overwrite_dir(zarr_path, force) |
| 663 | + |
| 664 | + tskit_mod.convert( |
| 665 | + ts_path, |
| 666 | + zarr_path, |
| 667 | + contig_id=contig_id, |
| 668 | + isolated_as_missing=isolated_as_missing, |
| 669 | + variants_chunk_size=variants_chunk_size, |
| 670 | + samples_chunk_size=samples_chunk_size, |
| 671 | + worker_processes=worker_processes, |
| 672 | + show_progress=progress, |
| 673 | + ) |
| 674 | + |
| 675 | + |
| 676 | +@version |
| 677 | +@click.group(cls=NaturalOrderGroup, name="tskit2zarr") |
| 678 | +def tskit2zarr_main(): |
| 679 | + pass |
| 680 | + |
| 681 | + |
| 682 | +tskit2zarr_main.add_command(convert_tskit) |
0 commit comments