Skip to content

Commit

Permalink
try mypy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kedhammar committed Sep 12, 2024
1 parent dfabee5 commit f15e835
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions scripts/generate_aviti_run_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,38 +81,42 @@ def idxs_from_label(label: str) -> list[str | tuple[str, str]]:
"""

# Initialize result
idxs = []
idxs: list[str | tuple[str, str]] = []

# Expand 10X single indexes
if TENX_SINGLE_PAT.findall(label):
match = TENX_SINGLE_PAT.findall(label)[0]
match: str = TENX_SINGLE_PAT.findall(label)[0]
for tenXidx in Chromium_10X_indexes[match]:
idxs.append(tenXidx)
# Case of 10X dual indexes
elif TENX_DUAL_PAT.findall(label):
match = TENX_DUAL_PAT.findall(label)[0]
i7_idx = Chromium_10X_indexes[match][0]
i5_idx = Chromium_10X_indexes[match][1]
idxs.append((i7_idx, revcomp(i5_idx)))
match: str = TENX_DUAL_PAT.findall(label)[0]
i7_idx: str = Chromium_10X_indexes[match][0]
i5_idx: str = Chromium_10X_indexes[match][1]
pair: tuple[str, str] = (i7_idx, revcomp(i5_idx))
idxs.append(pair)
# Case of SS3 indexes
elif SMARTSEQ_PAT.findall(label):
match = SMARTSEQ_PAT.findall(label)[0]
match: str = SMARTSEQ_PAT.findall(label)[0]
for i7_idx in SMARTSEQ3_INDEXES[match][0]:
for i5_idx in SMARTSEQ3_INDEXES[match][1]:
idxs.append((i7_idx, revcomp(i5_idx)))
pair: tuple[str, str] = (i7_idx, revcomp(i5_idx))
idxs.append(pair)
# NoIndex cases
elif label.replace(",", "").upper() == "NOINDEX" or (
label.replace(",", "").upper() == ""
):
raise AssertionError("NoIndex cases not allowed.")
# Ordinary indexes
elif IDX_PAT.findall(label):
match = IDX_PAT.findall(label)[0]
match: str = IDX_PAT.findall(label)[0]
if "-" in match:
idx1, idx2 = match.split("-")
idxs.append((idx1, revcomp(idx2)))
idx1: str = match.split("-")[0]
idx2: str = match.split("-")[1]
pair: tuple[str, str] = (idx1, idx2)
idxs.append(pair)
else:
idx1 = match
idx1: str = match
idxs.append(idx1)
else:
raise AssertionError(f"Could not parse index from '{label}'.")
Expand Down

0 comments on commit f15e835

Please sign in to comment.