Skip to content

Commit

Permalink
Added index positions (#113)
Browse files Browse the repository at this point in the history
* Differentiated indexed read values from non-indexed reads

* Refactor code

* Refactored code
  • Loading branch information
nkongenelly authored Apr 8, 2024
1 parent df787ed commit d0f5ac4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion checkQC/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

__version__ = "4.0.1"
__version__ = "4.0.2-rc1"
10 changes: 8 additions & 2 deletions checkQC/handlers/q30_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,18 @@ def collect(self, signal):

def check_qc(self):

index_count = 0
non_index_count = 0
for error_dict in self.error_results:
lane_nbr = int(error_dict["lane"])
read = error_dict["read"]
percent_q30 = error_dict["percent_q30"]
is_index_read = error_dict["percent_q30"]
is_index_read = error_dict.get("is_index_read", False)
read_or_index_text = "index read" if is_index_read else "read"
# Differentiate read values for indexed from non-indexed reads
index_count += 1 if is_index_read else 0
non_index_count += 1 if not is_index_read else 0

read = index_count if is_index_read else non_index_count

if self.error() != self.UNKNOWN and percent_q30 < self.error():
yield QCErrorFatal(
Expand Down
2 changes: 1 addition & 1 deletion tests/handlers/test_q30_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_all_is_fine(self):
self.set_qc_config(qc_config)
errors_and_warnings = list(self.q30_handler.check_qc())
self.assertIn("index read", f"{errors_and_warnings}")
self.assertEqual(f"{errors_and_warnings}", "[Fatal QC error: %Q30 50.00 was too low on lane: 1 for index read: 3]")
self.assertEqual(f"{errors_and_warnings}", "[Fatal QC error: %Q30 50.00 was too low on lane: 1 for index read: 1]")

def test_warning(self):
qc_config = {'name': 'Q30Handler', 'error': 70, 'warning': 85}
Expand Down

0 comments on commit d0f5ac4

Please sign in to comment.