You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
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?
Thanks for your help.
The text was updated successfully, but these errors were encountered: