Add mixed barcode rescue to SpotDecoding #56
Merged
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 PR adds a function
_rescue_mixed_spots
to theSpotDecoding
application. This function addresses the case of mixed barcodes caused by spatial crowding of spots. An argumentrescue_mixed
has been added to thepredict
method ofSpotDecoding
to toggle this function. A test case has been added to cover this function. Print statements have been added to make the prediction more verbose to make the amount of error correction more obvious.The function
_rescue_spots
has been refactored to_rescue_errors
, because there are now two methods for rescuing spots. The exposed argumentrescue_spots
has also been changed torescue_errors
.Regardless of error correction, two items have been added to the dictionary returned by
SpotDetection.predict
.spot_index
indexes the spots, becauserescue_mixed_spots
introduces the case that two gene assignments can be made for the same spot. In that case, a new entry is added to the output with the same index as the original spot.source
details the origin of a prediction. Its values can be:'prediction'
fromSpotDetection.predict
'error rescue'
fromrescue_errors
'mixed rescue'
from_rescue_mixed_spots