Skip to content

Genotype I/O¤

See Genotype data for supported sources and file requirements.

Genotype adapters provide:

  • per-variant metadata (chromosome, position, alleles, IDs)
  • efficient iterators over genotype matrices for cis windows or trans chunks

The mapping layer converts genotype blocks to JAX arrays and preserves a1 as the counted allele.

Metadata accompany every read

jaxQTL requests variant metadata with genotype values so output allele and position fields remain aligned with matrix columns.

Genotype loading¤

jaxqtl.io.GenotypeReadOptions [source] ¤

Options used when reading genotype blocks through genoio.

jaxQTL requests variant metadata with every read and converts the selected sample tuple to the list expected by genoio.

Attributes:

  • kind: Read genotypes ("geno") or haplotypes ("haplo").
  • dosage: Return hard calls or dosages.
  • sparse: Dense output when false, otherwise CSC or CSR sparse output.
  • missing: Impute missing calls, preserve them as NaN, or raise an error.
  • dtype: NumPy-compatible output dtype. Defaults to numpy.float32.
dosage = <member 'dosage' of 'GenotypeReadOptions' objects> class-attribute ¤
dtype = <member 'dtype' of 'GenotypeReadOptions' objects> class-attribute ¤
kind = <member 'kind' of 'GenotypeReadOptions' objects> class-attribute ¤
missing = <member 'missing' of 'GenotypeReadOptions' objects> class-attribute ¤
sparse = <member 'sparse' of 'GenotypeReadOptions' objects> class-attribute ¤
__init__(self, kind: Literal[geno, haplo] = 'geno', dosage: Literal[hardcall, dosage] = 'hardcall', sparse: bool | Literal[csc, csr] = False, missing: Literal[impute, nan, 'raise'] = 'impute', dtype: object = float32) -> None ¤
kwargs(self, *, samples: tuple[str, ...], variants: genoio.FilterExpr | None = None) -> dict[str, object] ¤

Build keyword arguments for a genoio read operation.

Arguments:

  • samples: Sample IDs to read, in the requested output order.
  • variants: Optional genoio variant filter.

Returns:

A new dictionary containing the configured read options, samples, return_variants=True, and variants when supplied.


jaxqtl.io.load_genotype_dataset(source: GenotypeSource, path: str) -> genoio.Dataset ¤

Open a supported genotype source and return its genoio dataset.

path is the source-specific path or prefix: a PLINK 1 prefix for "bfile", a PLINK 2 prefix for "pfile", or a VCF or BGEN path for the corresponding source.

Arguments:

  • source: Genotype format: "bfile", "pfile", "vcf", or "bgen".
  • path: Dataset path or file prefix accepted by the selected genoio reader.

Returns:

The opened genoio.Dataset.

Raises:

  • ValueError: If source is unsupported.