Write sum stats file to disk
write_sumstats( sumstats_dt, save_path, ref_genome, sep = "\t", write_vcf = FALSE, save_format = NULL, tabix_index = FALSE, nThread = 1, return_path = FALSE, save_path_check = FALSE )
data table obj of the summary statistics file for the GWAS.
File path to save formatted data. Defaults to
name of the reference genome used for the GWAS ("GRCh37" or "GRCh38"). Argument is case-insensitive. Default is NULL which infers the reference genome from the data.
The separator between columns. Defaults to the character in the set
[,\t |;:] that separates the sample of rows into the most number of lines with the same number of fields. Use
"" to specify no separator; i.e. each line a single character column like
Whether to write as VCF (TRUE) or tabular file (FALSE).
Output format of sumstats. Options are NULL - standardised output format from MungeSumstats, LDSC - output format compatible with LDSC and openGWAS - output compatible with openGWAS VCFs. Default is NULL.
Index the formatted summary statistics with tabix for fast querying.
The number of threads to use. Experiment to see what works best for your data on your hardware.
This will have been modified in some cases
(e.g. after compressing and tabix-indexing a
previously un-compressed file).
Ensure path name is valid (given the other arguments) before writing (default: FALSE).
path <- system.file("extdata", "eduAttainOkbay.txt", package = "MungeSumstats" ) eduAttainOkbay <- read_sumstats(path = path) #> Importing tabular file: /__w/_temp/Library/MungeSumstats/extdata/eduAttainOkbay.txt #> Checking for empty columns. write_sumstats( sumstats_dt = eduAttainOkbay, save_path = tempfile(fileext = ".tsv.gz") ) #> Writing in tabular format ==> /tmp/RtmpmswcRa/file1480205a5222.tsv.gz