Skip to main content

Hypothesis strategy for generating VCF

Project description

hypothesis-vcf

A Hypothesis strategy for generating VCF (Variant Call Format) files.

Description

hypothesis-vcf is designed to generate VCF files that conform to the VCF specification (version 4.3). It generates VCFs that are syntactically valid, but which don't have meaningful semantics.

For that reason, the main use case is for testing software that parses VCF or converts VCF to another format, since Hypothesis will generate examples that exercise many edge cases of the VCF spec.

In general, the generated VCFs do not have well-known INFO or FORMAT fields, such as DP or AD. There is one exception to this: GT (genotype) fields are generated, since they are found in most VCF files. The ability to generate more well-known fields may be added in the future.

API

The public API consists of just one function: hypothesis_vcf.vcf.

Usage

Generate an example interactively:

>>> from hypothesis_vcf import vcf
>>> print(vcf().example())
##fileformat=VCFv4.3
##FILTER=<ID=PASS,Description="All filters passed">
##source=hypothesis-vcf-0.1.dev2+g32cb4a6
##contig=<ID=C>
##INFO=<ID=Jw,Type=Float,Number=1,Description="INFO,Type=Float,Number=1">
##FORMAT=<ID=zS,Type=Integer,Number=3,Description="FORMAT,Type=Integer,Number=3">
##FORMAT=<ID=ky,Type=String,Number=A,Description="FORMAT,Type=String,Number=A">
#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO
C	87	.	NCNN	CCCTTTCTCNCAGGNA,ACGCCAGTAATCGCGCNNAAAATAAGT,GNTAT	.	.	.
C	251	vRIinp	GGAATGGNTNTNNTCCA	AA,CCGTNATNAA,GAG	.	.	Jw=0.0

Generate examples in unit tests:

from hypothesis import given
from hypothesis_vcf import vcf

@given(vcf_string=vcf())
def test_vcf(vcf_string):
    assert vcf_string.startswith("##fileformat=VCF")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hypothesis_vcf-0.1.0.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hypothesis_vcf-0.1.0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file hypothesis_vcf-0.1.0.tar.gz.

File metadata

  • Download URL: hypothesis_vcf-0.1.0.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for hypothesis_vcf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9ed42c83c3fc2ed8749f867c9a337afc253c7ac9cd79d57b1fbf056d11ff758f
MD5 8fe3896317b172f40742490bcac17d8d
BLAKE2b-256 0d333451b901ac0f7a477d9be4ec3b0219f9763f01476e94f4a1790086a9c20c

See more details on using hashes here.

Provenance

The following attestation bundles were made for hypothesis_vcf-0.1.0.tar.gz:

Publisher: cd.yml on sgkit-dev/hypothesis-vcf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hypothesis_vcf-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: hypothesis_vcf-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for hypothesis_vcf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f54858607faa9f603034b49ab6fed6d8194138a5038c51e5249921c458b2b67
MD5 289edecceb714f2e93e34e4ce60286d6
BLAKE2b-256 32e3459ac938c69286eff8d50a3ddae70687ee370e1278d67207e1c0d3fcdd15

See more details on using hashes here.

Provenance

The following attestation bundles were made for hypothesis_vcf-0.1.0-py3-none-any.whl:

Publisher: cd.yml on sgkit-dev/hypothesis-vcf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page