Skip to content

[P1][Usability/Correctness] FASTAとGFFのseqid不一致を解析前に検出して具体例を表示する - #54

Merged
light-suzuki merged 1 commit into
mainfrom
issue/49-seqid-mismatch-detection
Aug 9, 2026
Merged

[P1][Usability/Correctness] FASTAとGFFのseqid不一致を解析前に検出して具体例を表示する#54
light-suzuki merged 1 commit into
mainfrom
issue/49-seqid-mismatch-detection

Conversation

@light-suzuki

Copy link
Copy Markdown
Owner

Fixes #49

実施内容

  • \genomes.gff_seqids(): GFFのseqid(1列目)を出現順に収集(ストリーミング走査)
  • \genomes.seqid_consistency(): FASTA seqid集合とGFF seqid集合を比較し、完全一致数・FASTAのみ・GFFのみを要約。\gff_contig_aliases\(FASTA名→GFF名)をFASTA側に適用後に評価。不一致時は両側の実例seqid(最大5件)を含むメッセージを生成

  • un_job(): 解析開始前にsource GFFのseqidを走査し
    • source contigがGFFに存在しない場合は \ValueError\ で停止(「geneが0」のまま黙って続行しない)。メッセージにGFF側のseqid実例を表示
    • 部分的な不一致(FASTA-only/GFF-onlyが存在)は warning に追加
    • alias設定で解決できる場合は正常に進行
  • 自動変換(chr1→1等)はせず、候補例の提示に留める

テスト

  • gff_seqidsの収集・完全不一致/部分不一致/完全一致/alias解決の各ケースを検証(5テスト追加)
  • source contigがGFFに無い場合は解析停止し実例を表示、一致時は正常進行することを検証(2テスト追加)
  • 全47テスト成功、
    uff check\ パス

Copilot AI lite review requested due to automatic review settings August 9, 2026 01:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4f4e91c128

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +67 to +69
if gff_contig not in gff_contigs:
examples = ", ".join(gff_contigs[:5]) or "(no feature rows)"
raise ValueError(f"Source contig '{payload['contig']}' (GFF name '{gff_contig}') has no features in '{source['name']}'. GFF seqids include: {examples}. FASTA and GFF sequence names must match.")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Continue without annotation instead of failing the job

When the selected FASTA contig legitimately has no GFF feature rows, this exception aborts the job before marker mapping or liftover, even though those evidence classes can still produce a valid result without synteny. The existing zero-gene path already represents this uncertainty, so emit an explicit annotation warning and continue rather than recording the entire job as failed.

AGENTS.md reference: AGENTS.md:L11-L12

Useful? React with 👍 / 👎.

Comment thread backend/qtlift/genomes.py
Comment on lines +125 to +129
if line.startswith("#") or not line.strip():
continue
seqid = line.split("\t", 1)[0]
if seqid not in seen:
seen.append(seqid)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Stop parsing when an embedded FASTA section begins

For a valid GFF3 containing a ##FASTA section, the directive is skipped as a comment but every following > header and sequence line is treated as a seqid. This produces false GFF-only mismatch warnings and, because distinct values are tracked with linear list membership, a large embedded genome can make this preflight consume enormous memory and quadratic time; stop at ##FASTA or only accept valid tab-delimited feature rows.

Useful? React with 👍 / 👎.

gff_contigs = gff_seqids(source["gff"])
if gff_contig not in gff_contigs:
examples = ", ".join(gff_contigs[:5]) or "(no feature rows)"
raise ValueError(f"Source contig '{payload['contig']}' (GFF name '{gff_contig}') has no features in '{source['name']}'. GFF seqids include: {examples}. FASTA and GFF sequence names must match.")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Localize the new seqid diagnostics

When the UI is Japanese, this exception is persisted by JobManager and rendered verbatim as job.error; the new consistency warning is likewise rendered directly from job.warnings. Since neither diagnostic has a Japanese representation or localization key, Japanese users now receive English-only user-facing messages; return structured/localized diagnostics or add both EN and JA variants.

AGENTS.md reference: AGENTS.md:L108-L110

Useful? React with 👍 / 👎.

# Conflicts:
#	backend/qtlift/pipeline.py
#	tests/test_pipeline.py
@light-suzuki
light-suzuki force-pushed the issue/49-seqid-mismatch-detection branch from 4f4e91c to cdb4099 Compare August 9, 2026 02:19
@light-suzuki
light-suzuki merged commit 14d67ff into main Aug 9, 2026
8 checks passed
@light-suzuki
light-suzuki deleted the issue/49-seqid-mismatch-detection branch August 9, 2026 02:19
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.

[P1][Usability/Correctness] FASTAとGFFのseqid不一致を解析前に検出して具体例を表示する

2 participants