Skip to content

Commit

Permalink
Merge pull request #111 from Aratz/fix_checkQC
Browse files Browse the repository at this point in the history
Update NovaSeqX reagent recognizer
  • Loading branch information
Aratz committed Dec 7, 2023
2 parents 6c7c39d + 11fc43d commit 639d3e2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 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.0-rc1"
__version__ = "4.0.0-rc2"
12 changes: 10 additions & 2 deletions checkQC/run_type_recognizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,18 @@ def reagent_version(runtype_recognizer):
try:
run_parameters = runtype_recognizer.run_parameters['RunParameters']
consumables = run_parameters["ConsumableInfo"]["ConsumableInfo"]
reagent_version = next(
flowcell = next(
consumable for consumable in consumables
if consumable['Type'] == 'FlowCell'
)['Mode']
)

# "Mode" was used to specify the reagent version in the first runfolders that came out
# of the NovaSeqX. This is kept for backward compatibility.
reagent_version = flowcell.get("Name", flowcell.get("Mode"))

if not reagent_version:
raise KeyError

return reagent_version
except (KeyError, StopIteration):
raise ReagentVersionUnknown("Could not identify flowcell mode for NovaSeqXPlus")
Expand Down
19 changes: 19 additions & 0 deletions tests/test_run_type_recognizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,25 @@ def test_novaseq_reagent_version_raises(self):
self.novaseq.reagent_version(mock_runtype_recognizer)

def test_novaseqxplus_reagent_version(self):
runtype_dict = {
"RunParameters": {
"ConsumableInfo": {
"ConsumableInfo": [
{"Type": "FlowCell", "Name": "10B"},
{"Type": "Reagent"},
{"Type": "Buffer"},
]
}
}
}
mock_runtype_recognizer = self.MockRunTypeRecognizer(run_parameters=runtype_dict)

actual = self.novaseqxplus.reagent_version(mock_runtype_recognizer)
expected = "10B"

self.assertEqual(actual, expected)

def test_novaseqxplus_reagent_version_old(self):
runtype_dict = {
"RunParameters": {
"ConsumableInfo": {
Expand Down

0 comments on commit 639d3e2

Please sign in to comment.