Skip to content

Commit

Permalink
Fix wrong logic for collecting unassigned indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
chuan-wang committed Oct 16, 2024
1 parent 5f46a2f commit 340de28
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
4 changes: 4 additions & 0 deletions VERSIONLOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# TACA Version Log

## 20241016.1

Fix wrong logic for collecting unassigned indexes

## 20241011.1

Fix issue with 0 lane number; Add percentage of unassigned in total unassigned per lane
Expand Down
30 changes: 8 additions & 22 deletions taca/element/Element_Runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1040,25 +1040,11 @@ def aggregate_stats_unassigned(
# Order: from longer to shorter indexes
sub_demux_with_shorter_index_lens = sub_demux_list[1:]
for sub_demux in sub_demux_with_shorter_index_lens:
unassigned_csv = os.path.join(
self.run_dir,
f"Demultiplexing_{sub_demux}",
"UnassignedSequences.csv",
)
if os.path.exists(unassigned_csv):
with open(unassigned_csv) as unassigned_file:
reader = csv.DictReader(unassigned_file)
unassigned_indexes = [row for row in reader]
else:
logger.warning(
f"No {os.path.basename(unassigned_csv)} file found for sub-demultiplexing {sub_demux}."
)
continue
# Filter by lane
unassigned_indexes = [
unassigned_index
for unassigned_index in unassigned_indexes
if unassigned_index["Lane"] == lane
sub_demux_assigned_indexes = [
sub_demux_assigned_index
for sub_demux_assigned_index in aggregated_assigned_indexes_filtered_sorted
if sub_demux_assigned_index["sub_demux_count"] == sub_demux
and sub_demux_assigned_index["Lane"] == lane
]
# Remove overlapped indexes from the list of max_unassigned_indexes
idx1_overlapped_len = min(
Expand All @@ -1085,11 +1071,11 @@ def aggregate_stats_unassigned(
if demux_lens_pair[0] == sub_demux_with_max_index_lens
][0][1],
)
for unassigned_index in unassigned_indexes:
idx1_overlapped_seq = unassigned_index["I1"][
for sub_demux_assigned_index in sub_demux_assigned_indexes:
idx1_overlapped_seq = sub_demux_assigned_index["I1"][
:idx1_overlapped_len
]
idx2_overlapped_seq = unassigned_index["I2"][
idx2_overlapped_seq = sub_demux_assigned_index["I2"][
:idx2_overlapped_len
]
# Remove the overlapped record from the max_unassigned_indexes list
Expand Down

0 comments on commit 340de28

Please sign in to comment.