Skip to content

Commit 484dd2f

Browse files
code review fixes, sort to stabilize order output in tests
1 parent dcea6ac commit 484dd2f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

notebooks/pacbio_sample_sheet_builder.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196
"metadata": {},
197197
"outputs": [],
198198
"source": [
199-
"# determine which columns are required and\n",
199+
"# determine which columns are required\n",
200200
"cols_to_get = [sample_name_col_key, plate_col_key, well_col_key,\n",
201201
" barcode_col_key, twist_adaptor_id_col_key, project_name_col_key,\n",
202202
" qiita_id_key, sample_type_key]\n",
@@ -224,7 +224,7 @@
224224
"# eventually may make a sample sheet for each different run id in the\n",
225225
"# processing doc, but for now just error if more than one\n",
226226
"curr_run_ids = set(list(info_df[run_id_key].values))\n",
227-
"if len(curr_run_ids) >1:\n",
227+
"if len(curr_run_ids) > 1:\n",
228228
" raise ValueError(f\"Multiple run ids found: {curr_run_ids}\")\n",
229229
"\n",
230230
"curr_run_id = list(curr_run_ids)[0]\n",
@@ -241,7 +241,7 @@
241241
"# drop any row that doesn't have a qiita id\n",
242242
"info_df = info_df.dropna(subset=[qiita_id_key])\n",
243243
"\n",
244-
"# get all the unique qiita ids in the curr_run_df\n",
244+
"# get all the unique qiita ids in the dataframe\n",
245245
"qiita_ids = set(list(info_df[qiita_id_key].values))\n",
246246
"qiita_ids"
247247
]
@@ -445,7 +445,7 @@
445445
"outputs": [],
446446
"source": [
447447
"# loop over each qiita id and add to the metadata dictionary for it\n",
448-
"for curr_qiita_id in qiita_ids:\n",
448+
"for curr_qiita_id in sorted(qiita_ids):\n",
449449
" # get the subset of plate_df for this qiita id\n",
450450
" curr_qiita_id_mask = plate_df[qiita_id_key] == curr_qiita_id\n",
451451
" curr_qiita_id_df = plate_df.loc[curr_qiita_id_mask].copy()\n",

notebooks/tests/notebook_test_helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class TestNotebook(unittest.TestCase):
1515
_ZERO_DATES_FUNC_KEY = "zero_dates_func" # func to replace for dates
1616

1717
# TODO: turn off before committing
18-
_SAVE_UNMATCHED_OUTPUTS = True # whether to save unmatched outputs
18+
_SAVE_UNMATCHED_OUTPUTS = False # whether to save unmatched outputs
1919

2020
def setUp(self):
2121
self.notebooks_dir = os.path.dirname(os.path.dirname(__file__))
@@ -26,7 +26,7 @@ def _help_test_files_exact_text_match(self, file_1, file_2, filename=None,
2626
zero_dates_func=None):
2727
"""Helper function to compare two text files for exact match."""
2828

29-
filename = filename if not filename else f"{filename} "
29+
filename = f"{filename} " if filename else ""
3030
msg = f"{filename}files do not match exactly."
3131
self.maxDiff = None
3232
with open(file_1, 'r', encoding='utf-8') as f1, \

notebooks/tests/test_pacbio_sample_sheet_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_pacbio_v11_pooled_absquant(self):
8383
('{path}/SampleSheets/'
8484
'pacbio_v11_absquant_pooled_sample_sheet.csv'),
8585
self._FILE_PATH_KEY: True
86-
},
86+
}
8787
}
8888

8989
self._run_notebook_test(run_params, output_params)

0 commit comments

Comments
 (0)