format the variant location, content and identity information from MRC IEU API tables for OpenCRAVAT

ieutab_to_cravat(ieutab, chain = NULL, genome = NULL)

Arguments

ieutab

a data.frame-like entity with chr, position, ea (to be regarded

chain

a liftOver chain structure as defined in rtracklayer

genome

character(1) label, if present, attached to output as a column build as ALT allele and nea to be regarded as REF allele

Note

If a liftOver chain is provided, some input records may be lost. We attempt to keep allele content information with each locus.

Examples

# Here we assume it is desired to give hg38 variant positions to cravat
if (requireNamespace("ieugwasr")) {
  pw = try(ieugwasr::phewas("17:37000000-37020000"))
  if (!inherits(pw, "try-error")) {
    octab = ieutab_to_cravat(pw, chain=gwaslake::ch19to38, genome="hg38" )
    print(head(octab))
    }
  aa = try(ieugwasr::associations("rs6060535", id="ukb-b-10787"))
  if (!inherits(aa, "try-error")) {
    octab2 = ieutab_to_cravat(aa, chain=gwaslake::ch19to38, genome="hg38")
    head(octab2)
    }
}
#>   chr      pos ref  alt               var samp build
#> 1  17 38848425   G GTTT                    IEU  hg38
#> 2  17 38847059 AAT    A 17_37003312_AAT_A  IEU  hg38
#> 3  17 38853877   C    G         rs1124927  IEU  hg38
#> 4  17 38853877   C    G         rs1124927  IEU  hg38
#> 5  17 38853877   C    G         rs1124927  IEU  hg38
#> 6  17 38853877   C    G         rs1124927  IEU  hg38
#>   chr      pos ref alt       var samp build
#> 1  20 35647600   C   T rs6060535  IEU  hg38