Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

More fixes for type annotations #129

Merged
merged 3 commits into from
Nov 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions bin/diann_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ def calculate_coverage(ref_sequence: str, sequences: Set[str]):

Examples:
>>> calculate_coverage("WATEROVERTHEDUCKSBACK", {"WATER", "DUCK"})
0.45
0.42857142857142855
>>> calculate_coverage("DUCKDUCKDUCK", {"DUCK"})
1.0
>>> calculate_coverage("WATEROVERTHEDUCK", {"DUCK"})
Expand All @@ -1243,14 +1243,6 @@ def calculate_coverage(ref_sequence: str, sequences: Set[str]):
1.0
>>> calculate_coverage("WATERGLASS", {"WAT", "TER"})
0.5
>>> calculate_coverage("WATER", {"WAT", "TER"})
1.0
>>> calculate_coverage("WATERGLASS", {"WAT", "TER"})
0.5
>>> calculate_coverage("WATER", {"WAT", "TER"})
1.0
>>> calculate_coverage("WATERGLASS", {"WAT", "TER"})
0.5
"""
starts = []
lengths = []
Expand All @@ -1267,7 +1259,7 @@ def calculate_coverage(ref_sequence: str, sequences: Set[str]):
# merge overlapping intervals
merged_starts: list = []
merged_lengths: list = []
for start, length in zip(*sorted(zip(starts, lengths))):
for start, length in sorted(zip(starts, lengths)):
if merged_starts and merged_starts[-1] + merged_lengths[-1] >= start:
merged_lengths[-1] = max(merged_starts[-1] + merged_lengths[-1], start + length) - merged_starts[-1]
else:
Expand Down