Skip to content

Add tskit CLI #374

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add tskit CLI #374

wants to merge 2 commits into from

Conversation

benjeffery
Copy link
Contributor

Here's a sketch of how the tskit CLI could look. I'll add tests once were happy with it.

@coveralls
Copy link
Collaborator

coveralls commented May 9, 2025

Coverage Status

coverage: 98.088% (-0.05%) from 98.142%
when pulling 8e8bd98 on benjeffery:tskit-cli
into 6708eb1 on sgkit-dev:main.

Copy link
Contributor

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - let's ditch ploidy though, it's not worth the complexity.

bio2zarr/cli.py Outdated
@click.command(name="convert")
@click.argument("ts_path", type=click.Path(exists=True))
@click.argument("zarr_path", type=click.Path())
@click.option(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not bother with ploidy - we only support tskit files that have individuals here. Older files can go through the tskit VCF route, or just add the appropriate individuals.

bio2zarr/cli.py Outdated
setup_logging(verbose)
check_overwrite_dir(zarr_path, force)

import tskit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, we don't need to bother importing tskit here or specifying the individuals_nodes, we just pass in the ts_path

@benjeffery benjeffery force-pushed the tskit-cli branch 2 times, most recently from 56497d4 to c3606b2 Compare May 9, 2025 09:27
@benjeffery
Copy link
Contributor Author

Ok, pushed a new commit that makes individuals_nodes an optional argument to the convert function, defaulting to using ts.individuals_nodes. An error is fired if the default is used and are no individuals.

The CLI code now doesn't need to import tskit and ploidy is removed.

@jeromekelleher
Copy link
Contributor

Great, let's build on this

@benjeffery benjeffery force-pushed the tskit-cli branch 5 times, most recently from fca4836 to db316cf Compare May 9, 2025 13:06
@benjeffery
Copy link
Contributor Author

Ok, tests added and other tests modified for new individuals_nodes behaviour.

@benjeffery benjeffery marked this pull request as ready for review May 9, 2025 13:15
@jeromekelleher
Copy link
Contributor

Need to cover num_individuals == 0 error, good to merge after that

@benjeffery
Copy link
Contributor Author

Test added

@jeromekelleher jeromekelleher enabled auto-merge May 9, 2025 16:15
@jeromekelleher
Copy link
Contributor

Looks like this needs a rebase, we've got a conflict

@benjeffery benjeffery force-pushed the tskit-cli branch 2 times, most recently from b3af8d0 to dcb6629 Compare May 10, 2025 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants