code: def test_linear_skat_produces_same_results_as_old_scala_method():
      mt = hl.import_vcf(resource("sample2.vcf"))
      covariates_ht = hl.import_table(
          resource("skat.cov"),
          key="Sample",
          types={"Cov1": hl.tint, "Cov2": hl.tint},
      )
      phenotypes_ht = hl.import_table(
          resource("skat.pheno"),
          key="Sample",
          types={"Pheno": hl.tfloat64},
          missing="0",
          impute=True,
      )
      genes = hl.import_locus_intervals(resource("skat.interval_list"))
      weights = hl.import_table(
          resource("skat.weights"),
          key="locus",
          types={"locus": hl.tlocus(), "weight": hl.tfloat64},
      )
      mt = hl.split_multi_hts(mt)
      pheno = phenotypes_ht[mt.s].Pheno
      mt = mt.annotate_cols(
          cov=covariates_ht[mt.s],
          pheno=(
              hl.case()
              .when(pheno == 1.0, False)
              .when(pheno == 2.0, True)
              .or_missing()
          ),
      )
      mt = mt.annotate_rows(
          gene=genes[mt.locus].target, weight=weights[mt.locus].weight
      )
      skat_results = (
          hl._linear_skat(
              mt.gene,
              mt.weight,
              y=mt.pheno,
              x=mt.GT.n_alt_alleles(),
              covariates=[1, mt.cov.Cov1, mt.cov.Cov2],
          )
          .rename({"group": "id"})
          .select_globals()
      )
      old_scala_results = hl.import_table(
          resource("scala-skat-results.tsv"),
          types=dict(
              id=hl.tstr,
              size=hl.tint64,
              q_stat=hl.tfloat,
              p_value=hl.tfloat,
              fault=hl.tint,
          ),
          key="id",
      )
      assert skat_results._same(old_scala_results, tolerance=5e-5)
  
imports: import hail
  import pytest
  from hail.utils import FatalError, HailUserError
  from ..helpers import resource, test_timeout, qobtest
label_desc: Use image node_id 16 for calling a global function with example usage: test_linear_skat_produces_same_results_as_old_scala_method() without return types