Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
586adc7
change default
Cristianetaniguti Jul 28, 2026
b31e704
add cn limits
Cristianetaniguti Jul 29, 2026
20e2fa4
change news
Cristianetaniguti Jul 29, 2026
5093acd
bugfix
Cristianetaniguti Aug 6, 2026
b1def38
SAT-205
Cristianetaniguti Aug 10, 2026
6c61002
add to re_standardize
Cristianetaniguti Aug 10, 2026
59215f7
SAT-167
Cristianetaniguti Aug 11, 2026
2a6c9cb
turning HMM more conservative for segments
Cristianetaniguti Aug 12, 2026
0a50531
new summary functions
Cristianetaniguti Aug 12, 2026
aefe065
SAT-209
Cristianetaniguti Aug 12, 2026
40aaa94
update news
Cristianetaniguti Aug 14, 2026
686da48
SAT-209 update documentation
Cristianetaniguti Aug 14, 2026
71e2375
up version
Cristianetaniguti Aug 14, 2026
f3bc44d
v1.18.2
Cristianetaniguti Aug 19, 2026
cb09a45
force stand.ploidy if dosage estimated
Cristianetaniguti Aug 19, 2026
8ee1dbf
put back standardization
Cristianetaniguti Aug 20, 2026
f4f7e0d
change notations
Cristianetaniguti Aug 21, 2026
0e362df
copilot fixes
Cristianetaniguti Aug 24, 2026
084a1bf
correct news
Cristianetaniguti Aug 25, 2026
b33035a
function for allo
Cristianetaniguti Aug 28, 2026
bb8f5a2
allow CN0 for background
Cristianetaniguti Aug 28, 2026
bbe7a6e
remove CN NA from standardization
Cristianetaniguti Aug 29, 2026
11d2248
new filter for standardization
Cristianetaniguti Aug 31, 2026
a0e93ec
add baf only
Cristianetaniguti Sep 3, 2026
bf0561c
salmon adapt
Cristianetaniguti Sep 14, 2026
2d4baee
add claude skills
Cristianetaniguti Oct 20, 2026
e03243b
bugfixes
Cristianetaniguti Oct 21, 2026
1baa766
weight conflicting z and BAF
Cristianetaniguti Oct 22, 2026
c3d65a2
CN reliability change
Cristianetaniguti Oct 22, 2026
5e121ba
add support functions
Cristianetaniguti Oct 23, 2026
50dd1f5
v1.21.0
Cristianetaniguti Oct 23, 2026
b6f2dca
Merge pull request #18 from Breeding-Insight/SAT-213-Attempt2_for_CN0
Cristianetaniguti Oct 23, 2026
847d415
add tutorial
Cristianetaniguti Oct 23, 2026
228db65
Merge branch 'development' into nQuack_implementation2
Cristianetaniguti Oct 23, 2026
fb3bef8
remanage functions
Cristianetaniguti Oct 23, 2026
9bdda18
Merge branch 'nQuack_implementation2' of https://github.com/Breeding-…
Cristianetaniguti Oct 23, 2026
a1e0e6d
larger min window
Cristianetaniguti Oct 23, 2026
5647cc0
Merge branch 'development' into nQuack_implementation2
Cristianetaniguti Oct 23, 2026
aad6aab
fix copilot bugs
Cristianetaniguti Oct 23, 2026
2eb432d
Merge branch 'nQuack_implementation2' of https://github.com/Breeding-…
Cristianetaniguti Oct 23, 2026
1fdf4a8
independent hmm functions
Cristianetaniguti Oct 27, 2026
f3d79a7
nQuack integration documentation + fix checks
Cristianetaniguti Oct 27, 2026
6921c0d
v1.22.1
Cristianetaniguti Nov 2, 2026
67ad72d
v1.22.2
Cristianetaniguti Nov 3, 2026
d4fcdd9
v1.23.0
Cristianetaniguti Nov 3, 2026
c62f987
v1.23.1
Cristianetaniguti Nov 3, 2026
708a60f
add sex determination arguments
Cristianetaniguti Nov 4, 2026
21069dc
v1.24.0
Cristianetaniguti Nov 4, 2026
36f7ef4
add max_cn_dev
Cristianetaniguti Nov 5, 2026
6d032a1
Merge pull request #19 from Breeding-Insight/nQuack_implementation2
Cristianetaniguti Nov 5, 2026
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
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ $run_dev.*
^CRAN-SUBMISSION$
^README\.md$
^app\.R$
^\.claude$
^\.httr-oauth$
476 changes: 476 additions & 0 deletions .claude/agents/qploidy2-analysis.md

