dev: Streaming FASTQ dataset support#91
Merged
Merged
Conversation
Introduces deepbiop.modern module with type-safe, shape-annotated API: Features: - Shape-annotated types using jaxtyping for self-documenting APIs - Modern OneHotEncoder/IntegerEncoder wrappers with batch encoding - Architecture-specific methods (for_conv1d, for_transformer, for_rnn) - einops-based rearrangement utilities (to_channels_first, pool_sequences) - Comprehensive test suite (30 tests, all passing) Technical details: - Runtime shape validation with typeguard (optional) - Graceful fallback when jaxtyping not available - Wraps existing Rust encoders from deepbiop.fq - Modern dependencies: einops>=0.8.0, jaxtyping>=0.2.34 Files: - deepbiop/modern/__init__.py: Module exports - deepbiop/modern/types.py: Shape-annotated type aliases - deepbiop/modern/encoders.py: Modern encoder wrappers (480 lines) - deepbiop/modern/transforms.py: Rearrangement utilities (390 lines) - tests/test_modern.py: Comprehensive test suite (30 tests) All pre-commit hooks passing. Resolves merge conflicts in stub files.
## VCF/GTF Module Exposure - Modified register_vcf_module() to create proper Python submodule - Modified register_gtf_module() to create proper Python submodule - Added VcfReader, Variant, GtfReader, GenomicFeature to __init__.py exports - Created comprehensive type stub files (vcf.pyi, gtf.pyi) for IDE support ## Bug Fix - Fixed invalid escape sequence in targets.py docstring (line 9) - Changed r"label=(\w+)" to r"label=(\\w+)" for Python 3.10+ compatibility - Resolves 18 supervised learning test failures ## Testing - All 52 VCF/GTF tests passing (2 skipped pandas tests) - All 18 supervised learning tests now passing This completes Python API parity with Rust for genomic variant and annotation processing capabilities. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
**Multi-Label Target Extraction (Python)** - Add MultiLabelExtractor class for multi-task learning - Support dict, tuple, and array output formats - Enable extraction of multiple targets per record (quality, GC, length, etc.) - 100% backward compatible with existing TargetExtractor **Enhanced Collate Functions (Python)** - Add multi_label_collate for list-based batching - Add multi_label_tensor_collate for tensor conversion - Intelligently handle dict/tuple/array targets - Enable multi-task learning workflows with PyTorch **Streaming FASTQ Dataset (Rust + Python Bindings)** - Implement StreamingFastqIterator with Iterator trait - Add ShuffleBuffer using reservoir sampling for approximate randomization - Memory-efficient: O(buffer_size) vs O(dataset_size) - Support plain, gzip, and bgzip FASTQ files - Python bindings via PyStreamingFastqDataset - Enable processing of >100GB datasets without caching **Performance Architecture** - Rust: High-performance file I/O and streaming (20-30K reads/sec) - Python: Flexible coordination layer for ML workflows - Follows project philosophy: Rust for efficiency, Python for usability Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add unsendable marker for PyStreamingFastqIterator (ThreadRng is not Sync) - Add gen_stub attributes for proper stub generation - Replace deprecated PyObject with Py<PyAny> - Build and install successful ✅ All Rust code compiles cleanly ✅ Python bindings build successfully ✅ Ready for integration testing
Fix TypeError in test_multilabel_streaming.py by correcting parameter name from 'target_extractor' to 'target_fn' in TransformDataset calls. This resolves 2 failing tests: - test_streaming_with_multilabel_extraction - test_streaming_with_multilabel_collate All 265 tests now pass successfully.
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.
This pull request introduces streaming FASTQ dataset support for efficient processing of large files in Rust and Python, and improves Python module structure for genomic annotation (GTF) and variant (VCF) processing. It also expands Python utilities for multi-label tasks and updates workflow configuration for Python testing.
Major new features and improvements:
Streaming FASTQ dataset support
streamingmodule (crates/deepbiop-fq/src/streaming.rs) implementing a memory-efficient streaming FASTQ iterator with optional shuffle buffer, and Python bindings forStreamingFastqDataset. This enables handling of very large FASTQ files without loading them entirely into memory.streamingmodule. [1] [2]Python module improvements for genomic data
__init__.pyto import GTF and VCF classes, and added them to the public API (__all__). [1] [2] [3]Multi-label utilities for supervised learning
Workflow configuration cleanup