-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ISS refactored with new spot finding path
- Loading branch information
Shannon Axelrod
committed
Sep 26, 2019
1 parent
c220e44
commit fb9b662
Showing
17 changed files
with
406 additions
and
104 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
45 changes: 45 additions & 0 deletions
45
starfish/core/spots/DecodeSpots/per_round_max_channel_decoder.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from starfish.core.codebook.codebook import Codebook | ||
from starfish.core.intensity_table.decoded_intensity_table import DecodedIntensityTable | ||
from starfish.core.intensity_table.intensity_table_coordinates import \ | ||
transfer_physical_coords_to_intensity_table | ||
from starfish.core.spots.DecodeSpots.trace_builders import build_spot_traces_exact_match | ||
from starfish.core.types import SpotFindingResults | ||
from ._base import DecodeSpotsAlgorithm | ||
|
||
|
||
class PerRoundMaxChannel(DecodeSpotsAlgorithm): | ||
""" | ||
Decode spots by selecting the max-valued channel in each sequencing round. | ||
Note that this assumes that the codebook contains only one "on" channel per sequencing round, | ||
a common pattern in experiments that assign one fluorophore to each DNA nucleotide and | ||
read DNA sequentially. It is also a characteristic of single-molecule FISH and RNAscope | ||
codebooks. | ||
Parameters | ||
---------- | ||
codebook : Codebook | ||
Contains codes to decode IntensityTable | ||
""" | ||
|
||
def __init__(self, codebook: Codebook): | ||
self.codebook = codebook | ||
|
||
def run(self, spots: SpotFindingResults, *args) -> DecodedIntensityTable: | ||
"""Decode spots by selecting the max-valued channel in each sequencing round | ||
Parameters | ||
---------- | ||
spots: SpotFindingResults | ||
A Dict of tile indices and their corresponding measured spots | ||
Returns | ||
------- | ||
DecodedIntensityTable : | ||
IntensityTable decoded and appended with Features.TARGET and Features.QUALITY values. | ||
""" | ||
intensities = build_spot_traces_exact_match(spots) | ||
transfer_physical_coords_to_intensity_table(intensity_table=intensities, spots=spots) | ||
return self.codebook.decode_per_round_max(intensities) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from starfish.core.intensity_table.intensity_table import IntensityTable | ||
from starfish.core.types import Axes, Features, SpotFindingResults | ||
|
||
|
||
def build_spot_traces_exact_match(spot_results: SpotFindingResults): | ||
""" | ||
Combines spots found in matching x/y positions across rounds and channels of | ||
an ImageStack into traces represented as an IntensityTable. | ||
Parameters | ||
----------- | ||
spot_results: SpotFindingResults | ||
Spots found accrss rounds/channels of an ImageStack | ||
""" | ||
# create IntensityTable with same x/y/z info accross all r/ch | ||
spot_attributes = spot_results[{Axes.ROUND: 0, Axes.CH: 0}] | ||
ch_labels = spot_results.ch_labels | ||
round_labels = spot_results.round_labels | ||
intensity_table = IntensityTable.zeros( | ||
spot_attributes=spot_attributes, | ||
ch_labels=ch_labels, | ||
round_labels=round_labels, | ||
) | ||
for r, c in spot_results.keys(): | ||
intensity_table.loc[dict(c=c, r=r)] = \ | ||
spot_results[{Axes.ROUND: r, Axes.CH: c}].data[Features.INTENSITY] | ||
return intensity_table |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.