Large diffs are not rendered by default.

179 changes: 179 additions & 0 deletions .claude/agents/qploidy2-input-prep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
---
description: Guide for preparing the three required input data.frames (data, genos, genos.pos) for the Qploidy2 R package from VCF, Axiom, or Illumina array files.
---

# Qploidy2 Input Preparation

This skill guides you through preparing the three required input objects for `Qploidy2`:
- **`data`**: allele intensities or read counts per marker and sample
- **`genos`**: genotype dosages for reference samples
- **`genos.pos`**: genomic positions for each marker

## 1. Prerequisites — Check Before Starting

**Qploidy2 WORKS with:**
- Axiom or Illumina genotyping arrays
- Targeted sequencing (DArTag, GTseq, AgriSeq)
- Whole-genome sequencing (with sufficient coverage and filtering)
- Same library preparation protocol for all samples
- At least ~60 samples with known ploidy OR a known predominant ploidy
- Heterozygous samples

**Qploidy2 does NOT work with:**
- RADseq / GBS data (sparse, inconsistent marker coverage)
- Mixed sequencing batches in a single run — analyze each batch separately, then merge with `merge_qploidy_datas()`
- Exclusively inbred/homozygous lines
- First-generation colchicine-treated individuals (use their progeny instead)

## 2. Installation

```r
devtools::install_github("Breeding-Insight/Qploidy2")
library(Qploidy2)
```

## 3. Create the `data` Object

### From VCF (requires AD format field)

```r
data <- qploidy_read_vcf(vcf_file = "your_file.vcf")
head(data)
# Columns: MarkerName, SampleName, X (ref allele), Y (alt allele), R (X+Y), ratio (Y/R)
```

### From Axiom Array

```r
# summary file from apt-probeset-genotype (APT platform)
data <- read_axiom("AxiomGT1_summary.txt")
```

### From Illumina Array

```r
# File must contain [Data] section with columns: SNP Name, Sample ID, Theta, X, Y, etc.
data <- read_illumina_array(
"data/illumina/Set1.txt",
"data/illumina/Set2.txt" # merge multiple files
)
```

All three functions return the same structure: `MarkerName`, `SampleName`, `X`, `Y`, `R`, `ratio`.

## 4. Create the `genos` Object — Choose Path (1) or (2)

### Path (1): Subset with Known Ploidy (preferred)

Filter your samples to those with known ploidy for use as the standardization reference:

```r
known_tetraploids <- c("Sample1", "Sample2", ...) # your known-ploidy sample names
genos <- genos_full[which(genos_full$SampleName %in% known_tetraploids), ]
```

The samples in `genos` are the reference for **both** standardized signals: BAF cluster centers and the per-marker mean/SD of `R` used for z-scores. All other samples are transformed against them.

### Path (2): Use All Samples (most common ploidy unknown)

Run Qploidy2 on all samples first, then after identifying euploid individuals, re-standardize:

```r
# Use entire dataset as reference for first run
data_reference <- data
```

## 5. Call Dosages

### From VCF with GT field already present

```r
genos <- qploidy_read_vcf("your_file.vcf", geno = TRUE)
genos.pos <- qploidy_read_vcf("your_file.vcf", geno.pos = TRUE)

# If MarkerName column has NAs (missing VCF ID field):
genos.pos$MarkerName <- paste0(genos.pos$Chromosome, "_", genos.pos$Position)

# Filter to known-ploidy samples (Path 1):
genos <- genos[which(genos$SampleName %in% known_tetraploids), ]
```

### From VCF without GT — Use updog (sequencing data)

