How GenomicFeatures cdsBy() accounts for the frame info in the gff to get the CDS? The info in the the 8th gff field
https://m.ensembl.org/info/website/upload/gff.html
frame - One of '0', '1' or '2'. '0' indicates that the first base of the feature is the first base of a codon, '1' that the second base is the first base of a codon, and so on..
Here is an ex of what I see in my gff
NC_042565.1 Gnomon CDS 41062 41423 . - 0 ID=cds-XP_021394452.1;Parent=rna-XM_021538777.2;Dbxref=GeneID:110474964,Genbank:XP_021394452.1;Name=XP_021394452.1;gbkey=CDS;gene=LCMT2;product=tRNA wybutosine-synthesizing protein 4;protein_id=XP_021394452.1
NC_042565.1 Gnomon CDS 39337 39418 . - 1 ID=cds-XP_021394452.1;Parent=rna-XM_021538777.2;Dbxref=GeneID:110474964,Genbank:XP_021394452.1;Name=XP_021394452.1;gbkey=CDS;gene=LCMT2;product=tRNA wybutosine-synthesizing protein 4;protein_id=XP_021394452.1
NC_042565.1 Gnomon CDS 38834 39014 . - 0 ID=cds-XP_021394452.1;Parent=rna-XM_021538777.2;Dbxref=GeneID:110474964,Genbank:XP_021394452.1;Name=XP_021394452.1;gbkey=CDS;gene=LCMT2;product=tRNA wybutosine-synthesizing protein 4;protein_id=XP_021394452.1
NC_042565.1 Gnomon CDS 36546 36702 . - 2 ID=cds-XP_021394452.1;Parent=rna-XM_021538777.2;Dbxref=GeneID:110474964,Genbank:XP_021394452.1;Name=XP_021394452.1;gbkey=CDS;gene=LCMT2;product=tRNA wybutosine-synthesizing protein 4;protein_id=XP_021394452.1
NC_042565.1 Gnomon CDS 35950 36139 . - 1 ID=cds-XP_021394452.1;Parent=rna-XM_021538777.2;Dbxref=GeneID:110474964,Genbank:XP_021394452.1;Name=XP_021394452.1;gbkey=CDS;gene=LCMT2;product=tRNA wybutosine-synthesizing protein 4;protein_id=XP_021394452.1
NC_042565.1 Gnomon CDS 35437 35544 . - 0 ID=cds-XP_021394452.1;Parent=rna-XM_021538777.2;Dbxref=GeneID:110474964,Genbank:XP_021394452.1;Name=XP_021394452.1;gbkey=CDS;gene=LCMT2;product=tRNA wybutosine-synthesizing protein 4;protein_id=XP_021394452.1
NC_042565.1 Gnomon CDS 33345 33435 . - 0 ID=cds-XP_021394452.1;Parent=rna-XM_021538777.2;Dbxref=GeneID:110474964,Genbank:XP_021394452.1;Name=XP_021394452.1;gbkey=CDS;gene=LCMT2;product=tRNA wybutosine-synthesizing protein 4;protein_id=XP_021394452.1
NC_042565.1 Gnomon CDS 30949 31197 . - 2 ID=cds-XP_021394452.1;Parent=rna-XM_021538777.2;Dbxref=GeneID:110474964,Genbank:XP_021394452.1;Name=XP_021394452.1;gbkey=CDS;gene=LCMT2;product=tRNA wybutosine-synthesizing protein 4;protein_id=XP_021394452.1
NC_042565.1 Gnomon CDS 28678 28908 . - 2 ID=cds-XP_021394452.1;Parent=rna-XM_021538777.2;Dbxref=GeneID:110474964,Genbank:XP_021394452.1;Name=XP_021394452.1;gbkey=CDS;gene=LCMT2;product=tRNA wybutosine-synthesizing protein 4;protein_id=XP_021394452.1
NC_042565.1 Gnomon CDS 27570 27667 . - 2 ID=cds-XP_021394452.1;Parent=rna-XM_
I'm using cdsBy() to get cds sequences (see bellow), which will serve as input to calc dNdS with orthologr dNdS() https://drostlab.github.io/orthologr/index.html
# load GTF
txdb <- makeTxDbFromGFF("BFgenomic.gff", format="gff3")
Import genomic features from the file as a GRanges object ... OK
Prepare the 'metadata' data frame ... OK
Make the TxDb object ... OK
# Get dna seq
dna <- readDNAStringSet("/users/mfariasv/data/mfariasv/newBF20/BFgenomic.fa")
# extract CDS
txdb.cds_by_transcript <- cdsBy(txdb, by="tx", use.names = TRUE)
Makes sense! Thank you -mdz