code: def nirvana(
      dataset: Union[MatrixTable, Table],
      config,
      block_size=500000,
      name="nirvana",
  ):
      """Annotate variants using `Nirvana <https://github.com/Illumina/Nirvana>`_.
  
      .. include:: ../_templates/experimental.rst
  
      .. include:: ../_templates/req_tvariant.rst
  
      :func:`.nirvana` runs `Nirvana
      <https://github.com/Illumina/Nirvana>`_ on the current dataset and adds a
      new row field in the location specified by `name`.
  
      Examples
      --------
  
      Add Nirvana annotations to the dataset:
  
      >>> result = hl.nirvana(dataset, "data/nirvana.properties") # doctest: +SKIP
  
      **Configuration**
  
      :func:`.nirvana` requires a configuration file. The format is a
      `.properties file <https://en.wikipedia.org/wiki/.properties>`__, where each
      line defines a property as a key-value pair of the form ``key = value``.
      :func:`.nirvana` supports the following properties:
  
      - **hail.nirvana.dotnet** -- Location of dotnet. Optional, default: dotnet.
      - **hail.nirvana.path** -- Value of the PATH environment variable when
        invoking Nirvana. Optional, by default PATH is not set.
      - **hail.nirvana.location** -- Location of Nirvana.dll. Required.
      - **hail.nirvana.reference** -- Location of reference genome. Required.
      - **hail.nirvana.cache** -- Location of cache. Required.
      - **hail.nirvana.supplementaryAnnotationDirectory** -- Location of
        Supplementary Database. Optional, no supplementary database by default.
  
      Here is an example ``nirvana.properties`` configuration file:
  
      .. code-block:: text
  
          hail.nirvana.location = /path/to/dotnet/netcoreapp2.0/Nirvana.dll
          hail.nirvana.reference = /path/to/nirvana/References/Homo_sapiens.GRCh37.Nirvana.dat
          hail.nirvana.cache = /path/to/nirvana/Cache/GRCh37/Ensembl
          hail.nirvana.supplementaryAnnotationDirectory = /path/to/nirvana/SupplementaryDatabase/GRCh37
  
      **Annotations**
  
      A new row field is added in the location specified by `name` with the
      following schema:
  
      .. code-block:: text
  
          struct {
              chromosome: str,
              refAllele: str,
              position: int32,
              altAlleles: array<str>,
              cytogeneticBand: str,
              quality: float64,
              filters: array<str>,
              jointSomaticNormalQuality: int32,
              copyNumber: int32,
              strandBias: float64,
              recalibratedQuality: float64,
              variants: array<struct {
                  altAllele: str,
                  refAllele: str,
                  chromosome: str,
                  begin: int32,
                  end: int32,
                  phylopScore: float64,
                  isReferenceMinor: bool,
                  variantType: str,
                  vid: str,
                  hgvsg: str,
                  isRecomposedVariant: bool,
                  isDecomposedVariant: bool,
                  regulatoryRegions: array<struct {
                      id: str,
                      type: str,
                      consequence: set<str>
                  }>,
                  clinvar: array<struct {
                      id: str,
                      reviewStatus: str,
                      isAlleleSpecific: bool,
                      alleleOrigins: array<str>,
                      refAllele: str,
                      altAllele: str,
                      phenotypes: array<str>,
                      medGenIds: array<str>,
                      omimIds: array<str>,
                      orphanetIds: array<str>,
                      significance: str,
                      lastUpdatedDate: str,
                      pubMedIds: array<str>
                  }>,
                  cosmic: array<struct {
                      id: str,
                      isAlleleSpecific: bool,
                      refAllele: str,
                      altAllele: str,
                      gene: str,
                      sampleCount: int32,
                      studies: array<struct {
                          id: int32,
                          histology: str,
                          primarySite: str
                      }>
                  }>,
                  dbsnp: struct {
                      ids: array<str>
                  },
                  globalAllele: struct {
                      globalMinorAllele: str,
                      globalMinorAlleleFrequency: float64
                  },
                  gnomad: struct {
                      coverage: str,
                      allAf: float64,
                      allAc: int32,
                      allAn: int32,
                      allHc: int32,
                      afrAf: float64,
                      afrAc: int32,
                      afrAn: int32,
                      afrHc: int32,
                      amrAf: float64,
                      amrAc: int32,
                      amrAn: int32,
                      amrHc: int32,
                      easAf: float64,
                      easAc: int32,
                      easAn: int32,
                      easHc: int32,
                      finAf: float64,
                      finAc: int32,
                      finAn: int32,
                      finHc: int32,
                      nfeAf: float64,
                      nfeAc: int32,
                      nfeAn: int32,
                      nfeHc: int32,
                      othAf: float64,
                      othAc: int32,
                      othAn: int32,
                      othHc: int32,
                      asjAf: float64,
                      asjAc: int32,
                      asjAn: int32,
                      asjHc: int32,
                      failedFilter: bool
                  },
                  gnomadExome: struct {
                      coverage: str,
                      allAf: float64,
                      allAc: int32,
                      allAn: int32,
                      allHc: int32,
                      afrAf: float64,
                      afrAc: int32,
                      afrAn: int32,
                      afrHc: int32,
                      amrAf: float64,
                      amrAc: int32,
                      amrAn: int32,
                      amrHc: int32,
                      easAf: float64,
                      easAc: int32,
                      easAn: int32,
                      easHc: int32,
                      finAf: float64,
                      finAc: int32,
                      finAn: int32,
                      finHc: int32,
                      nfeAf: float64,
                      nfeAc: int32,
                      nfeAn: int32,
                      nfeHc: int32,
                      othAf: float64,
                      othAc: int32,
                      othAn: int32,
                      othHc: int32,
                      asjAf: float64,
                      asjAc: int32,
                      asjAn: int32,
                      asjHc: int32,
                      sasAf: float64,
                      sasAc: int32,
                      sasAn: int32,
                      sasHc: int32,
                      failedFilter: bool
                  },
                  topmed: struct {
                      failedFilter: bool,
                      allAc: int32,
                      allAn: int32,
                      allAf: float64,
                      allHc: int32
                  },
                  oneKg: struct {
                      ancestralAllele: str,
                      allAf: float64,
                      allAc: int32,
                      allAn: int32,
                      afrAf: float64,
                      afrAc: int32,
                      afrAn: int32,
                      amrAf: float64,
                      amrAc: int32,
                      amrAn: int32,
                      easAf: float64,
                      easAc: int32,
                      easAn: int32,
                      eurAf: float64,
                      eurAc: int32,
                      eurAn: int32,
                      sasAf: float64,
                      sasAc: int32,
                      sasAn: int32
                  },
                  mitomap: array<struct {
                      refAllele: str,
                      altAllele: str,
                      diseases : array<str>,
                      hasHomoplasmy: bool,
                      hasHeteroplasmy: bool,
                      status: str,
                      clinicalSignificance: str,
                      scorePercentile: float64,
                      isAlleleSpecific: bool,
                      chromosome: str,
                      begin: int32,
                      end: int32,
                      variantType: str
                  }
                  transcripts: struct {
                      refSeq: array<struct {
                          transcript: str,
                          bioType: str,
                          aminoAcids: str,
                          cdnaPos: str,
                          codons: str,
                          cdsPos: str,
                          exons: str,
                          introns: str,
                          geneId: str,
                          hgnc: str,
                          consequence: array<str>,
                          hgvsc: str,
                          hgvsp: str,
                          isCanonical: bool,
                          polyPhenScore: float64,
                          polyPhenPrediction: str,
                          proteinId: str,
                          proteinPos: str,
                          siftScore: float64,
                          siftPrediction: str
                      }>,
                      ensembl: array<struct {
                          transcript: str,
                          bioType: str,
                          aminoAcids: str,
                          cdnaPos: str,
                          codons: str,
                          cdsPos: str,
                          exons: str,
                          introns: str,
                          geneId: str,
                          hgnc: str,
                          consequence: array<str>,
                          hgvsc: str,
                          hgvsp: str,
                          isCanonical: bool,
                          polyPhenScore: float64,
                          polyPhenPrediction: str,
                          proteinId: str,
                          proteinPos: str,
                          siftScore: float64,
                          siftPrediction: str
                      }>
                  },
                  overlappingGenes: array<str>
              }>
              genes: array<struct {
                  name: str,
                  omim: array<struct {
                      mimNumber: int32,
                      hgnc: str,
                      description: str,
                      phenotypes: array<struct {
                          mimNumber: int32,
                          phenotype: str,
                          mapping: str,
                          inheritance: array<str>,
                          comments: str
                      }>
                  }>
                  exac: struct {
                      pLi: float64,
                      pRec: float64,
                      pNull: float64
                  }
              }>
          }
  
      Parameters
      ----------
      dataset : :class:`.MatrixTable` or :class:`.Table`
          Dataset.
      config : :class:`str`
          Path to Nirvana configuration file.
      block_size : :obj:`int`
          Number of rows to process per Nirvana invocation.
      name : :class:`str`
          Name for resulting row field.
  
      Returns
      -------
      :class:`.MatrixTable` or :class:`.Table`
          Dataset with new row-indexed field `name` containing Nirvana annotations.
      """
      if isinstance(dataset, MatrixTable):
          require_row_key_variant(dataset, "nirvana")
          ht = dataset.select_rows().rows()
      else:
          require_table_key_variant(dataset, "nirvana")
          ht = dataset.select()
  
      annotations = Table(
          TableToTableApply(
              ht._tir,
              {
                  "name": "Nirvana",
                  "config": config,
                  "blockSize": block_size,
              },
          )
      ).persist()
  
      if isinstance(dataset, MatrixTable):
          return dataset.annotate_rows(
              **{name: annotations[dataset.row_key].nirvana}
          )
      else:
          return dataset.annotate(
              **{name: annotations[dataset.key].nirvana}
          )
  
imports: import abc
  import logging
  import hail
  from collections import Counter
  import os
  from shlex import quote
  from typing import Dict, Tuple, List, Optional, Union
  from hailtop import pip_version
  from hailtop.utils import async_to_blocking
  import hailtop.batch_client
  from hailtop.config import get_deploy_config
  from hailtop import yamlx
  from hail.backend.service_backend import ServiceBackend
  from hail.typecheck import typecheck, oneof, anytype, nullable, numeric
  from hail.expr.expressions.expression_typecheck import expr_float64
  from hail.utils import FatalError
  from hail.utils.java import Env, info, warning
  from hail.utils.misc import divide_null, guess_cloud_spark_provider, new_temp_file
  from hail.matrixtable import MatrixTable
  from hail.table import Table
  from hail.ir import TableToTableApply
  from .misc import require_biallelic, require_row_key_variant, require_col_key_str, require_table_key_variant, require_alleles_field
label_desc: Use image node_id 7 for calling a global function with example usage: nirvana(dataset, config, block_size, name) and returns: dataset, dataset