Skip to content

Releases

v1.24.0 - Avoiding wide CN range and false positives

Choose a tag to compare

@Cristianetaniguti Cristianetaniguti released this 05 Nov 20:09
7e942a1
  • hmm_estimate_CN_nQuack() now accepts CN 1 in cn_grid (any subset of 1:6):

    • CN 1 has no nQuack model. In windows whose heterozygous fraction reaches min_het_frac, its BAF log-likelihood is set to the lowest of the other states. Otherwise BAF is neutral and z decides.
    • When the sample-wide heterozygous fraction is at most min_het_frac and exp_ploidy is not given, the sample is treated as haploid (exp_ploidy = 1) and the nQuack global fit is skipped.
    • Windows called CN 1 get homozygous-only dosages.
    • CN 0 remains unsupported on the nQuack route. It is only meaningful for array data, whose probes keep background signal without copies, and nQuack is for sequencing data only. Use hmm_estimate_CN() for CN 0.
  • hmm_estimate_CN(), hmm_estimate_CN_nQuack(), and hmm_estimate_CN_multi() (through ...) gain max_cn_dev.

    • After exp_ploidy is set (estimated on the full cn_grid, or given by the user), cn_grid is restricted to states within max_cn_dev of it. For example, cn_grid = 1:6, exp_ploidy = 2, max_cn_dev = 2 tests 1:4.
    • In hmm_estimate_CN(), CN 0 is kept whenever it is in cn_grid.
    • This avoids false calls in mixed-ploidy populations, where a wide grid compresses the z-score spacing between states. The default, NULL, keeps the full grid.
  • Fixed "missing value where TRUE/FALSE needed" in hmm_estimate_CN() and hmm_estimate_CN_nQuack() when the post-decoding override met a chromosome whose windows were all NA. It now skips such chromosomes.

  • compare_cn_track_summary() gains sex_system and sex_chr arguments. When not supplied, the values stored in the hmm_CN params are used; sex_system = NULL (or "none") disables them, and other values override them. When enabled:

    • Samples are classified as in count_types(), so XY males are not counted as aneuploid.
    • A Sex column (e.g. "M (XY)", "F (XX)", "M (XXXY)", or "?" when unknown) is added between the matrix and the block labels.

v1.23.0 - Sex determination features

Choose a tag to compare

@Cristianetaniguti Cristianetaniguti released this 05 Nov 20:06
  • Fixed standardize() computing z-scores with the mean and SD of R across all samples in data, even when genos held only a subset of reference samples. The per-marker mean and SD now come only from the samples in genos that remain after filtering, and every sample is transformed against them, matching how BAF uses the reference samples. This changes z-score values whenever genos is a subset of data.

  • get_zscore() gains a reference.samples argument. Its default, NULL, uses all samples as before.

  • filter_R = TRUE in standardize() now limits z-scores to markers that passed all BAF filters (missing data and number of clusters). Previously it applied only the missing-data filter.

  • karyotype_notation() and plot_karyotype() gain sex_system ("none", "XY", "ZW", "X0", "haplodiploid") and sex_chr (a named list of chromosome IDs for X/Y/PAR or Z/W/PAR) arguments. When set, karyotype_notation() adds Sex, SexChr (e.g. "XY", "XXXY", "ZW", "X0"), SexChrConsistent, ChrType, and ExpectedCN columns:

    • In XY, Y present means male. In ZW, W present means female.
    • In X0, sex comes from X copy number relative to the ploidy. In haplodiploid systems, sex comes from the sample ploidy.
    • When X-specific or Y-specific markers are missing, their copy number is derived from the PAR (Y = PAR − X). When all three groups are present, X + Y = PAR is checked.
    • Sex chromosomes are excluded from the sample ploidy.
    • Segments on sex chromosomes are flagged against the expected sex-chromosome complement instead of the ploidy.

    plot_karyotype() uses the expected complement for ghost copies, labels sex-chromosome strips, and adds the sex to the subtitle.

  • hmm_estimate_CN() and hmm_estimate_CN_nQuack() now report how many windows min_snps_per_window removes. If every window of a chromosome is removed, they warn and name the chromosome and its marker count. Previously, small chromosomes such as sex-specific contigs disappeared from the results silently. When min_snps_per_window is left at its default (NULL), the value chosen automatically is now printed.

  • min_snps_per_window in hmm_estimate_CN(), hmm_estimate_CN_nQuack(), and hmm_estimate_CN_multi() can now be set per chromosome with a vector named by chromosome ID, e.g. c(Chr01 = 300, Xspecific = 20). Chromosomes left out of the vector use the automatic default. The per-chromosome value applies both to the minimum segment length in z-score changepoint detection and to the window filter. add_changepoint_windows() accepts the same named form for minseglen. The plot_cn_track() parameter panel shows a per-chromosome value in short form: the most common value plus up to two exceptions, or the range when more chromosomes differ.

nQuack EM Implementation

Choose a tag to compare

@Cristianetaniguti Cristianetaniguti released this 05 Nov 20:02
  • Added hmm_estimate_CN_nQuack(), a self-contained analogue of hmm_estimate_CN() that uses the nQuack package for both whole-sample ploidy estimation and per-window BAF likelihoods/dosage calling. Requires nQuack >= 1.0.5 (install with remotes::install_github("mgaynor1/nQuack@updateGL")). cn_grid must be a subset of 2:6 (nQuack's supported range); use hmm_estimate_CN() for CN=0/1/LOH detection.

  • .nquack_estimate_ploidy()'s model selection restricts to type == "fixed" (mixing proportions only; means/variance fixed at theoretical dosage positions) before comparing BIC across distributions and mixtures. The now-discarded free/fixed_2/fixed_3 fits can still emit benign "NaNs produced" warnings from nQuack's internal EM steps for the degenerate solutions; these are suppressed since they don't affect the selected result.

  • Added from_standardized_baf parameter (default TRUE) to convert2nQuack(), deriving allele counts from the standardization-corrected baf column instead of raw X/Y counts.

  • Added the Qploidy2_nQuack_tutorial.Rmd vignette, covering the nQuack EM-based BAF model selection route and exporting standardized BAF data via convert2nQuack().

  • Fixed em_hmm_cn() (used by both hmm_estimate_CN() and hmm_estimate_CN_nQuack()): chromosomes that collapse to a single window no longer crash with subscript out of bounds.