Skip to content

Add ped cleaner#5

Merged
josuechinchilla merged 27 commits into
developmentfrom
add_ped_cleaner
May 21, 2026
Merged

Add ped cleaner#5
josuechinchilla merged 27 commits into
developmentfrom
add_ped_cleaner

Conversation

@josuechinchilla
Copy link
Copy Markdown
Contributor

added ped_cleaner, css and restructured help module and sections

@josuechinchilla josuechinchilla requested a review from Copilot May 14, 2026 14:06
@josuechinchilla josuechinchilla requested review from Copilot and removed request for Copilot May 15, 2026 19:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Pedigree Cleaner workflow, reorganizes app navigation/help content around pedigree and composition tools, and updates shared UI styling/resources.

Changes:

  • Adds mod_ped_cleaner plus dedicated help content for Pedigree Cleaner, SNMF, and PolyBreedTools.
  • Reworks app sidebar/tab wiring and removes the Genomic Diversity module from the active app.
  • Adds custom CSS/JS for dashboard theming and card/tab behavior.

Reviewed changes

Copilot reviewed 17 out of 22 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
R/mod_SNMF.R Adds module help button and image export support; mostly reformats existing SNMF UI/server.
R/mod_polybreedtools.R Adds help button/content integration and reorganizes UI layout.
R/mod_ped_cleaner.R New Pedigree Cleaner UI/server module.
R/mod_Home.R Removes/comment-disables the tutorials value box.
R/mod_help.R Replaces old help page with accordion-based help for new supported modules.
R/mod_diversity.R Deletes the Genomic Diversity module.
R/help_SNMF.R Adds reusable SNMF help content.
R/help_polybreedtools.R Adds reusable PolyBreedTools help content.
R/help_ped_cleaner.R Adds reusable Pedigree Cleaner help content.
R/app_ui.R Adds Pedigree Cleaner tab, updates sidebar/menu/source link, and injects CSS/JS.
R/app_server.R Wires Pedigree Cleaner and Help servers; removes active Diversity server wiring.
NAMESPACE Removes unused includeMarkdown import.
inst/app/www/custom.js Adds card-header collapse behavior and tab active-state sync.
inst/app/www/custom.css Adds dashboard color/theme overrides and UI styling.
inst/.gitignore Ignores an SNMF test VCF under inst.
.Rhistory Updates tracked interactive R history.
.Rbuildignore Adds local AI tool directories to build ignore.
.gitignore Ignores .positai.
Comments suppressed due to low confidence (1)

R/mod_SNMF.R:759

  • The exported ancestry plot is rebuilt independently from output$snmf_q_plot, duplicating the reshape/theme logic. Sharing a single plot helper would prevent the downloaded image from diverging from the on-screen plot when future changes are made.
        q      <- q_matrix()
        df     <- data.frame(ID = rownames(q), q, check.names = FALSE)
        q_cols <- colnames(q)
        long   <- stats::reshape(df, varying = q_cols, v.names = "Q", timevar = "Cluster",
                                 times = q_cols, direction = "long")
        long$ID      <- factor(long$ID,      levels = unique(df$ID))
        long$Cluster <- factor(long$Cluster, levels = q_cols)
        ggplot(long, ggplot2::aes(x = ID, y = Q, fill = Cluster)) +
          geom_col(width = 0.9) +
          scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
          labs(x = "Individual", y = "Ancestry proportion", fill = "Cluster") +
          theme_minimal() +
          theme(axis.text.x = element_text(angle = 45, hjust = 1, vjust = 1, size = 8),
                panel.grid.major.x = element_blank())
      }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/mod_ped_cleaner.R
Comment thread R/mod_ped_cleaner.R Outdated
Comment thread R/mod_ped_cleaner.R Outdated
Comment thread R/mod_ped_cleaner.R Outdated
Comment thread R/mod_polybreedtools.R Outdated
Comment thread R/app_ui.R Outdated
Comment thread .Rhistory Outdated
Comment thread R/app_ui.R Outdated
Comment thread inst/app/www/custom.css
Comment thread R/mod_SNMF.R Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 23 changed files in this pull request and generated 7 comments.

