Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Contig Length Detection for GFF Parsing #301

Merged
merged 8 commits into from
Nov 19, 2024
Merged

Fix Contig Length Detection for GFF Parsing #301

merged 8 commits into from
Nov 19, 2024

Conversation

JeanMainguy
Copy link
Member

@JeanMainguy JeanMainguy commented Nov 18, 2024

This PR fixes the bug reported in issue #299.

Problem Description

When parsing a GFF file, the contig length is usually extracted from the line:

##sequence-region <contig name> 1 <end position>

This length is used to adjust gene coordinates that overlap the contig edge, splitting such genes into two parts to ensure they remain within the contig boundaries (as introduced in PR #206).

However, this line is optional according to the GFF3 specification. As a result, when this line is missing, the contig length is undefined, causing errors during the correction of overlapping gene coordinates.

Solution

To resolve this issue, the correction of overlapping gene coordinates is now performed only after defining the contig length through one of these methods :

  1. Primary check: Extract the contig length from the GFF file if the ##sequence-region line is present.
  2. Fallback check: Parse the contig length from the FASTA sequences, whether embedded in the GFF file or provided as an external FASTA file.

If no FASTA sequence is provided, the coordinate correction step is skipped. This omission does not pose a problem since the correction is primarily necessary when extracting gene sequences from the FASTA file.

@JeanMainguy JeanMainguy changed the base branch from master to dev November 18, 2024 14:58
@JeanMainguy JeanMainguy changed the title Gff parsing fix Fix Contig Length Detection for GFF Parsing Nov 18, 2024
ppanggolin/annotate/annotate.py Outdated Show resolved Hide resolved
ppanggolin/annotate/synta.py Show resolved Hide resolved
@axbazin axbazin merged commit 583e0cb into dev Nov 19, 2024
6 checks passed
@axbazin axbazin deleted the gff_parsing_fix branch November 19, 2024 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants