Feature/update grouped db profiling 20260717#59
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe PR updates the package version, adds an ChangesGrouped annotation counting
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant GeneCountAnnotator
participant AnnotationDatabaseManager
participant SQL_ADM
participant AnnotationGroup
GeneCountAnnotator->>GeneCountAnnotator: Accumulate counts by group
GeneCountAnnotator->>AnnotationDatabaseManager: Query grouped annotation
AnnotationDatabaseManager->>SQL_ADM: Request grouped sequence
SQL_ADM->>AnnotationGroup: Query group by id
AnnotationGroup-->>SQL_ADM: Return group annotation
SQL_ADM-->>AnnotationDatabaseManager: Return parsed annotation
AnnotationDatabaseManager-->>GeneCountAnnotator: Return grouped features
GeneCountAnnotator->>GeneCountAnnotator: Distribute aggregated counts
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@gffquant/annotation/count_annotator.py`:
- Around line 330-335: Handle a None result from db.query_sequence in the
grouped_counts loop before unpacking it. For missing annotations, add the
current counts to self.unannotated_counts, matching the existing single-gene
safety behavior; otherwise unpack the result and call distribute_feature_counts
as before.
In `@gffquant/db/annotation_db.py`:
- Around line 62-78: Update both
AnnotationDatabaseManager.query_sequence_internal and
Dict_ADM.query_sequence_internal to accept the grouped_db keyword argument,
preserving their existing behavior while allowing query_sequence to forward it
without raising TypeError.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9dd649f8-e598-4182-9009-31e065b413e2
📒 Files selected for processing (4)
gffquant/__init__.pygffquant/annotation/count_annotator.pygffquant/db/annotation_db.pygffquant/db/models/db.py
| def query_sequence(self, seqid, start=None, end=None, grouped_db=False,): | ||
| """ Returns strand, seq-feature id (e.g. contig id), functional categories """ | ||
| db_sequence = self.query_sequence_internal(seqid, start=start, end=end) | ||
| db_sequence = self.query_sequence_internal(seqid, start=start, end=end, grouped_db=grouped_db,) | ||
|
|
||
| if db_sequence is None: | ||
| return None | ||
| categories = tuple() | ||
| for cat_features in db_sequence.annotation_str.strip().split(";"): | ||
|
|
||
| annotation_str = db_sequence.annotation_str if hasattr(db_sequence, "annotation_str") else db_sequence.annotation | ||
| strand = db_sequence.strand if hasattr(db_sequence, "strand") else None | ||
| featureid = db_sequence.feature_id if hasattr(db_sequence, "feature_id") else None | ||
|
|
||
| # for cat_features in db_sequence.annotation_str.strip().split(";"): | ||
| for cat_features in annotation_str.strip().split(";"): | ||
| category, features = cat_features.split("=") | ||
| categories += ((category, tuple(feature.strip() for feature in features.split(",") if feature.strip())),) | ||
| return db_sequence.strand, db_sequence.featureid, categories | ||
| return strand, featureid, categories |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Verify all query_sequence_internal implementations accept `grouped_db`.
rg 'def query_sequence_internal' -A 2Repository: cschu/gff_quantifier
Length of output: 158
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== annotation_db.py =="
wc -l gffquant/db/annotation_db.py
sed -n '1,220p' gffquant/db/annotation_db.py
echo
echo "== search for query_sequence_internal =="
rg -n "query_sequence_internal|class .*AnnotationDatabaseManager|class .*Dict_ADM" gffquant -S
echo
echo "== file list around db package =="
find gffquant -maxdepth 3 -type f | sortRepository: cschu/gff_quantifier
Length of output: 10728
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== Dict_ADM implementation =="
sed -n '230,290p' gffquant/db/annotation_db.py
echo
echo "== grouped_db references =="
rg -n "grouped_db" gffquant -S
echo
echo "== query_sequence calls =="
rg -n "query_sequence\(" gffquant -SRepository: cschu/gff_quantifier
Length of output: 3229
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
text = Path('gffquant/db/annotation_db.py').read_text()
# Extract the abstract/base and subclass signatures in a simple read-only way.
for needle in [
'def query_sequence_internal(self, seqid, start=None, end=None):',
'def query_sequence_internal(self, seqid, start=None, end=None, grouped_db=False,):',
]:
print(needle, '->', text.count(needle))
print("\nRelevant lines:")
for i, line in enumerate(text.splitlines(), 1):
if 'query_sequence_internal' in line or 'grouped_db' in line:
print(f"{i}: {line}")
PYRepository: cschu/gff_quantifier
Length of output: 787
Update query_sequence_internal to accept grouped_db: add the new kwarg to AnnotationDatabaseManager.query_sequence_internal and Dict_ADM.query_sequence_internal; query_sequence() now always forwards it, so Dict_ADM will raise TypeError as-is.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@gffquant/db/annotation_db.py` around lines 62 - 78, Update both
AnnotationDatabaseManager.query_sequence_internal and
Dict_ADM.query_sequence_internal to accept the grouped_db keyword argument,
preserving their existing behavior while allowing query_sequence to forward it
without raising TypeError.
Summary by CodeRabbit