Skip to content

Commit

Permalink
Updated tests (#119)
Browse files Browse the repository at this point in the history
Updated tests to match the latest updates in behavior for metapool
module.
  • Loading branch information
charles-cowart authored Jan 29, 2024
1 parent 1fb3e71 commit 3bc9194
Show file tree
Hide file tree
Showing 6 changed files with 453 additions and 454 deletions.
853 changes: 428 additions & 425 deletions sequence_processing_pipeline/tests/data/bad-sample-sheet-metagenomics.csv

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[Header],,,,,,,,,,,
IEMFileVersion,4,,,,,,,,,,
SheetType,standard_metag,,,,,,,,,,
SheetVersion,100,,,,,,,,,,
Investigator Name,Knight,,,,,,,,,,
Experiment Name,RKL0042,,,,,,,,,,
Date,2020-02-26,,,,,,,,,,
Expand Down
2 changes: 2 additions & 0 deletions sequence_processing_pipeline/tests/data/good-sample-sheet.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[Header],,,,,,,,,,,
IEMFileVersion,4,,,,,,,,,,
SheetType,standard_metag,,,,,,,,,,
SheetVersion,100,,,,,,,,,,
Investigator Name,Knight,,,,,,,,,,
Experiment Name,RKL0042,,,,,,,,,,
Date,2020-02-26,,,,,,,,,,
Expand Down
21 changes: 9 additions & 12 deletions sequence_processing_pipeline/tests/test_NuQCJob.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,37 +579,34 @@ def test_nuqcjob_creation(self):
sheet.Header['Assay'] = 'NotMetagenomic'
sheet.write(f)

with self.assertRaises(PipelineError) as e:
with self.assertRaisesRegex(ValueError, "tmp-sample-sheet.csv' does "
"not appear to be a valid "
"sample-sheet."):
NuQCJob(self.fastq_root_path, self.output_path,
self.tmp_file_path, self.mmi_db_paths,
'queue_name', 1, 1440, '8gb',
'fastp', 'minimap2', 'samtools', [], self.qiita_job_id,
1000, '')

self.assertEqual(str(e.exception), ("Assay value 'NotMetagenomic' is "
"not recognized."))

with self.assertRaises(ValueError) as e:
with self.assertRaisesRegex(ValueError, "bad-sample-sheet-bool-test."
"csv' does not appear to be a"
" valid sample-sheet."):
NuQCJob(self.fastq_root_path, self.output_path,
self.bad_sheet_bools_path, self.mmi_db_paths,
'queue_name', 1, 1440, '8gb',
'fastp', 'minimap2', 'samtools', [], self.qiita_job_id,
1000, '')

self.assertEqual(str(e.exception),
"'FALSE' is not a valid value for HumanFiltering")

def test_assay_value(self):
with self.assertRaises(PipelineError) as e:
with self.assertRaisesRegex(ValueError, "bad-sample-sheet-metagenomics"
".csv' does not appear to be a"
" valid sample-sheet."):
NuQCJob(self.fastq_root_path, self.output_path,
self.bad_sample_sheet_path, self.mmi_db_paths,
'queue_name', 1, 1440, '8gb',
'fastp', 'minimap2', 'samtools', [], self.qiita_job_id,
1000, '')

self.assertEqual(str(e.exception), "Assay value 'Metagenomics' is not"
" recognized.")

def test_audit(self):
job = NuQCJob(self.fastq_root_path, self.output_path,
self.good_sample_sheet_path, self.mmi_db_paths,
Expand Down
8 changes: 3 additions & 5 deletions sequence_processing_pipeline/tests/test_Pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,15 @@ def test_creation(self):
"/data/bad_configuration.json")

# Pipeline should assert due to Assay having a bad value.
with self.assertRaises(PipelineError) as e:
with self.assertRaisesRegex(ValueError, "bad-sample-sheet-metagenomics"
".csv' does not appear to be a"
" valid sample-sheet."):
Pipeline(self.good_config_file,
self.good_run_id,
self.bad_assay_type_path, None,
self.output_file_path,
self.qiita_id, Pipeline.METAGENOMIC_PTYPE, None)

self.assertTrue("Valid Assay values are ['TruSeq HT', 'Metagenomic', "
"'Metatranscriptomic']"
in str(e.exception))

# Pipeline should assert due to an invalid config file path.
with self.assertRaises(PipelineError) as e:
Pipeline(self.invalid_config_file,
Expand Down
21 changes: 9 additions & 12 deletions sequence_processing_pipeline/tests/test_QCJob.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,37 +582,34 @@ def test_qcjob_creation(self):
sheet.Header['Assay'] = 'NotMetagenomic'
sheet.write(f)

with self.assertRaises(PipelineError) as e:
with self.assertRaisesRegex(ValueError, "tmp-sample-sheet.csv' does "
"not appear to be a valid "
"sample-sheet."):
QCJob(self.fastq_root_path, self.output_path,
self.tmp_file_path, self.mmi_db_paths,
self.kraken2_db_path, 'queue_name', 1, 16, 1440, '8gb',
'fastp', 'minimap2', 'samtools', [], self.qiita_job_id,
30, 1000)

self.assertEqual(str(e.exception), ("Assay value 'NotMetagenomic' is "
"not recognized."))

with self.assertRaises(ValueError) as e:
with self.assertRaisesRegex(ValueError, "bad-sample-sheet-bool-test."
"csv' does not appear to be a"
" valid sample-sheet."):
QCJob(self.fastq_root_path, self.output_path,
self.bad_sheet_bools_path, self.mmi_db_paths,
self.kraken2_db_path, 'queue_name', 1, 16, 1440, '8gb',
'fastp', 'minimap2', 'samtools', [], self.qiita_job_id,
30, 1000)

self.assertEqual(str(e.exception),
"'FALSE' is not a valid value for HumanFiltering")

def test_assay_value(self):
with self.assertRaises(PipelineError) as e:
with self.assertRaisesRegex(ValueError, "bad-sample-sheet-metagenomics"
".csv' does not appear to be a"
" valid sample-sheet."):
QCJob(self.fastq_root_path, self.output_path,
self.bad_sample_sheet_path, self.mmi_db_paths,
self.kraken2_db_path, 'queue_name', 1, 16, 1440, '8gb',
'fastp', 'minimap2', 'samtools', [], self.qiita_job_id, 30,
1000)

self.assertEqual(str(e.exception), "Assay value 'Metagenomics' is not"
" recognized.")

def test_split_file_creation(self):
qc_job = QCJob(self.fastq_root_path, self.output_path,
self.good_sample_sheet_path, self.mmi_db_paths,
Expand Down

0 comments on commit 3bc9194

Please sign in to comment.