This document describes the workflow used to assign gene names to the CGC2/CGC3 gene annotation by transferring and, where appropriate, propagating gene names from annotated orthologs in Caenorhabditis briggsae AF16 and/or C. elegans N2.
The workflow combines:
- OrthoFinder orthogroups to define conserved gene-copy relationships among CGC2, AF16, QX1410, and N2.
- Reciprocal best BLAST hits (RBBHs) to identify the most likely transcript-level orthologs within those orthogroups.
- Existing AF16 and N2 gene names as naming references.
- Explicit rules for direct name transfer and paralog-name propagation.
- Post-processing to enforce unique names and propagate longest-isoform assignments to all isoforms of a CGC2 gene.
- Export of the renamed annotation in both consequence-annotation and WormBase-style GFF formats.
The main principle is to use the most specific orthology evidence available while avoiding unsupported propagation across ambiguous gene families.
This workflow is similar, but much simpler, as it only transfers annotations from N2 to NIC58 (CGC3) - leading to fewer possible orthogroup patterns (1:1, 1:N, N:N)
The workflow uses longest-isoform GFF annotations for N2, AF16, QX1410, and CGC2, together with the original full CGC2 annotation so that final names can later be propagated from the representative transcript to all isoforms.
OrthoFinder orthogroups are loaded and the species columns are renamed to concise strain identifiers.
orthos <- readr::read_tsv(
"../processed_data/orthofinder/briggsae/Orthogroups.tsv"
) %>%
dplyr::rename(
QX1410 = c_briggsae.QX1410_20250929.csq.longest.protein,
CGC2 = CGC2.softMasked.braker.longest.protein,
AF16 = c_briggsae.PRJNA10731.WS280.protein_coding.longest.prot,
N2 = N2.WBonly.WS283.PConly.prot
)For each species, the number of genes represented in each orthogroup is calculated from the comma-separated transcript list. These copy counts are the basis for classifying orthogroups into different conservation patterns.
The workflow focuses on orthogroups whose copy numbers are stable across selected taxa. The notation below gives the copy-number relationship in the order:
N2 : CGC2 : AF16 : QX1410
Here, 1 denotes a single-copy gene, N denotes the same multi-copy number among the indicated taxa, and X denotes a strain/species whose copy number is not required to match.
The principal patterns are:
| Pattern | Interpretation |
|---|---|
1:1 |
Single-copy orthology between CGC2 and a reference species |
1:N:N:N |
N2 is single-copy; CGC2, AF16, and QX1410 share the same multi-copy expansion |
1:N:X:N |
N2 is single-copy; CGC2 and QX1410 share the same multi-copy expansion; AF16 is unconstrained |
N:N:N:N |
All four strains/species have the same multi-copy number |
N:N:X:N |
N2, CGC2, and QX1410 have the same multi-copy number; AF16 is unconstrained |
X:N:N:N |
CGC2, AF16, and QX1410 have the same multi-copy number; N2 is unconstrained |
For multi-copy analyses, orthogroups are restricted to at most four CGC2 members. This restriction is important because the paralog-enumeration code searches for unused suffixes within 1:4.
The workflow focuses on orthogroups whose copy numbers are stable across selected taxa. The notation below gives the copy-number relationship in the order:
N2 : CGC3
The principal patterns are:
| Pattern | Interpretation |
|---|---|
1:1 |
Single-copy orthology between CGC3 and N2 |
1:N |
N2 is single-copy; CGC3 isn't |
N:N |
N2 and CGC3 have equal copy number. |
For multi-copy analyses, orthogroups are restricted to at most four CGC3 and N2 members. This restriction is important because the paralog-enumeration code searches for unused suffixes within 1:4.
Existing names are extracted separately from AF16 and N2 GFF annotations.
For AF16, the workflow resolves the locus field from the mRNA attributes and removes the Cbr- prefix. AF16 identifiers beginning with CBG are treated as uninformative systematic identifiers rather than informative gene names.
For N2, gene-level aliases are linked back to mRNA IDs so that transcript-level orthology mappings can retrieve the corresponding gene name.
The resulting lookup tables have the conceptual structure:
reference transcript -> reference gene/locus name
Because OrthoFinder stores multiple members as comma-separated strings, each species column is converted into a long transcript-to-orthogroup table.
CGC2_tranbyog <- orthos %>%
select(Orthogroup, CGC2_transcript = CGC2) %>%
separate_longer_delim(CGC2_transcript, delim = ",") %>%
mutate(CGC2_transcript = trimws(CGC2_transcript)) %>%
filter(!is.na(CGC2_transcript), CGC2_transcript != "")Equivalent tables are generated for N2, AF16, and QX1410.
These tables allow each transcript-level similarity hit to be checked against its OrthoFinder orthogroup.
Protein BLAST searches were performed in both directions for:
- CGC2 versus N2
- CGC2 versus AF16
For each query, the best significant hit is chosen by:
- requiring
E < 0.05; - sorting by decreasing bitscore and then increasing E-value;
- retaining the top hit.
A reciprocal best hit is retained only when the best hit in one direction points back to the original transcript in the reverse search.
N2_to_CGC2_RBBH <- CGC2_to_N2_best %>%
inner_join(
N2_to_CGC2_best,
by = c("query" = "subject", "subject" = "query")
)The resulting RBBHs are then joined to the transcript-to-orthogroup tables. A pair is accepted only when the reference transcript and CGC2 transcript belong to the same OrthoFinder orthogroup.
This extra orthogroup requirement prevents a high-scoring reciprocal similarity match from being used when it conflicts with the broader orthology assignment.
The workflow uses a hierarchical naming strategy.
- Direct one-to-one assignments are preferred whenever a single-copy ortholog is available.
- For conserved multi-copy families, AF16 is used first when its gene name is informative and transcript-level RBBHs resolve individual members.
- N2 is used when AF16 cannot provide an informative name, especially for
1:Nrelationships where a single N2 gene corresponds to a CGC2 expansion. - Gene-name propagation is restricted to orthogroups where the family structure supports a common gene root.
- Residual RBBHs are appended after the structured orthogroup-based naming procedure.
- Systematic AF16
CBG...identifiers are retained only as a fallback.
- Direct one-to-one assignments are preferred whenever a single-copy ortholog is available.
- Gene-name propagation is restricted to orthogroups where the family structure supports a common N2 gene root.
- For conserved multi-copy families, N2 is used when transcript-level RBBHs resolve individual members.
- Residual RBBHs are appended after the structured orthogroup-based naming procedure.
Each final assignment records:
name: assigned CGC2/3 name;name_source: reference annotation used (AF16orN2);name_method: rule that produced the assignment;pattern: orthogroup copy-number pattern;mapped_transcript: reference transcript supporting the assignment;propagate_source: CGC2/3 transcript(s) whose directly mapped name was used as the source for propagation, where available;match_identity: protein percent identity of the relevant CGC2/3-to-reference match, where available.
Single-copy CGC2/3 genes are assigned names directly from one-to-one orthologs.
N2 or AF16 single-copy ortholog tables are joined to their reference name lookup tables. Informative AF16 names are used where available; AF16 CBG... systematic identifiers are not treated as informative names at this stage.
These assignments are marked:
pattern = 1.1
name_method = direct_1to1
In 1:N:N:N orthogroups, N2 contains one gene while CGC2, AF16, and QX1410 contain the same number of paralogs.
The first attempt is to resolve individual CGC2 paralogs using AF16 RBBHs.
When every AF16 member of an orthogroup is recovered by RBBH and every mapped AF16 locus has an informative name, names are transferred directly to the corresponding CGC2 transcripts.
name_source = AF16
name_method = direct_map_NN
No propagation is required.
If all AF16 members are mapped but only some have informative names, the workflow asks whether the informative names support treating the orthogroup as a paralogous family.
If one or more informative AF16 names already contain suffixes such as:
gene.1
gene.2
the existing suffix scheme is expanded to unnamed family members.
Alphabetical suffixes are normalized to their alphabetic positions before expansion:
A/a -> 1
B/b -> 2
...
Unused integers from the allowed suffix range are then assigned to the remaining members.
For example:
sec-61.A -> sec-61.1
CBG30478 -> sec-61.2
Assignments from this rule are marked:
name_method = propagate_NN_ex
The propagate_source field lists the CGC2 transcript(s) whose AF16 orthologs supplied the informative family name.
If no existing suffix system is present, but the orthogroup contains exactly one unique non-CBG AF16 locus, that name is treated as the family root.
The directly supported member receives .1, and the remaining paralogs receive .2, .3, etc.
For example:
gene
CBGxxxxx
CBGyyyyy
becomes:
gene.1
gene.2
gene.3
This rule is marked:
name_method = propagate_NN
If multiple distinct informative AF16 names occur in the same orthogroup and they cannot be reconciled as a single paralog family, names are not propagated across the group.
Only the directly supported mappings are retained.
name_method = direct_NN_partial
For remaining 1:N:N:N families, the workflow uses the single N2 ortholog as the family name and propagates that name across all CGC2 members.
Members are enumerated in the CGC2 orthogroup:
gene.1
gene.2
...
gene.N
These assignments are marked:
name_source = N2
name_method = propagate_1N
The N2-supported CGC2 transcript is stored in propagate_source.
The 1:N:X:N category captures expansions shared by CGC2 and QX1410 where AF16 copy number is not stable.
Because N2 remains single-copy, the N2 RBBH is used as the naming anchor and its gene name is propagated across the CGC2 copies.
name_source = N2
name_method = propagate_1N_unkAF
This is conceptually similar to the N2 fallback used for 1:N:N:N, but the method label records that AF16 copy number was not part of the stable pattern.
For orthogroups with equal multi-copy numbers in all four taxa, the workflow again attempts AF16 first.
The same hierarchy is used:
- all AF16 members named -> direct transfer;
- mixed names with an existing suffix system -> expand the suffix system;
- exactly one informative family root -> generate a new
.1,.2, ... series; - multiple incompatible informative roots -> retain only direct assignments.
The corresponding method labels include:
direct_map_NNN
propagate_NNN_ex
propagate_NNN
direct_NN_partial
If AF16 does not resolve the orthogroup, N2 RBBHs are examined. When all N2 members are represented and named, the N2 names are transferred directly.
These orthogroups have equal copy number in N2, CGC2, and QX1410 but not necessarily AF16.
The workflow tests N2 RBBHs. In the analyzed CGC2 dataset, the alternative partial-mapping situations anticipated for this category were not encountered, and no additional propagation scheme was applied.
Thus this category is intentionally conservative: unresolved families remain unnamed rather than forcing a name across an uncertain orthology relationship.
These orthogroups have stable copy number among CGC2, AF16, and QX1410, while N2 is unconstrained.
AF16 is therefore used as the main reference. The same AF16 multi-copy decision tree used for N:N:N:N is applied:
- direct transfer when all members have informative names;
- expansion of an existing suffix scheme;
- creation of a new suffix scheme when one unique informative family root is present;
- partial direct assignment when multiple incompatible roots occur.
The named subsets from each orthogroup pattern are combined into a common table and labeled by their copy-number pattern:
X.N.N.N
1.N.N.N
N.N.X.N
1.N.X.N
N.N.N.N
Direct one-to-one assignments are then combined with the multi-copy assignments.
After the structured orthogroup naming rules have been applied, remaining RBBHs are considered as a fallback.
The priority is:
- unused N2 RBBHs;
- unused informative AF16 RBBHs;
- unused AF16
CBG...assignments; - unused AF16 RBBH
CBG...assignments.
These assignments receive method labels such as:
rbbh_append
CBG_append
rbbh_CBG_append
This step maximizes annotation coverage while ensuring that structured, copy-number-aware assignments take priority.
After all naming sources are combined, the workflow checks whether the same assigned name occurs more than once.
Some apparent duplicates arise because N2 transcript identifiers encode transcript variants using trailing letters. Where possible, this transcript letter is appended to the gene name to distinguish otherwise duplicated assignments.
The resulting table is checked for two invariants:
- one final name per CGC2 representative transcript;
- one CGC2 representative transcript per final name.
These checks are important because duplicated gene names would make the resulting GFF annotation ambiguous.
Orthology and naming are initially performed on the longest representative isoform of each CGC2 gene.
The final representative-transcript assignments are therefore joined back to the original CGC2 GFF using transcript-to-parent relationships.
Within each CGC2 gene (Parent), annotation fields are filled upward and downward so that all transcript isoforms inherit the same gene-level naming information.
L2_newatt <- cgc2_gff_ori %>%
filter(type == "mRNA") %>%
... %>%
group_by(Parent) %>%
tidyr::fill(
mapped_transcript,
name,
name_source,
pattern,
name_method,
propagate_source,
identity,
.direction = "downup"
) %>%
ungroup()The provenance fields are converted into GFF attributes:
name_source=
name_pattern=
name_method=
propagate_source=
mapped_transcript=
match_identity=
Genes for which no orthology-supported name was obtained retain a CGC2 systematic name derived from the BRAKER gene identifier.
The annotation is reconstructed at three feature levels:
- L1: gene
- L2: mRNA/transcript
- L3: exon and CDS
The newly assigned gene name and provenance fields are attached at the gene and transcript levels. Exons and CDS features inherit the appropriate gene name but do not carry the full orthology provenance metadata.
Two output conventions are generated.
The consequence-annotation GFF uses identifiers such as:
ID=gene:CGC2...
ID=transcript:CGC2...
ID=exon:CGC2...
ID=CDS:CGC2...
and stores the assigned name as:
sequence_name=
The final annotation is written as:
CGC2.softMasked.July2026.braker.named.csq.gff
and:
c_tropicalis.NIC58_20260722.named.csq.gff
A second GFF is generated with WormBase-like attributes including:
Name=
locus=
sequence_name=
Alias=
For genes with an informative biological name, aliases include both the assigned locus and the CGC2 systematic identifier. For unnamed genes, the systematic CGC2 identifier is retained.
The final WormBase-style annotation is written as:
CGC2.softMasked.July2026.braker.named.WB_fmt.gff
and:
c_tropicalis.NIC58_20260722.named.WB_fmt.gff
The output GFF retains explicit information about how each name was assigned.
| Field | Meaning |
|---|---|
name_source |
Reference species from which the name originated (AF16 or N2) |
name_pattern |
Orthogroup copy-number pattern used during assignment |
name_method |
Specific naming rule used |
mapped_transcript |
Reference transcript directly associated with the CGC2 assignment |
propagate_source |
CGC2 transcript(s) whose direct orthology-supported name was propagated to other family members |
match_identity |
Protein percent identity of the supporting CGC2-reference match |
These fields make the renaming process auditable and allow direct mappings to be distinguished from inferred paralog-family propagation.
name_method |
Interpretation |
|---|---|
direct_1to1 |
Direct name transfer from a single-copy ortholog |
direct_map_NN |
Direct AF16-to-CGC2 mapping in a stable multi-copy family |
direct_map_NNN |
Direct transfer in a fully resolved equal-copy multi-gene family |
propagate_1N |
Single N2 name propagated across a CGC2 expansion |
propagate_1N_unkAF |
Single N2 name propagated when AF16 copy number is unconstrained |
propagate_NN_ex |
Existing paralog suffix series expanded to unnamed members |
propagate_NNN_ex |
Existing suffix series expanded in an N-copy stable family |
propagate_NN |
New numbered paralog series generated from one informative family root |
propagate_NNN |
New numbered paralog series generated in an N-copy stable family |
direct_NN_partial |
Ambiguous multi-name family; retain direct mappings without propagation |
rbbh_append |
Residual informative RBBH added after structured naming |
CBG_append |
AF16 systematic CBG identifier added as fallback |
rbbh_CBG_append |
Residual RBBH to an AF16 CBG identifier added as fallback |
name_method |
Interpretation |
|---|---|
direct_1to1 |
Direct name transfer from a single-copy ortholog |
propagate_1N |
Single N2 name propagated across a CGC3 expansion |
direct_map_NN |
Direct N2-to-CGC3 mapping in a stable multi-copy family |
rbbh_append |
Residual informative RBBH added after structured naming |
The current implementation makes several explicit assumptions.
First, suffix completion for selected multi-copy families assumes no more than four members because available suffixes are drawn from 1:4.
Second, AF16 loci beginning with CBG are treated as lacking an informative biological gene name. This distinction drives the propagation logic.
Third, gene-name propagation is allowed only when the orthogroup provides evidence for a common family root. If multiple distinct informative roots are present, the workflow avoids forcing all members into a single numbered family.
Fourth, RBBHs are required to agree with OrthoFinder orthogroup membership. The procedure therefore combines local sequence similarity with gene-family context rather than relying on BLAST alone.
Finally, numbering of newly propagated paralogs is a naming convention and should not be interpreted as evidence of evolutionary order, genomic order, or ancestral/derived status unless that ordering has been established independently.
Before release, the final annotation should be checked for:
# No representative transcript receives multiple names
final_names_longest_iso %>%
count(CGC2_transcript) %>%
filter(n > 1)
# No final name is assigned to multiple representative transcripts
final_names_longest_iso %>%
count(name) %>%
filter(n > 1)
# Review propagated assignments
final_names_longest_iso %>%
filter(!is.na(propagate_source)) %>%
arrange(Orthogroup, name)
# Summarize naming provenance
final_names_longest_iso %>%
count(name_source, name_method, pattern)Additional manual review is especially useful for propagated multi-copy families, low-identity RBBHs, and orthogroups receiving fallback CBG identifiers.