R/detect_ref_genome.R
detect_ref_genome.RdDetermine if genomic data were produced using a **reference genome** (reference-assisted assembly) or using a **de novo assembly**.
The function integrates multiple sources of evidence depending on the input provided:
1. Radiator GDS (preferred) If a radiator-generated GDS is supplied, the function checks, in order:
the /radiator/reference.genome node (logical value);
the /radiator/markers.meta/CHROM field;
the SeqArray chromosome node.
2. VCF imported with SeqArray or read by radiator When a VCF has been converted to GDS via SeqArray, or when a VCF file is provided directly, the function may detect reference-guided assembly from:
the VCF header’s ##reference= field;
the presence of ##contig=<ID=...> definitions;
the structure of chromosome labels.
3. Data-source-specific heuristics Additional rules are applied for specific pipelines:
Stacks: optionally, detection of . or + in
annotation/id (see internal comments in the function body);
GATK: chromosome names containing "contig";
FreeBayes: inspection of reference and contig metadata in the VCF header.
detect_ref_genome(data = NULL, verbose = TRUE)A radiator GDS object, a SeqArray GDS object, or a path to a file.
If provided, the function extracts information from radiator metadata,
SeqArray header fields, markers.meta, and other pipeline-specific
indicators.
Default: data = NULL.
(logical, optional)
When TRUE, the function prints messages describing the decision
process and final classification.
Default: verbose = TRUE.
A single logical value:
TRUE – reference-assisted assembly;
FALSE – de novo assembly.
if (FALSE) { # \dontrun{
# Using a radiator GDS file
gds <- radiator::read_rad("my_data.gds")
ref.genome <- radiator::detect_ref_genome(data = gds)
# Using a VCF file directly
ref.genome <- radiator::detect_ref_genome(data = "variants.vcf.gz")
} # }