Skip to content

0.1.0 release bits #228

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

Merged
merged 4 commits into from
May 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## [0.1.0] - 2025-05-29

Improvements:

- Support filtering by FILTER (#217), CHROM (#223) and general string values (#220)
- Support regions (-r/-t), filter expressions (-i/-e) and samples (-s) in query command (#205)
- Various improvements to support VCZ datasets produced from tskit and plink files by bio2zarr.
- Use a fully dynamically generated header via ``vcf_meta_information`` attributes
(#208). Requires vcf-zarr version >= 0.4 (bio2zarr >= 0.1.6) to fully recover the original
header.
- Add --version (#197)

Breaking:

- Update minimum Click version to 8.2.0 (#206)

## [0.0.2] - 2025-04-04

Important bugfixes for filtering language and sample subsetting.
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![CI](https://github.com/sgkit-dev/vcztools/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/sgkit-dev/vcztools/actions/workflows/ci.yml)
[![PyPI Downloads](https://static.pepy.tech/badge/vcztools)](https://pepy.tech/projects/vcztools)

# vcztools
Partial reimplementation of bcftools for [VCF Zarr](https://github.com/sgkit-dev/vcf-zarr-spec/)
Expand All @@ -17,24 +18,24 @@ python3 -m pip install vcztools
```
vcztools view <path.vcz>
```
or
or
```
python -m vcztools view <path.vcz>
```
should be equivalent to running
should be equivalent to running
```
bcftools view <path.vcf.gz>
```

See the [bio2zarr](https://sgkit-dev.github.io/bio2zarr/) project for help in
See the [bio2zarr](https://sgkit-dev.github.io/bio2zarr/) project for help in
converting VCF files to Zarr.

## Goals

Vcztools aims to be a drop-in replacement for a subset of bcftools functionality.
Currently supported are the ``view``, ``query`` and ``index -s/-n`` commands.

We aim for 100% compatibility so if you notice a difference between the output of
We aim for 100% compatibility so if you notice a difference between the output of
vcztools and bcftools please do open an issue.

## Cloud stores
Expand Down Expand Up @@ -62,6 +63,6 @@ python -m vcztools view s3://<bucket-name>/path/to.vcz

## Development

Vcztools is under active development and contributions are warmly welcomed. Please
Vcztools is under active development and contributions are warmly welcomed. Please
see the project on [GitHub](https://github.com/sgkit-dev/vcztools).

23 changes: 23 additions & 0 deletions vcztools/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ def list_commands(self, ctx):
)
@handle_exception
def index(path, nrecords, stats):
"""
Query the number of records in a VCZ dataset. This subcommand only
implements the --nrecords and --stats options and does not build any
indexes.
"""
if nrecords and stats:
raise click.UsageError("Expected only one of --stats or --nrecords options")
if nrecords:
Expand Down Expand Up @@ -156,6 +161,15 @@ def query(
include,
exclude,
):
"""
Transform VCZ into user-defined formats with efficient subsetting and
filtering. Intended as a drop-in replacement for bcftools query, where we
replace the VCF file path with a VCZ dataset URL.

This is an early version and not feature complete: if you are missing a
particular piece of functionality please open an issue at
https://github.com/sgkit-dev/vcztools/issues
"""
if list_samples:
# bcftools query -l ignores the --output option and always writes to stdout
output = sys.stdout
Expand Down Expand Up @@ -241,6 +255,15 @@ def view(
include,
exclude,
):
"""
Convert VCZ dataset to VCF with efficient subsetting and filtering.
Intended as a drop-in replacement for bcftools view, where
we replace the VCF file path with a VCZ dataset URL.

This is an early version and not feature complete: if you are missing a
particular piece of functionality please open an issue at
https://github.com/sgkit-dev/vcztools/issues
"""
suffix = output.name.split(".")[-1]
# Exclude suffixes which require bgzipped or BCF output:
# https://github.com/samtools/htslib/blob/329e7943b7ba3f0af15b0eaa00a367a1ac15bd83/vcf.c#L3815
Expand Down
Loading