Skip to content

Commit

Permalink
bugfix munge
Browse files Browse the repository at this point in the history
  • Loading branch information
Ararder committed Jul 19, 2024
1 parent 9c48bad commit 440d85a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
1 change: 1 addition & 0 deletions R/read_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ munge <- function(dset, info_filter = 0.9, maf_filter = 0.01) {
N_filter <- round(stats::quantile(step1$N, 0.9) / 1.5)
step1 <- dplyr::filter(step1, N > N_filter)
cli::cli_alert_warning("Removed {before - nrow(step1)} rows with a sample size smaller than {N_filter}")
step1
}


Expand Down
29 changes: 19 additions & 10 deletions tests/testthat/test-read_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,29 @@ test_that("munge works", {
})


#
# #

test <- dplyr::tibble(SNP = "rs100", A1 = "T", A2 = "C", B = 0.05)
path <- "~/Downloads/ldsc.sumstats.gz"
# test <- dplyr::tibble(SNP = "rs100", A1 = "T", A2 = "C", B = 0.05)
# path <- "~/Downloads/ldsc.sumstats.gz"

else if("data.frame" %in% class(df)) {
check_columns(c("SNP", "A1","A2","Z","N"), df)
# else if("data.frame" %in% class(df)) {
# check_columns(c("SNP", "A1","A2","Z","N"), df)

final <- dplyr::tibble(df) |>
tidyr::drop_na() |>
dplyr::semi_join(ref, by = "SNP")
# final <- dplyr::tibble(df) |>
# tidyr::drop_na() |>
# dplyr::semi_join(ref, by = "SNP")

munge(final)
# munge(final)

}
# }




test_that("ldsc_to_parquet works", {
fs::dir_ls("~/projects/move")

ds1 <- arrow::read_parquet("/Users/arvhar/projects/move/clusters/annot.parquet")
ds2 <- arrow::open_dataset("/Users/arvhar/projects/move/clusters/ld.parquet")
colnames(ds1)
})

0 comments on commit 440d85a

Please # to comment.