```r
library(tidyr)
library(updog)

ref <- pivot_wider(data[, 1:3], names_from = SampleName, values_from = X)
size <- pivot_wider(data[, c(1,2,5)], names_from = SampleName, values_from = R)
# convert to matrix...

multidog_obj <- multidog(
refmat = ref, sizemat = size,
model = "norm", # adjust to your population
ploidy = 4, # most common/known ploidy
nc = 2
)

genos <- data.frame(
MarkerName = multidog_obj$inddf$snp,
SampleName = multidog_obj$inddf$ind,
geno = multidog_obj$inddf$geno,
prob = multidog_obj$inddf$maxpostprob
)
```

### From Axiom — Use fitPoly

```r
library(fitPoly)
saveMarkerModels(
ploidy = 4,
data = data_reference,
filePrefix = "fitpoly_output/prefix",
ncores = 2
)

library(vroom)
fitpoly_scores <- vroom("fitpoly_output/prefix_scores.dat")

genos <- data.frame(
MarkerName = fitpoly_scores$MarkerName,
SampleName = fitpoly_scores$SampleName,
geno = fitpoly_scores$maxgeno,
prob = fitpoly_scores$maxP
)
```

### Genomic positions for array data (not in summary files)

Provide a separate file with chromosome and position per marker:

```r
genos.pos_file <- read.table("marker_positions.txt", header = TRUE)
genos.pos <- data.frame(
MarkerName = genos.pos_file$probes,
Chromosome = genos.pos_file$chr,
Position = genos.pos_file$pos
)
```

## 6. Final Check

By the end you should have three objects ready:

| Object | Required columns |
|-------------|------------------|
| `data` | MarkerName, SampleName, X, Y, R, ratio |
| `genos` | MarkerName, SampleName, geno, prob |
| `genos.pos` | MarkerName, Chromosome, Position |

Proceed to the Qploidy2 analysis workflow (`qploidy2-analysis` skill).

## Key Tips

