Skip to content

Commit

Permalink
fix flake8 errors for undefined variables (it cant tell about going t…
Browse files Browse the repository at this point in the history
…hrough loops or cases that end up defining variables before being called
  • Loading branch information
bruce-edelman committed Nov 15, 2023
1 parent 2d16fd1 commit 7018cf4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions diploshic/fvTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ def readFa(faFileName, upper=False):
fopen = open
with fopen(faFileName, "rt") as faFile:
reading = False
currChr = None
for line in faFile:
if line.startswith(">"):
if reading:
Expand Down Expand Up @@ -493,6 +494,10 @@ def readMaskDataForTraining(
readingMasks = False
isAccessible, isAccessibleArm = [], []
genoMaskInfo = []
currChr = None
genos = None
positions = None
positions2SnpIndices = None
with fopen(maskFileName, "rt") as maskFile:
for line in maskFile:
if line.startswith(">"):
Expand Down Expand Up @@ -916,7 +921,7 @@ def calcAndAppendStatValDiplo(
- statVals["pi"][instanceIndex][subWinIndex]
)
elif statName == "HapCount":
statVals[statName][instanceIndex].append(len(hapsInSubWin.distinct()))
statVals[statName][instanceIndex].append(len(genosInSubWin.distinct()))
elif statName == "nDiplos":
diplotypeCounts = dps.getHaplotypeFreqSpec(genosNAlt)
nDiplos = diplotypeCounts[genosNAlt.shape[1]]
Expand Down Expand Up @@ -1021,7 +1026,7 @@ def calcAndAppendStatValForScanDiplo(
)
elif statName == "HapCount":
# AK: undefined variables
statVals[statName].append(len(hapsInSubWin.distinct()))
statVals[statName].append(len(genosInSubWin.distinct()))
elif statName == "nDiplos":
diplotypeCounts = dps.getHaplotypeFreqSpec(genosNAlt)
nDiplos = diplotypeCounts[genosNAlt.shape[1]]
Expand Down

0 comments on commit 7018cf4

Please sign in to comment.