
Compute Multiple Sequence Alignments for Orthogroups
orthogroupMSA.RdAligns orthologous gene sequences across species using an external alignment tool (MAFFT or Kalign). Alignments are computed for each orthogroup and saved as FASTA files.
Arguments
- data
List. Experiment object from
newExperimentcontaining:orthogroupsGRanges with
orthogroupIDmetadata.dirs$dnaDirectory containing input FASTA files from
orthogroupDNA.dirs$msaOutput directory for alignment files.
- method
Character. Alignment tool to use:
"mafft"(default): MAFFT with automatic algorithm selection."kalign": Kalign3 (faster, less accurate for divergent sequences).
- nbThreads
Integer. Total number of threads available. Multiple orthogroups are aligned in parallel using
nbThreads / nbThreadsByOrthogroupworkers. Default: 1.- nbThreadsByOrthogroup
Integer. Threads allocated to each alignment job. Default: 1.
Details
The function implements a two-level parallelization strategy:
Outer level: Multiple orthogroups are processed in parallel.
Inner level: Each alignment tool uses multiple threads.
The number of parallel orthogroup jobs is floor(nbThreads / nbThreadsByOrthogroup).
For example, with nbThreads = 8 and nbThreadsByOrthogroup = 2,
4 orthogroups are aligned simultaneously, each using 2 threads.
Output Files
Alignments are written to data$dirs$msa as:
<orthogroupID>_msa.fa: FASTA format, one file per orthogroup.
See also
orthogroupDNA to extract sequences (previous step),
loadMSA to load alignments.
Examples
if (FALSE) { # \dontrun{
data <- newExperiment(sampleInfo, speciesInfo, orthogroups,
dnaDir, msaDir, speciesTree)
orthogroupDNA(data, nbThreads = 4)
# Align with MAFFT (8 threads total, 2 per alignment = 4 parallel jobs)
orthogroupMSA(data, method = "mafft", nbThreads = 8, nbThreadsByOrthogroup = 2)
# Check output
list.files(data$dirs$msa, pattern = "_msa.fa$")
} # }