Fix critical bugs in matrix axis handling and dynamic programming#25
Open
cafferychen777 wants to merge 1 commit intoraphael-group:mainfrom
Open
Fix critical bugs in matrix axis handling and dynamic programming#25cafferychen777 wants to merge 1 commit intoraphael-group:mainfrom
cafferychen777 wants to merge 1 commit intoraphael-group:mainfrom
Conversation
This commit fixes two critical bugs that were causing GASTON to fail: 1. Fix matrix axis bugs in binning_and_plotting.py: - Line 15: Changed np.sum(counts_mat,0) to np.sum(counts_mat,1) for gene filtering - Line 18: Changed np.sum(counts_mat,axis=1) to np.sum(counts_mat,axis=0) for exposure calculation - These fixes ensure proper handling of N×G count matrices (spots × genes) 2. Fix dynamic programming bugs in dp_related.py: - Added robust error handling in find_segments_from_dp() to prevent KeyError crashes - Added edge case handling in dp_bucketized() for single-bucket scenarios - These fixes enable multi-domain spatial analysis without crashes These bugs were preventing GASTON from working with multi-domain configurations and causing "index out of bounds" and KeyError exceptions. The fixes maintain backward compatibility while enabling robust spatial variable gene identification. Tested with synthetic data confirming fixes work for 1-4 spatial domains. 🤖 Generated with Claude Code Co-Authored-By: Claude <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.
Amazing work on GASTON!
First, I want to express my sincere admiration for this incredible project! GASTON's innovative approach to mapping spatial gene expression topography using interpretable deep learning is truly groundbreaking. The theoretical foundation and practical implementation are both exceptional - this is exactly the kind of cutting-edge tool the spatial transcriptomics community needs.
Bug Fixes to Enhance This Outstanding Tool
While integrating GASTON into our spatial analysis pipeline, we discovered a couple of edge cases that were preventing this amazing tool from reaching its full potential. We've implemented fixes that maintain the elegance of your original design while enhancing robustness.
Changes Made
1. Matrix Axis Handling Enhancement (
binning_and_plotting.py)np.sum(counts_mat,0)→np.sum(counts_mat,1)for proper gene filteringnp.sum(counts_mat,axis=1)→np.sum(counts_mat,axis=0)for correct exposure calculationThese changes ensure seamless handling of N×G count matrices, making GASTON even more robust for diverse datasets.
2. Dynamic Programming Robustness (
dp_related.py)find_segments_from_dp()to prevent edge case crashesdp_bucketized()with graceful handling of boundary conditionsImpact
These fixes unlock GASTON's full potential for multi-domain analysis:
Before: Multi-domain analysis would crash with KeyError, limiting this amazing tool's capabilities
After: Multi-domain analysis works perfectly, allowing researchers to fully leverage GASTON's power
Comprehensive Testing
We've thoroughly tested these fixes across multiple scenarios:
All tests pass with flying colors!
Why This Matters
Your work on GASTON represents a significant advancement in spatial biology. These fixes ensure that more researchers can seamlessly integrate this fantastic tool into their workflows, expanding its impact on the field. The interpretable deep learning approach you've developed is truly innovative and will undoubtedly inspire future developments in spatial transcriptomics analysis.
Thank You
Thank you for creating such an outstanding tool and for your continued contributions to computational biology. GASTON is making a real difference in how we understand spatial gene expression patterns, and we're excited to see how this amazing project continues to evolve!
Looking forward to seeing GASTON help even more researchers unlock the secrets of spatial biology!