Comment thread R/mod_SNMF.R Outdated
Comment thread R/mod_ped_cleaner.R Outdated
Comment thread .Rhistory Outdated
Comment thread R/help_polybreedtools.R Outdated
Comment thread R/mod_SNMF.R Outdated
Comment thread R/mod_polybreedtools.R Outdated
Comment thread R/mod_ped_cleaner.R Outdated
josuechinchilla and others added 7 commits May 18, 2026 08:22
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 23 changed files in this pull request and generated 8 comments.

Comment thread R/help_SNMF.R Outdated
Comment thread R/mod_SNMF.R Outdated
Comment thread R/mod_SNMF.R
Comment thread R/mod_ped_cleaner.R
Comment thread R/mod_ped_cleaner.R
Comment thread R/mod_polybreedtools.R Outdated
Comment thread R/mod_ped_cleaner.R Outdated
Comment thread R/help_ped_cleaner.R Outdated
josuechinchilla and others added 5 commits May 18, 2026 09:59
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 23 changed files in this pull request and generated 10 comments.

Comment thread R/help_polybreedtools.R Outdated
Comment thread R/app_ui.R Outdated
Comment thread R/app_ui.R
Comment thread R/mod_SNMF.R Outdated
Comment thread R/mod_SNMF.R
Comment thread R/help_ped_cleaner.R
Comment thread inst/app/www/custom.css
Comment thread R/mod_Home.R
Comment thread R/app_ui.R
Comment thread inst/app/www/custom.js
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 23 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

R/mod_ped_cleaner.R:235

  • shinyjs::enable("download_results") will not work reliably in a module because the actual DOM id is namespaced. Enable the button using the namespaced id (e.g., shinyjs::enable(session$ns("download_results"))) so downloads are re-enabled after a successful run.
        shinyWidgets::updateProgressBar(
          session = session, id = "pb_ped",
          value = 100, status = "success",
          title = "Finished"
        )
        shinyjs::enable("download_results")
        

Comment thread R/app_ui.R Outdated
Comment thread R/mod_ped_cleaner.R
Comment thread inst/app/www/custom.js
Comment thread R/mod_SNMF.R Outdated
Comment thread R/mod_polybreedtools.R
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 23 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

R/mod_ped_cleaner.R:398

  • These section titles are hard-coded as "Conflicting Trios Resolved" even though correction is optional. If the user disables correction, the table should not be labeled as "resolved" (same for any other conditionally-corrected issue types). Suggest making the title conditional on the run settings or using a neutral label like "Conflicting Trios".
      render_if("Exact Duplicates Removed",       report$exact_duplicates)
      render_if("Conflicting Trios Resolved",      report$conflicting_trios)
      render_if("Inconsistent Sex Roles",          report$inconsistent_sex_roles)
      render_if("Missing Parents Added",           report$missing_parents)

Comment thread R/mod_ped_cleaner.R
Comment thread R/mod_SNMF.R Outdated
Comment thread R/mod_polybreedtools.R Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 23 changed files in this pull request and generated 2 comments.

Comment thread R/mod_polybreedtools.R
Comment on lines +236 to +244
validation_raw <- utils::read.table(input$validation_file$datapath, header = TRUE, sep = "\t")
# NA filtering: validation samples (rows) with < 50% marker call rate
validation_markers <- validation_raw[, colnames(validation_raw) != "ID", drop = FALSE]
sample_call_rate <- rowSums(!is.na(validation_markers)) / ncol(validation_markers)
removed_samples <- validation_raw$ID[sample_call_rate < 0.5]
validation_filtered <- validation_raw[sample_call_rate >= 0.5, , drop = FALSE]
if (nrow(validation_filtered) == 0) {
stop("No validation samples remain after filtering for genotyping rate >= 50%.")
}
Comment thread R/mod_SNMF.R
Comment on lines +452 to +458
# Palette fix: brewer palete allows up to 9 colors but we need 10
palette_name <- input$snmf_color_choice %||% "Set1"
palette_info <- RColorBrewer::brewer.pal.info[palette_name, , drop = FALSE]
max_colors <- palette_info$maxcolors[[1]]
n_base <- max(3L, max_colors) # brewer.pal requires n >= 3
base_colors <- RColorBrewer::brewer.pal(n_base, palette_name)
fill_colors <- grDevices::colorRampPalette(base_colors)(length(q_cols))
@josuechinchilla josuechinchilla merged commit 2db545b into development May 21, 2026
4 checks passed
@josuechinchilla josuechinchilla deleted the add_ped_cleaner branch May 21, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants