Repository navigation
Warn about an index without gene groups at index and map time - #40
Merged
Merged
Conversation
When every transcript is its own gene (FASTA headers without gene IDs and neither --t2g nor --infer-genes), the per-gene candidate limits act on isoforms and ties among isoforms go by FASTA order. - spearfish index: the warning now shows under -q too, after the summary, names --t2g FILE and --infer-genes and says why they matter. - spearfish map: warns once per run when the loaded index has no gene groups (manifest genes_from none, or as many genes as transcripts), also under -q, and the run record lists it under `warnings` (code no_gene_groups). - Library: Index::has_gene_groups(), Index::n_genes() and spearfish::has_gene_groups(); Python: Index.has_gene_groups. - Docs (indexing, output, mapping guides) and a CHANGELOG entry under 0.3.0 (unreleased). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
A candidate for 0.3.0. spearfish now warns, at index time and at map time, when an index has no gene groups, and the library and Python API say whether an index has them.
An index has no gene groups when every transcript is its own gene. This happens when the FASTA headers carry no gene IDs (a RefSeq FASTA, for example) and neither
--t2gnor--infer-geneswas given. spearfish keeps a few candidate genes per read, so the isoforms of a gene then compete for those places one by one, and ties among them are broken by FASTA order. This costs accuracy (see the indexing guide for the numbers on GENCODE).Until now:
spearfish indexwarned, but in its summary, which-qhides;spearfish mapsaid nothing, so an index built earlier, or by someone else, gave no sign.Behaviour
Index time. The warning is printed after the summary, and also under
-q:The summary also says
isoforms not collapsed: every transcript is its own gene(with--collapse gene), in place of the old in-summary warning.Map time. Once per run, right after the index is loaded, also under
-q:Detection. An index of two or more transcripts has no gene groups when its manifest says
genes_from: none, or when it has as many genes as transcripts. The second case also covers a--t2gtable that puts each transcript in its own gene, gene inference that grouped nothing, and indexes without a manifest. The cause and the fix in the message followgenes_from.Run record.
*.meta.jsongains a top-levelwarningslist, with entries{"code": "no_gene_groups", "message": "..."}. The key is left out when there are no warnings, so records of other runs are unchanged.Library and Python.
Index::has_gene_groups()andIndex::n_genes();spearfish::has_gene_groups(genes_from, transcripts, genes), for a build report or a manifest alone;Index.has_gene_groups.Index.num_genesnow uses the library'sn_genes.oarfish can use these to warn too.
Mapping output is unchanged.
Implementation notes
-q: until now every warning went throughlog::warn!, which-qhides, so there was no precedent.logging::warn_always(CLI) writes a warning at every level, in the same format and colour. It is meant only for problems with the inputs that change the results; advice and ignored options stay onlog::warn!.Message:
index_cmd::no_gene_groups_warning(genes_from, index)builds the text for both commands.Index time: the old condition skipped
--infer-genesand--collapse global. The new one does not, since the candidate limits act per gene either way.Python index-time warning: the wording follows the CLI's. It still goes through
log::warn!(Python logging), and no longer depends oncollapse.Docs:
--t2gor--infer-genes;warningsin the run record;-qstill shows this warning.CHANGELOG: an entry under
## 0.3.0 (unreleased). This branch is based on main, where that heading does not exist yet, so it adds the heading in the same form as map: quantification score with an end fit for reads without a poly(A) tail, and antisense evidence #39. Whichever of the two merges second will need the two0.3.0 (unreleased)sections joined into one.Tests:
gene_groups_detected(library): detection from the manifest and from the counts, fornone, a one-gene-per-transcript table, and a single transcript;warns_on_index_without_gene_groups(CLI): the index and map warnings with and without-q, once per map run, and the run record'swarnings. With--infer-genes, a-qrun prints nothing and records no warnings;warnings;has_gene_groupson grouped, ungrouped and inferred indexes.The toy fixture is unchanged.
Checks
See the PR checks. The same steps were run locally first: fmt, clippy (default and no-default features), tests, docs, package, Python, MSRV, and the nudgy stress tests. Miri could not run locally (a sysroot permission error, environmental); CI runs it.
🤖 Generated with Claude Code
https://claude.ai/code/session_013PdRfyfQgt9mi8eYLo2VqT