Skip to contents

Extracts genomic DNA sequences for all genes in the experiment and writes them to FASTA files. Sequences are retrieved from species-specific reference genomes and reverse-complemented if on the minus strand.

Usage

orthogroupDNA(data, nbThreads = 1, byOrthogroup = TRUE)

Arguments

data

List. Experiment object from newExperiment containing:

orthogroups

GRanges with genomic coordinates and metadata columns geneID, orthogroupID, speciesID.

speciesInfo

data.frame with speciesID and genome (path to reference FASTA).

dirs$dna

Output directory for FASTA files.

nbThreads

Integer. Total number of threads available.

byOrthogroup

Logical. Output file organization:

  • TRUE (default): One FASTA per orthogroup containing all species.

  • FALSE: One FASTA per gene.

Value

Invisibly returns a named DNAStringSet containing all extracted sequences, with gene IDs as names.

Details

The function processes genes grouped by species to optimize I/O: each genome is loaded once and all genes for that species are extracted before moving to the next. For genes on the minus strand, the reverse complement is returned so all sequences are in 5' to 3' orientation.

Output Files

Files are written to data$dirs$dna:

  • If byOrthogroup = TRUE: <orthogroupID>.fa files, each containing one sequence per species.

  • If byOrthogroup = FALSE: <geneID>.fa files, one per gene.