Repository navigation
Development - #20
Merged
Merged
Development#20
Conversation
Sat 213 attempt2 for cn0
…Insight/Qploidy2 into nQuack_implementation2
…Insight/Qploidy2 into nQuack_implementation2
N quack implementation2
There was a problem hiding this comment.
🟡 Changes recommended
Sex-chromosome parsing collapses X/Y identifiers to missing values, allowing markers from different chromosomes to be incorrectly associated with the same segment.
9 open issues
Preserve sex-chromosome IDs when parsing and joining markers · New Keep failed CN-specific fits penalized · New Exclude missing calls when calculating the mode · New Download to a temporary file before replacing the destination · New Infer sex from Y/W presence independently of full complement · New Apply min_samples_by_cluster to updog reference calls · New Exclude samples without usable genotypes from reference z-scores · New Preserve explicitly requested reference ploidy · New Do not lower minseglen when the chromosome is too short · New
What changed in this PR
Updates Qploidy2 from 1.16.1 to 1.24.0, expanding its copy-number analysis workflow with reference-based standardization, sex-chromosome support, and additional filtering and integration tools.
Changes:
- Adds sample and cluster filtering, reference-based z-scores, background removal, and safer segmentation.
- Extends HMM fitting, sex-aware karyotypes, result classification, and import/export support.
- Updates tests, API documentation, tutorials, and Claude Code setup guidance.
| File | Description |
|---|---|
| tests/testthat/test-standardization.R | Tests reference z-scores and updated summaries. |
| tests/testthat/test-re_standardize.R | Updates expected copy-number counts. |
| tests/testthat/test-karyotype.R | Adds sex-chromosome inference and plotting tests. |
| tests/testthat/test-hmm_cn.R | Expands HMM argument and windowing coverage. |
| README.md | Adds nQuack tutorial and Claude setup guidance. |
| R/zscore_segmentation.R | Adds chromosome-specific minima and segmentation safeguards. |
| R/utils.R | Whitespace-only change. |
| R/standardization.R | Adds filtering and reference-based depth normalization. |
| R/standardization_utils.R | Adds cluster thresholds and background removal. |
| R/split_mk_type.R | Classifies markers by sub-genome signal. |
| R/segre_test_cnv.R | Normalizes punctuation in comments and documentation. |
| R/prepare.R | Allows non-genotype VCF reads without GT. |
| R/plots_standardization.R | Updates theta labels and facet formatting. |
| R/plot_raw.R | Updates theta labels and model-selection defaults. |
| R/plot_karyotype.R | Supports sex chromosomes, reliability coloring, and masked calls. |
| R/pca_plot.R | Normalizes documentation punctuation. |
| R/merge_qploidy_data.R | Normalizes comments and documentation punctuation. |
| R/karyotype_notation.R | Adds sex inference and expected chromosome dosages. |
| R/install_claude_skills.R | Downloads workflow guidance into projects. |
| R/filter_hmm_CN.R | Adds quality masking and sample classification. |
| R/export_results.R | Groups summary helpers and adds MAPpoly/PennCNV interoperability. |
| R/em_hmm_cn.R | Revises emissions, priors, and single-window handling. |
| R/call_dosages.R | Updates heterozygosity defaults. |
| R/BAF_distributions.R | Updates BAF model-selection defaults. |
| NAMESPACE | Registers new exports, methods, and imports. |
| man/test_cn_segregation.Rd | Normalizes documentation punctuation. |
| man/summarize_cn_mode.Rd | Updates the documentation source pointer. |
| man/standardize.Rd | Documents new filtering options. |
| man/split_mk_type.Rd | Documents sub-genome marker classification. |
| man/simulate_cn_segregation.Rd | Normalizes documentation punctuation. |
| man/select_best_raw_model.Rd | Updates documented heterozygosity defaults. |
| man/select_best_baf_model.Rd | Updates documented model-selection defaults. |
| man/segreg_poly_cn.Rd | Normalizes documentation punctuation. |
| man/remove_background_noise.Rd | Documents background-signal filtering. |
| man/re_standardize.Rd | Documents filtering options and revised defaults. |
| man/print.count_types.Rd | Documents classification summary printing. |
| man/plot_xy_with_ploidy_guides.Rd | Normalizes documentation punctuation. |
| man/plot_tested_cn_segregation.Rd | Normalizes example notation. |
| man/plot_karyotype.Rd | Documents reliability coloring and sex chromosomes. |
| man/plot_cn_track_by_type.Rd | Documents grouped batch plot export. |
| man/plot_baf_with_ploidy_guides.Rd | Normalizes documentation punctuation. |
| man/pca_plot.Rd | Normalizes documentation punctuation. |
| man/merge_qploidy_datas.Rd | Normalizes documentation punctuation. |
| man/merge_cn_summary_with_estimates.Rd | Updates the documentation source pointer. |
| man/karyotype_notation.Rd | Documents sex-aware notation and expected dosages. |
| man/install_claude_skills.Rd | Documents workflow guidance installation. |
| man/import_penncnv_results.Rd | Documents PennCNV result import. |
| man/hmm_estimate_CN.Rd | Documents expanded HMM controls and emissions. |
| man/hmm_estimate_CN_nQuack.Rd | Documents the nQuack-based estimation route. |
| man/hmm_estimate_CN_multi.Rd | Clarifies forwarding of sex settings. |
| man/get_zscore.Rd | Documents reference-sample normalization. |
| man/get_centers.Rd | Documents minimum cluster sizes. |
| man/get_baf.Rd | Normalizes reference punctuation. |
| man/filter_hmm_CN.Rd | Documents quality thresholds and masking. |
| man/export_mappoly.Rd | Documents chromosome-level MAPpoly export. |
| man/em_hmm_cn.Rd | Documents BAF-only fitting and prior updates. |
| man/count_types.Rd | Documents ploidy classification and sex settings. |
| man/convert2nQuack.Rd | Documents standardized-BAF conversion and filtering. |
| man/compute_baf_likelihoods.Rd | Updates documented heterozygosity defaults. |
| man/compare_cn_track.Rd | Updates source pointer, colors, and confidence description. |
| man/compare_cn_track_summary.Rd | Documents multi-sample copy-number overview plots. |
| man/call_hmm_dosages.Rd | Updates documented heterozygosity defaults. |
| man/call_BAF_nQuack_dosages.Rd | Documents internal nQuack dosage assignment. |
| man/add_changepoint_windows.Rd | Documents chromosome-specific segment minima. |
| docs/BIcolors_template.css | Restyles inline code with light backgrounds. |
| DESCRIPTION | Bumps version and adds the nQuack dependency. |
| .Rbuildignore | Excludes Claude configuration and OAuth files. |
| .claude/agents/qploidy2-input-prep.md | Adds input-preparation workflow guidance. |
Review effort: Balanced
| } else if (baf_only) { | ||
| llb <- ll_baf_matrix[,k] | ||
| if(correct_scale) llb <- ifelse(n_baf > 0, llb / n_baf, 0) # n_baf == 0 would otherwise divide to NaN/Inf | ||
| llb[!is.finite(llb)] <- 0 |
| g <- dat[idx, , drop = FALSE] | ||
| row <- list( | ||
| Sample = g$Sample[1], | ||
| CN_mode = mode(g[[cn_col]]), |
Comment on lines
+55
to
+61
| tryCatch({ | ||
| utils::download.file(url, destfile = dest_file, quiet = TRUE) | ||
| message("Installed: ", dest_file) | ||
| installed <- c(installed, dest_file) | ||
| }, error = function(e) { | ||
| warning("Failed to download ", skill, ": ", conditionMessage(e)) | ||
| }) |
Comment on lines
+325
to
+326
| tbl$Sex <- ifelse(!valid, NA_character_, | ||
| ifelse(has_het == (sex_system == "XY"), "male", "female")) |
| rm_outlier = rm_outlier, | ||
| cluster_median = cluster_median) | ||
| cluster_median = cluster_median, | ||
| min_samples_by_cluster = min_samples_by_cluster) |
| # Z score | ||
| vmsg("Generating z scores", verbose = verbose, level = 0, type = ">>") | ||
| # Z-score mean/sd come from the reference samples in genos only | ||
| reference.samples <- unique(genos$SampleName) |
Comment on lines
+826
to
+830
| "ploidy.standardization (%d) differs from the mode of CN_call in dosages (%d). This may lead to unexpected results. ploidy.standardization is set to %d.", | ||
| ploidy.standardization, mode(hmm_CN_multi$by_marker$CN_call), mode(hmm_CN_multi$by_marker$CN_call) | ||
| )) | ||
| ploidy.standardization <- mode(hmm_CN_multi$by_marker$CN_call) | ||
| if(verbose) cat("Using ploidy.standardization:", ploidy.standardization, "\n") |
Comment on lines
+136
to
+137
| seg_len <- min(chr_minseglen, floor(length(z) / 2)) | ||
| if (!is.finite(seg_len) || seg_len < 1) seg_len <- 1L |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Many changes. See NEWs.md