- **Batch effect**: Never mix samples from different library preparation batches in one run.
- **Path (2) users**: After the first run, go back and re-run dosage calling using only the identified euploids, then re-standardize.
- **Compute tip**: Dosage calling (updog / fitPoly) is slow — run on HPC with multiple cores.
- **Recommended dosage callers**: `updog` or `polyRAD` for sequencing; `fitPoly` for arrays.
- **Sex chromosomes**: keep X-specific, Y-specific (or Z/W), and pseudoautosomal (PAR) markers under separate `Chromosome` IDs in `genos.pos` (e.g. `"ChrX"`, `"ChrY"`, `"ChrX_PAR"`). These IDs are passed later as `sex_chr` (see `qploidy2-analysis`). For the reference in `genos`, prefer samples of a single sex, or only autosomal/PAR markers, so the different sex-chromosome dosages between males and females don't distort standardization.
9 changes: 5 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: Qploidy2
Title: Estimation of Large-Scale Copy Number Variation Using Genotyping Data
Version: 1.16.1
Version: 1.24.0
Authors@R: c(person(given='Cristiane',
family='Taniguti',
email = 'ctaniguti@ufl.edu',
Expand Down Expand Up @@ -50,7 +50,8 @@ Imports:
data.table,
purrr,
scales,
tibble
tibble,
nQuack (>= 1.0.5)
Encoding: UTF-8
URL: https://github.com/Breeding-Insight/Qploidy2
BugReports: https://github.com/Breeding-Insight/Qploidy2/issues
Expand All @@ -59,12 +60,12 @@ RoxygenNote: 7.3.3
Suggests:
covr,
spelling,
updog,
rmdformats,
knitr (>= 1.10),
rmarkdown,
testthat (>= 3.0.0),
plotly,
AGHmatrix
AGHmatrix,
updog
Config/testthat/edition: 3
Language: en-US
24 changes: 24 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by roxygen2: do not edit by hand

S3method(plot,mappoly.homoprob)
S3method(print,count_types)
S3method(print,hmm_CN)
S3method(print,qploidy_area_ploidy_estimation)
S3method(print,qploidy_standardization)
Expand All @@ -15,12 +16,16 @@ export(call_hmm_dosages)
export(chromosome_level_test_plot_qploidy)
export(clean_summary)
export(compare_cn_track)
export(compare_cn_track_summary)
export(compute_baf_likelihoods)
export(convert2nQuack)
export(count_breaks_df)
export(count_breaks_plot)
export(count_types)
export(define_z_limits)
export(export_VCF)
export(export_mappoly)
export(filter_hmm_CN)
export(find_header_line)
export(generate_baf_template)
export(get_R_theta)
Expand All @@ -33,6 +38,9 @@ export(get_probs_sing)
export(get_zscore)
export(hmm_estimate_CN)
export(hmm_estimate_CN_multi)
export(hmm_estimate_CN_nQuack)
export(import_penncnv_results)
export(install_claude_skills)
export(karyotype_notation)
export(merge_arms_format)
export(merge_cn_summary_with_estimates)
Expand All @@ -42,6 +50,7 @@ export(plot_baf)
export(plot_baf_hist)
export(plot_baf_with_ploidy_guides)
export(plot_cn_track)
export(plot_cn_track_by_type)
export(plot_geno_by_marker)
export(plot_heterozygosity)
export(plot_karyotype)
Expand All @@ -56,6 +65,7 @@ export(read_hmm_CN)
export(read_illumina_array)
export(read_polyOrigin)
export(read_qploidy_standardization)
export(remove_background_noise)
export(rename_samples)
export(rm_outlier)
export(segreg_poly_cn)
Expand All @@ -66,6 +76,7 @@ export(simulate_cn_segregation)
export(simulate_illumina_file)
export(simulate_standardization_input)
export(simulate_vcf)
export(split_mk_type)
export(standardize)
export(summarize_cn_mode)
export(summary_to_fitpoly)
Expand Down Expand Up @@ -105,23 +116,30 @@ importFrom(dplyr,full_join)
importFrom(dplyr,group_by)
importFrom(dplyr,if_else)
importFrom(dplyr,inner_join)
importFrom(dplyr,lag)
importFrom(dplyr,left_join)
importFrom(dplyr,mutate)
importFrom(dplyr,n_distinct)
importFrom(dplyr,pull)
importFrom(dplyr,rename)
importFrom(dplyr,row_number)
importFrom(dplyr,select)
importFrom(dplyr,slice)
importFrom(dplyr,summarise)
importFrom(dplyr,summarize)
importFrom(dplyr,ungroup)
importFrom(ggplot2,aes)
importFrom(ggplot2,coord_cartesian)
importFrom(ggplot2,element_blank)
importFrom(ggplot2,element_line)
importFrom(ggplot2,element_rect)
importFrom(ggplot2,element_text)
importFrom(ggplot2,expansion)
importFrom(ggplot2,facet_grid)
importFrom(ggplot2,facet_wrap)
importFrom(ggplot2,geom_bar)
importFrom(ggplot2,geom_density)
importFrom(ggplot2,geom_hline)
importFrom(ggplot2,geom_point)
importFrom(ggplot2,geom_rect)
importFrom(ggplot2,geom_segment)
Expand Down Expand Up @@ -157,6 +175,8 @@ importFrom(ggpubr,get_legend)
importFrom(ggpubr,ggarrange)
importFrom(ggpubr,text_grob)
importFrom(grDevices,colorRampPalette)
importFrom(grDevices,dev.off)
importFrom(grDevices,png)
importFrom(grDevices,rainbow)
importFrom(graphics,hist)
importFrom(magrittr,"%>%")
Expand Down Expand Up @@ -186,11 +206,13 @@ importFrom(stats,pnorm)
importFrom(stats,prcomp)
importFrom(stats,quantile)
importFrom(stats,rbinom)
importFrom(stats,reshape)
importFrom(stats,rnorm)
importFrom(stats,runif)
importFrom(stats,sd)
importFrom(stats,setNames)
importFrom(stats,t.test)
importFrom(stringr,str_extract)
importFrom(tibble,column_to_rownames)
importFrom(tidyr,as_tibble)
importFrom(tidyr,crossing)
Expand All @@ -200,7 +222,9 @@ importFrom(tidyr,unnest)
importFrom(utils,combn)
importFrom(utils,read.csv)
importFrom(utils,read.delim)
importFrom(utils,setTxtProgressBar)
importFrom(utils,tail)
importFrom(utils,txtProgressBar)
importFrom(utils,write.csv)
importFrom(utils,write.table)
importFrom(vroom,vroom_write)
Loading
Loading