-- DBMS: bigquery
CREATE TABLE `open-targets-genetics.genetics.variant_disease`
(
  study_id STRING,
  lead_chrom STRING,
  lead_pos INT64,
  lead_ref STRING,
  lead_alt STRING,
  direction STRING,
  beta FLOAT64,
  beta_ci_lower FLOAT64,
  beta_ci_upper FLOAT64,
  odds_ratio FLOAT64,
  oddsr_ci_lower FLOAT64,
  oddsr_ci_upper FLOAT64,
  pval_mantissa FLOAT64,
  pval_exponent INT64,
  pval FLOAT64,
  ancestry_initial STRUCT<list ARRAY<STRUCT<element STRING>>> NOT NULL,
  ancestry_replication STRUCT<list ARRAY<STRUCT<element STRING>>> NOT NULL,
  n_cases INT64,
  n_initial INT64,
  n_replication INT64,
  pmid STRING,
  pub_author STRING,
  pub_date STRING,
  pub_journal STRING,
  pub_title STRING,
  has_sumstats BOOL,
  num_assoc_loci INT64,
  source STRING,
  trait_reported STRING,
  trait_efos STRUCT<list ARRAY<STRUCT<element STRING>>> NOT NULL,
  trait_category STRING NOT NULL,
  tag_chrom STRING,
  tag_pos INT64,
  tag_ref STRING,
  tag_alt STRING,
  overall_r2 FLOAT64,
  pics_95perc_credset BOOL,
  AFR_1000G_prop FLOAT64,
  AMR_1000G_prop FLOAT64,
  EAS_1000G_prop FLOAT64,
  EUR_1000G_prop FLOAT64,
  SAS_1000G_prop FLOAT64,
  log10_ABF FLOAT64,
  posterior_prob FLOAT64
)
OPTIONS(
  description="Variant to study-trait index"
);

INSERT INTO `open-targets-genetics.genetics.variant_disease` (study_id, lead_chrom, lead_pos, lead_ref, lead_alt, direction, beta, beta_ci_lower, beta_ci_upper, odds_ratio, oddsr_ci_lower, oddsr_ci_upper, pval_mantissa, pval_exponent, pval, ancestry_initial, ancestry_replication, n_cases, n_initial, n_replication, pmid, pub_author, pub_date, pub_journal, pub_title, has_sumstats, num_assoc_loci, source, trait_reported, trait_efos, trait_category, tag_chrom, tag_pos, tag_ref, tag_alt, overall_r2, pics_95perc_credset, AFR_1000G_prop, AMR_1000G_prop, EAS_1000G_prop, EUR_1000G_prop, SAS_1000G_prop, log10_ABF, posterior_prob) VALUES ('GCST000019', '8', 127472793, 'A', 'C', '-', nan, nan, nan, 0.625, 0.5617396124430637, 0.6953844652349359, 6.0, -18, 6.0000000000000004e-18, {'list': "[{'element': 'European=4517'}]"}, {'list': "[{'element': 'African American or Afro-Caribbean=745'}\n {'element': 'European=3655'}]"}, 1453, 4517, 4400, 'PMID:17401366', 'Gudmundsson J', '2007-04-01', 'Nat Genet', 'Genome-wide association study identifies a second prostate cancer susceptibility variant at 8q24.', False, 1, 'GCST', 'Prostate cancer', {'list': "[{'element': 'EFO_0001663'}]"}, 'cell proliferation disorder', '8', 127506926, 'A', 'C', 0.9562277811609999, True, 0.08354827856902546, 0.0, 0.0, 0.9164517214309745, 0.0, nan, nan), ('GCST000035', '10', 121592803, 'A', 'G', '-', nan, nan, nan, 0.7936507936507936, 0.7744557157207258, 0.813321626371306, 2.0, -76, 2e-76, {'list': "[{'element': 'European=754'}]"}, {'list': "[{'element': 'European=48565'} {'element': 'East Asian=7928'}]"}, 390, 754, 56493, 'PMID:17529967', 'Easton DF', '2007-05-27', 'Nature', 'Genome-wide association study identifies novel breast cancer susceptibility loci.', False, 5, 'GCST', 'Breast cancer', {'list': "[{'element': 'EFO_0000305'}]"}, 'cell proliferation disorder', '10', 121581150, 'G', 'A', 0.812577847761, False, 0.0, 0.0, 0.13848760633745, 0.8615123936625501, 0.0, nan, nan), ('GCST000035', '16', 52552429, 'A', 'G', '-', nan, nan, nan, 0.8333333333333334, 0.810137800393215, 0.8571929912508505, 1.0, -36, 1e-36, {'list': "[{'element': 'European=754'}]"}, {'list': "[{'element': 'European=48565'} {'element': 'East Asian=7928'}]"}, 390, 754, 56493, 'PMID:17529967', 'Easton DF', '2007-05-27', 'Nature', 'Genome-wide association study identifies novel breast cancer susceptibility loci.', False, 5, 'GCST', 'Breast cancer', {'list': "[{'element': 'EFO_0000305'}]"}, 'cell proliferation disorder', '16', 52550383, 'T', 'G', 0.995084056521, True, 0.0, 0.0, 0.13848760633745, 0.8615123936625501, 0.0, nan, nan), ('GCST000035', '16', 52552429, 'A', 'G', '-', nan, nan, nan, 0.8333333333333334, 0.810137800393215, 0.8571929912508505, 1.0, -36, 1e-36, {'list': "[{'element': 'European=754'}]"}, {'list': "[{'element': 'European=48565'} {'element': 'East Asian=7928'}]"}, 390, 754, 56493, 'PMID:17529967', 'Easton DF', '2007-05-27', 'Nature', 'Genome-wide association study identifies novel breast cancer susceptibility loci.', False, 5, 'GCST', 'Breast cancer', {'list': "[{'element': 'EFO_0000305'}]"}, 'cell proliferation disorder', '16', 52515734, 'G', 'A', 0.8076257424000001, False, 0.0, 0.0, 0.13848760633745, 0.8615123936625501, 0.0, nan, nan), ('GCST000035', '8', 127343372, 'A', 'G', '+', nan, nan, nan, 1.08, 1.0566645514101518, 1.1038507901522796, 5.0, -12, 5e-12, {'list': "[{'element': 'European=754'}]"}, {'list': "[{'element': 'European=48565'} {'element': 'East Asian=7928'}]"}, 390, 754, 56493, 'PMID:17529967', 'Easton DF', '2007-05-27', 'Nature', 'Genome-wide association study identifies novel breast cancer susceptibility loci.', False, 5, 'GCST', 'Breast cancer', {'list': "[{'element': 'EFO_0000305'}]"}, 'cell proliferation disorder', '8', 127331634, 'G', 'A', 0.812426414409, False, 0.0, 0.0, 0.13848760633745, 0.8615123936625501, 0.0, nan, nan);