Skip to content

Commit

Permalink
Add support for alternative chromosome styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Al-Murphy committed Jul 13, 2023
1 parent 7867c01 commit 8df9b70
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 5 deletions.
12 changes: 10 additions & 2 deletions R/format_sumstats.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@
#' Ensembl styles both code chromosomes as `1-22, X, Y, MT`; the UCSC style is
#' `chr1-chr22, chrX, chrY, chrM`; and the dbSNP style is
#' `ch1-ch22, chX, chY, chMT`. Default is Ensembl.
#' @param rmv_chrPrefix Is now deprecated, do. not use. Use chr_style instead -
#' chr_style = 'Ensembl' will give the same result as rmv_chrPrefix=TRUE used to
#' give.
#' @param rmv_chr Chromosomes to exclude from the formatted summary statistics
#' file. Use NULL if no filtering is necessary. Default is `c("X", "Y", "MT")`
#' which removes all non-autosomal SNPs.
Expand Down Expand Up @@ -267,7 +270,10 @@ format_sumstats <- function(path,
log_folder = tempdir(),
imputation_ind = FALSE,
force_new = FALSE,
mapping_file = sumstatsColHeaders) {
mapping_file = sumstatsColHeaders,
#deprecated parameters
rmv_chrPrefix = NULL
) {
#### Setup multi-threading ####
data.table::setDTthreads(threads = nThread)
#### Setup empty variables ####
Expand Down Expand Up @@ -346,7 +352,9 @@ format_sumstats <- function(path,
log_mungesumstats_msgs = log_mungesumstats_msgs,
mapping_file = mapping_file,
tabix_index = tabix_index,
chain_source = chain_source
chain_source = chain_source,
#deprecated parameters
rmv_chrPrefix = rmv_chrPrefix
)

# save messages to file if user specified
Expand Down
15 changes: 14 additions & 1 deletion R/validate_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ validate_parameters <- function(path,
log_mungesumstats_msgs,
mapping_file,
tabix_index,
chain_source) {
chain_source,
#deprecated parameters
rmv_chrPrefix) {
# Checking if the file exists should happen first -
# can pass dt/df of sumstats
pth_msg <- paste0(
Expand Down Expand Up @@ -395,4 +397,15 @@ validate_parameters <- function(path,
collapse = "\n"))
stop(tbx_msg)
}

#deprecated parameters
if (!is.null(rmv_chrPrefix)) {
dep_msg <- paste0(
"The parameter rmv_chrPrefix is now deprecated, please use chr_style ",
"instead.\nThe default of rmv_chrPrefix = True will give the same ",
"result as using chr_style = 'Ensembl'."
)
stop(dep_msg)
}
rmv_chrPrefix = rmv_chrPrefix
}
7 changes: 6 additions & 1 deletion man/format_sumstats.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/import_sumstats.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion man/validate_parameters.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8df9b70

Please sign in to comment.