Convert summary stats file to tabix format.
index_tabular(
path,
chrom_col = "CHR",
start_col = "BP",
end_col = start_col,
overwrite = TRUE,
remove_tmp = TRUE,
verbose = TRUE
)
Borrowed function from echotabix.
Path to GWAS summary statistics file.
Name of the chromosome column in
sumstats_dt
(e.g. "CHR").
Name of the starting genomic position
column in sumstats_dt
(e.g. "POS","start").
Name of the ending genomic position
column in sumstats_dt
(e.g. "POS","end").
Can be the same as start_col
when sumstats_dt
only contains SNPs that span 1 base pair (bp) each.
A logical(1) indicating whether dest
should
be over-written, if it already exists.
Remove the temporary uncompressed version of the file (.tsv).
Print messages.
Path to tabix-indexed tabular file
Other tabix:
index_vcf()
sumstats_dt <- MungeSumstats::formatted_example()
#> Standardising column headers.
#> First line of summary statistics file:
#> MarkerName CHR POS A1 A2 EAF Beta SE Pval
#> Sorting coordinates.
path <- tempfile(fileext = ".tsv")
MungeSumstats::write_sumstats(sumstats_dt = sumstats_dt, save_path = path)
#> Writing in tabular format ==> /tmp/RtmpmswcRa/file14806ae6bb9c.tsv
indexed_file <- MungeSumstats::index_tabular(path = path)
#> Converting full summary stats file to tabix format for fast querying...
#> Reading header.
#> Ensuring file is bgzipped.
#> Tabix-indexing file.
#> Removing temproary .tsv file.