Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions R/allele_qc.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,13 @@ allele_qc <- function(target_data, ref_variants, col_to_flip = NULL,
if (any(columns_to_remove %in% colnames(target_data))) {
target_data <- select(target_data, -any_of(columns_to_remove))
}

match_result <- merge(target_data, ref_variants, by = c("chrom", "pos"), all = FALSE, suffixes = c(".target", ".ref")) %>%
match_result <- merge(target_data, ref_variants, by = c("chrom", "pos"), all = FALSE, suffixes = c(".target", ".ref")) %>% as.data.frame()
if (nrow(match_result) == 0) {
warning("No matching variants found between target data and reference variants.")
return(list(target_data_qced = match_result, qc_summary = match_result))
}
# match target & ref by chrom and position
as.data.frame() %>%
match_result = match_result %>%
mutate(variants_id_original = paste(chrom, pos, A2.target, A1.target, sep = ":")) %>%
mutate(variants_id_qced = paste(chrom, pos, A2.ref, A1.ref, sep = ":")) %>%
# filter out totally same rows.
Expand Down
7 changes: 6 additions & 1 deletion R/univariate_pipeline.R
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,16 @@ rss_analysis_pipeline <- function(
if (nrow(sumstats)==0){
return(list(rss_data_analyzed = sumstats))
}

# Preprocess the input data
preprocess_results <- rss_basic_qc(sumstats, LD_data, skip_region = skip_region, remove_indels = remove_indels)
sumstats <- preprocess_results$sumstats
LD_mat <- preprocess_results$LD_mat

# Check if no variants in preprocess_results
if (nrow(sumstats)==0){
message("No variants left after preprocessing. Returning empty results.")
return(list(rss_data_analyzed = sumstats))
}
if (pip_cutoff_to_skip != 0) {
if (pip_cutoff_to_skip < 0) {
# automatically determine the cutoff to use
Expand Down
Loading