VCF (VCF v1.0.0)
View SourceParse, validate, stream, transform, and write Variant Call Format files.
parse/2 always treats its binary argument as VCF content. Use read/2 or
stream/2 for paths, caller-owned I/O devices, and binary enumerables.
Quick start
iex> lines = ["##fileformat=VCFv4.5", "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO", "chr1\t10\t.\tA\tC\t.\tPASS\t."]
iex> source = Enum.join(lines, <<10>>) <> <<10>>
iex> {:ok, document} = VCF.parse(source)
iex> [record] = document.records
iex> {record.chrom, record.pos, record.filter}
{"chr1", 10, :pass}Complete-input functions have bang variants that raise VCF.ParseError.
Lazy bang streams yield records directly; non-bang streams yield tagged
results.
Summary
Functions
Encodes a document, stream, or header plus records to canonical VCF text.
Encodes canonical VCF text or raises VCF.ParseError.
Lazily filters records while preserving stream header context.
Parses an in-memory VCF binary into a document.
Parses an in-memory VCF binary or raises VCF.ParseError.
Reads a path, I/O device, or binary enumerable into a document.
Reads a complete source or raises VCF.ParseError.
Opens a non-bang lazy stream whose elements are tagged results.
Opens a lazy record stream that raises on the first error.
Returns the supported VCF specification versions.
Validates every record in a fully collected document.
Writes a document or stream to a path or I/O device.
Writes a document or stream or raises VCF.ParseError.
Functions
@spec encode(VCF.Header.t(), Enumerable.t()) :: {:ok, binary()} | {:error, VCF.Error.t() | [VCF.Error.t()]}
@spec encode( VCF.Document.t() | VCF.Stream.t(), keyword() ) :: {:ok, binary()} | {:error, VCF.Error.t() | [VCF.Error.t()]}
Encodes a document, stream, or header plus records to canonical VCF text.
@spec encode(VCF.Header.t(), Enumerable.t(), keyword()) :: {:ok, binary()} | {:error, VCF.Error.t() | [VCF.Error.t()]}
@spec encode!(VCF.Header.t(), Enumerable.t()) :: binary()
@spec encode!( VCF.Document.t() | VCF.Stream.t(), keyword() ) :: binary()
Encodes canonical VCF text or raises VCF.ParseError.
@spec encode!(VCF.Header.t(), Enumerable.t(), keyword()) :: binary()
@spec filter(VCF.Stream.t(), (VCF.Record.t() -> as_boolean(term()))) :: VCF.Stream.t()
Lazily filters records while preserving stream header context.
@spec parse( binary(), keyword() ) :: {:ok, VCF.Document.t()} | {:error, VCF.Error.t()}
Parses an in-memory VCF binary into a document.
@spec parse!( binary(), keyword() ) :: VCF.Document.t()
Parses an in-memory VCF binary or raises VCF.ParseError.
@spec read( term(), keyword() ) :: {:ok, VCF.Document.t()} | {:error, VCF.Error.t()}
Reads a path, I/O device, or binary enumerable into a document.
@spec read!( term(), keyword() ) :: VCF.Document.t()
Reads a complete source or raises VCF.ParseError.
@spec stream( term(), keyword() ) :: {:ok, VCF.Stream.t()} | {:error, VCF.Error.t()}
Opens a non-bang lazy stream whose elements are tagged results.
@spec stream!( term(), keyword() ) :: VCF.Stream.t()
Opens a lazy record stream that raises on the first error.
@spec supported_versions() :: [String.t()]
Returns the supported VCF specification versions.
@spec validate( VCF.Document.t(), keyword() ) :: :ok | {:error, [VCF.Error.t()]}
Validates every record in a fully collected document.
@spec write(VCF.Document.t() | VCF.Stream.t(), term(), keyword()) :: :ok | {:error, VCF.Error.t() | [VCF.Error.t()]}
@spec write(term(), VCF.Document.t() | VCF.Stream.t(), keyword()) :: :ok | {:error, VCF.Error.t() | [VCF.Error.t()]}
@spec write(term(), VCF.Header.t(), Enumerable.t()) :: :ok | {:error, VCF.Error.t() | [VCF.Error.t()]}
Writes a document or stream to a path or I/O device.
@spec write(term(), VCF.Header.t(), Enumerable.t(), keyword()) :: :ok | {:error, VCF.Error.t() | [VCF.Error.t()]}
@spec write!(VCF.Document.t() | VCF.Stream.t(), term(), keyword()) :: :ok
@spec write!(term(), VCF.Document.t() | VCF.Stream.t(), keyword()) :: :ok
@spec write!(term(), VCF.Header.t(), Enumerable.t()) :: :ok
Writes a document or stream or raises VCF.ParseError.
@spec write!(term(), VCF.Header.t(), Enumerable.t(), keyword()) :: :ok