Repository navigation
Order extant genes by genomic coordinates and fix edge orientation - #46
Merged
Merged
Conversation
The extant synteny graphs linked genes in GFF file order, but GFFs are not necessarily sorted. In the test_data GFFs, for example, genes from regions tens of Mb apart are interleaved, so genes were linked to genes far away on the chromosome. Genes are now sorted by contig (in order of first appearance in the GFF), start and end before they are linked. The orientation of an extant edge used the strand of the previous gene in the GFF, which is a skipped gene if a gene missing from the orthoXML lies in between. It now uses the strand of the previous linked gene. This changes the inferred ancestral graphs for unsorted GFFs. Fixes DessimozLab#40
There was a problem hiding this comment.
🟢 Approval recommended
The focused changes address the reported defects with regression coverage and no identified blocking issues.
No open issues 🎉
What changed in this PR
Fixes extant synteny graph construction by using genomic order and the correct linked gene’s strand.
Changes:
- Sort genes by contig and coordinates before linking them.
- Use the previous linked gene’s strand for edge orientation.
- Enable three regression tests and bump the version to 0.1.11.
| File | Description |
|---|---|
| uv.lock | Updates the locked project version. |
| tests/test_extant_graphs.py | Removes expected-failure markers from three regression tests. |
| pyproject.toml | Bumps the project version to 0.1.11. |
| edgehog/init_extant_synteny_graphs.py | Corrects gene ordering and edge orientation. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #40 (part of #43).
1. Extant genes are now ordered by genomic coordinates.
The extant synteny graphs linked consecutive genes in GFF file order, but GFF files are not necessarily sorted. Genes are now sorted by contig (contigs keep the order of their first appearance in the GFF), start and end before they are linked.
2. The orientation of extant edges uses the correct strand.
It used the strand of the previous gene in the GFF (
gene_keys[i-1]), which is a skipped gene if a gene missing from the orthoXML lies in between. It now uses the strand of the previous linked gene.Effect on results
This changes the inferred ancestral graphs whenever a GFF is not sorted, so the version is bumped to 0.1.11.
The GFFs in
test_dataare not sorted. InCALJA.gff, for example, all 1,110 genes are on chromosome 12, but stretches near 3, 28, 43, 63, 71 and 106 Mb are interleaved: 975 of the 1,109 steps between consecutive gene lines jump backwards or more than 1 Mb forwards (9 gaps > 1 Mb in sorted order). The first gene line,ENSCJAG00000042835.2at 12:28,070,673, was followed by a gene at 2,976,794; its real neighbors are 3, 5, 8, 11, … lines further down, and its upstream neighbors are at the end of the file.Ancestral edges summed over all levels,
test_datarun with--orient_edges:About 27% of the linearized ancestral edges change. The top-down phase now keeps 85% of the bottom-up edges, compared to 57% before, as far fewer spurious extant adjacencies are propagated. The ancestral edge checked by
test_known_ancestral_adjacencyis still inferred.Not changed
The parser still assigns CDS lines to the gene line directly above them in the file (the
Parentattribute is not used), so GFFs that do not list each gene's CDSs right after it are still misread. For nested or overlapping genes, sorting by start places a nested gene right after the gene containing it.Tests: removed the
xfailmarkers oftest_unsorted_gff,test_interleaved_contigsandtest_orientation_ignores_skipped_gene.