<commit_before># Count the number of heterozygous variants per sample.
SELECT
  call.call_set_name,
  SUM(first_allele != second_allele) AS heterozygous_variant_count
FROM (
  SELECT
    reference_name,
    start,
    reference_bases,
    GROUP_CONCAT(alternate_bases) WITHIN RECORD AS alternate_bases,
    call.call_set_name,
    NTH(1, call.genotype) WITHIN call AS first_allele,
    NTH(2, call.genotype) WITHIN call AS second_allele,
    COUNT(alternate_bases) WITHIN RECORD AS num_alts
  FROM
    [_THE_TABLE_]
  # Skip no-calls and single-allele genotypes
  OMIT call IF SOME(call.genotype < 0) OR (2 > COUNT(call.genotype))
  HAVING
    num_alts = 1
    AND reference_bases IN ('A','C','G','T')
    AND alternate_bases IN ('A','C','G','T')
  )
GROUP BY
  call.call_set_name<commit_msg>Add a stable sort order.<commit_after># Count the number of heterozygous variants per sample.
SELECT
  call.call_set_name,
  SUM(first_allele != second_allele) AS heterozygous_variant_count
FROM (
  SELECT
    reference_name,
    start,
    reference_bases,
    GROUP_CONCAT(alternate_bases) WITHIN RECORD AS alternate_bases,
    call.call_set_name,
    NTH(1, call.genotype) WITHIN call AS first_allele,
    NTH(2, call.genotype) WITHIN call AS second_allele,
    COUNT(alternate_bases) WITHIN RECORD AS num_alts
  FROM
    [_THE_TABLE_]
  # Skip no-calls and single-allele genotypes
  OMIT call IF SOME(call.genotype < 0) OR (2 > COUNT(call.genotype))
  HAVING
    num_alts = 1
    AND reference_bases IN ('A','C','G','T')
    AND alternate_bases IN ('A','C','G','T')
  )
GROUP BY
  call.call_set_name
ORDER BY
  call.call_set_name
{'fraction_non_alphanumeric': 0.09476923076923077, 'fraction_numerical': 0.006153846153846154, 'mean_word_length': 4.08125, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2008843', 'n_tokens_mistral': 623, 'n_tokens_neox': 576, 'n_words': 150}