slide_codon: Generate sliding windows for codon-level analysis
Description
slide_codon creates sliding window intervals specifically designed
for codon-based analysis of DNA sequences. This function automatically
handles codon boundaries and is useful for studying positional effects
in codon usage within genes.
Usage
slide_codon(seq, step = 1, before = 0, after = 0)
Value
A data.table with three columns containing nucleotide positions:
start: Start nucleotide position of each window
center: Center nucleotide position of each window
end: End nucleotide position of each window
Arguments
seq
A DNA sequence as a DNAString object, or any object that can
be coerced to DNAString.
step
Integer specifying the step size between consecutive window centers
in codons (default: 1). A step of 3 creates non-overlapping windows.
before
Integer specifying the number of codons to include before
the window center (default: 0).
after
Integer specifying the number of codons to include after
the window center (default: 0).
# Create sliding windows for codon analysisx <- Biostrings::DNAString('ATCTACATAGCTACGTAGCTCGATGCTAGCATGCATCGTACGATCGTCGATCGTAG')
slide_codon(x, step = 3, before = 1, after = 1)