Repository navigation
Releases
v1.24.0 - Avoiding wide CN range and false positives
-
hmm_estimate_CN_nQuack()now accepts CN 1 incn_grid(any subset of1: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_fracandexp_ploidyis 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.
- CN 1 has no nQuack model. In windows whose heterozygous fraction reaches
-
hmm_estimate_CN(),hmm_estimate_CN_nQuack(), andhmm_estimate_CN_multi()(through...) gainmax_cn_dev.- After
exp_ploidyis set (estimated on the fullcn_grid, or given by the user),cn_gridis restricted to states withinmax_cn_devof it. For example,cn_grid = 1:6,exp_ploidy = 2,max_cn_dev = 2tests1:4. - In
hmm_estimate_CN(), CN 0 is kept whenever it is incn_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.
- After
-
Fixed "missing value where TRUE/FALSE needed" in
hmm_estimate_CN()andhmm_estimate_CN_nQuack()when the post-decoding override met a chromosome whose windows were allNA. It now skips such chromosomes. -
compare_cn_track_summary()gainssex_systemandsex_chrarguments. When not supplied, the values stored in thehmm_CNparams 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
Sexcolumn (e.g."M (XY)","F (XX)","M (XXXY)", or"?"when unknown) is added between the matrix and the block labels.
- Samples are classified as in
v1.23.0 - Sex determination features
-
Fixed
standardize()computing z-scores with the mean and SD ofRacross all samples indata, even whengenosheld only a subset of reference samples. The per-marker mean and SD now come only from the samples ingenosthat remain after filtering, and every sample is transformed against them, matching how BAF uses the reference samples. This changes z-score values whenevergenosis a subset ofdata. -
get_zscore()gains areference.samplesargument. Its default,NULL, uses all samples as before. -
filter_R = TRUEinstandardize()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()andplot_karyotype()gainsex_system("none","XY","ZW","X0","haplodiploid") andsex_chr(a named list of chromosome IDs forX/Y/PARorZ/W/PAR) arguments. When set,karyotype_notation()addsSex,SexChr(e.g."XY","XXXY","ZW","X0"),SexChrConsistent,ChrType, andExpectedCNcolumns:- 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()andhmm_estimate_CN_nQuack()now report how many windowsmin_snps_per_windowremoves. 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. Whenmin_snps_per_windowis left at its default (NULL), the value chosen automatically is now printed. -
min_snps_per_windowinhmm_estimate_CN(),hmm_estimate_CN_nQuack(), andhmm_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 forminseglen. Theplot_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
-
Added
hmm_estimate_CN_nQuack(), a self-contained analogue ofhmm_estimate_CN()that uses thenQuackpackage for both whole-sample ploidy estimation and per-window BAF likelihoods/dosage calling. RequiresnQuack >= 1.0.5(install withremotes::install_github("mgaynor1/nQuack@updateGL")).cn_gridmust be a subset of2:6(nQuack's supported range); usehmm_estimate_CN()for CN=0/1/LOH detection. -
.nquack_estimate_ploidy()'s model selection restricts totype == "fixed"(mixing proportions only; means/variance fixed at theoretical dosage positions) before comparing BIC across distributions and mixtures. The now-discardedfree/fixed_2/fixed_3fits 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_bafparameter (defaultTRUE) toconvert2nQuack(), deriving allele counts from the standardization-correctedbafcolumn instead of rawX/Ycounts. -
Added the
Qploidy2_nQuack_tutorial.Rmdvignette, covering the nQuack EM-based BAF model selection route and exporting standardized BAF data viaconvert2nQuack(). -
Fixed
em_hmm_cn()(used by bothhmm_estimate_CN()andhmm_estimate_CN_nQuack()): chromosomes that collapse to a single window no longer crash withsubscript out of bounds.