-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Labels
bugAn issue with an existing featureAn issue with an existing feature
Description
Dear Starfish developers,
Firstly, thank you for creating such a useful tool for decode analysis. I have been using the barcodeBuildFunc function and noticed a piece of code related to the modification of external variables within the function.
def barcodeBuildFunc(allNeighbors: list, currentRound: int, roundOmitNum: int, roundNum: int) -> list:
allSpotCodes = []
for neighbors in allNeighbors:
neighborLists = [neighbors[rnd] for rnd in range(roundNum)]
if roundOmitNum > 0:
[neighbors[rnd].append(0) for rnd in range(roundNum)]
codes = list(product(*neighborLists))
In the current implementation of barcodeBuildFunc, the function modifies the neighbors object, which refers to an external variable, and in turn affects upstream variables neighborLists. I'm not sure whether it will lead to unintended side effects. If I change the code to the following form, I wonder if it makes sense?
def barcodeBuildFunc_revised(allNeighbors: list, currentRound: int, roundOmitNum: int, roundNum: int) -> list:
allSpotCodes = []
for neighbors in allNeighbors:
if roundOmitNum > 0:
neighbors = [neighbors[rnd] + [0] for rnd in range(roundNum)]
neighborLists = [neighbors[rnd] for rnd in range(roundNum)]
codes = list(product(*neighborLists))
Thanks for your help.
Metadata
Metadata
Assignees
Labels
bugAn issue with an existing featureAn issue with an existing feature