Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8b1114a
Updating PathsFile class to no longer treat gff_files as required, an…
AlexTate Jan 27, 2023
0b3cc40
Minor refactor to match the order of enumerate()'s (index, element) o…
AlexTate Jan 27, 2023
bd168cc
Updating tiny-count's load_gff_files() to treat GFF files as optional
AlexTate Jan 27, 2023
46ffd44
Updating SAM_reader to properly store header data when multiple heade…
AlexTate Jan 27, 2023
e7c6c7e
Refactoring ReferenceTables to use a base class for functionality tha…
AlexTate Jan 27, 2023
9841d6e
Adding a new class that is essentially the equivalent of ReferenceTab…
AlexTate Jan 27, 2023
3f88265
Updating FeatureCounter to switch between the two reference annotatio…
AlexTate Jan 27, 2023
f59ef1f
SAM file headers need some basic validation now that we're relying on…
AlexTate Feb 4, 2023
15e2795
Restructuring AnnotationParsing classes so that self.selector is assi…
AlexTate Feb 4, 2023
a44743f
Adding SamSqValidator which follows the same design patterns as GFFVa…
AlexTate Feb 4, 2023
cbf0ab3
Replacing load_gff_files() with load_references(). This is now where
AlexTate Feb 4, 2023
e8f4173
Updating the FeatureCounter constructor to use the new AnnotationPars…
AlexTate Feb 4, 2023
8e15f70
Misc. cleanup in configuration.py and resume.py:
AlexTate Feb 4, 2023
70783b2
Misc. cleanup in validation.py: empty results are more clearly indica…
AlexTate Feb 4, 2023
ddf3bfe
Updating unit tests
AlexTate Feb 4, 2023
cb11076
Adding unit tests for SAM @SQ header validation
AlexTate Feb 4, 2023
515f1ce
Merge branch 'master' into issue-277
AlexTate Feb 4, 2023
a0df42a
Bugfix: empty classifier fields are parsed from Features Sheet as an …
AlexTate Feb 4, 2023
9a4e00e
Renaming classes so they follow a better pattern:
AlexTate Feb 4, 2023
3247ea6
This commit only changes the order in which methods are defined in Re…
AlexTate Feb 4, 2023
ff79c98
Updating comments in the Paths File to indicate that gff_files is opt…
AlexTate Feb 4, 2023
ba97628
Adding a timeout to the sequence-based counting notice that is issued…
AlexTate Feb 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion START_HERE/paths.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# 1. Fill out the Samples Sheet with files to process + naming scheme. [samples.csv]
# 2. Fill out the Features Sheet with selection rules [features.csv]
# 3. Set samples_csv and features_csv (below) to point to these files
# 4. Add annotation files and per-file alias preferences to gff_files
# 4. Add annotation files and per-file alias preferences to gff_files (optional)
#
######-------------------------------------------------------------------------------######

Expand Down
2 changes: 1 addition & 1 deletion tests/testdata/config_files/paths.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# 1. Fill out the Samples Sheet with files to process + naming scheme. [samples.csv]
# 2. Fill out the Features Sheet with selection rules [features.csv]
# 3. Set samples_csv and features_csv (below) to point to these files
# 4. Add annotation files and per-file alias preferences to gff_files
# 4. Add annotation files and per-file alias preferences to gff_files (optional)
#
######-------------------------------------------------------------------------------######

Expand Down
58 changes: 50 additions & 8 deletions tests/unit_tests_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,18 +286,29 @@ def test_validate_required_parameters(self):

config[key] = oldval

"""Does PathsFile check that at least one GFF file has been provided?"""
"""Does PathsFile notify the user of the change in counting style
when no GFF files have been provided?"""

def test_validate_gff_files(self):
def test_no_gff_files(self):
config = make_paths_file()
stdout = io.StringIO()

with self.assertRaisesRegex(AssertionError, r".*(At least one GFF).*"):
config['gff_files'] = [{'path': "", 'alias': []}]
config.validate_paths()
gff_configs = [
[{'path': "", 'alias': []}],
[{'irrelevant': "value"}],
None,
[]
]

with self.assertRaisesRegex(AssertionError, r".*(At least one GFF).*"):
config['gff_files'] = [{'irrelevant': "value"}]
config.validate_paths()
with contextlib.redirect_stdout(stdout):
for gff_config in gff_configs:
config['gff_files'] = gff_config
config.validate_paths()
config_return = config.get_gff_config()

self.assertRegex(stdout.getvalue(), r".*(No GFF files).*")
self.assertEqual(config_return, {})
stdout.truncate(0)

"""Does PathsFile check for missing files for single entry parameters?"""

Expand Down Expand Up @@ -350,6 +361,37 @@ def test_pipeline_mapping(self):
self.assertEqual(config['empty_path'], "")
self.assertEqual(config['none_path'], None)

"""Does get_gff_config properly screen for "ID" alias attributes?"""

def test_get_gff_config_id_alias_attr(self):
config = make_paths_file()
config['gff_files'] = [{'path': "/irrelevant", 'alias': ['ID']}]

gff_files = config.get_gff_config()
expected = {"/irrelevant": []}

self.assertDictEqual(gff_files, expected)

"""Does get_gff_config merge aliases if the same GFF file is listed more than once?
Are duplicates also removed and original order preserved?"""

def test_get_gff_config_merge_alias_attr(self):
config = make_paths_file()
config['gff_files'] = [
{'path': "/same/path", 'alias': ['attr1', 'attr2']},
{'path': "/same/path", 'alias': ['attr1', 'attrN']},
{'path': "/different/path", 'alias': ['attr3']}
]

gff_files = config.get_gff_config()

expected = {
"/same/path": ['attr1', 'attr2', 'attrN'],
"/different/path": ['attr3']
}

self.assertDictEqual(gff_files, expected)


class ConfigurationTest(unittest.TestCase):

Expand Down
34 changes: 0 additions & 34 deletions tests/unit_tests_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,40 +231,6 @@ def test_load_config_rna_to_cDNA(self):

self.assertEqual(ruleset[0]['nt5end'], 'T')

"""Does load_gff_files properly screen for "ID" alias attributes?"""

def test_load_gff_files_id_alias_attr(self):
config = helpers.make_paths_file()
config['gff_files'] = [{'path': "/irrelevant", 'alias': ['ID']}]

# Patch GFFValidator so that it isn't called (not relevant)
with patch('tiny.rna.counter.counter.GFFValidator'):
gff_files = counter.load_gff_files(config, [], {})

expected = {"/irrelevant": []}
self.assertDictEqual(gff_files, expected)

"""Does load_gff_files merge aliases if the same GFF file is listed more than once?
Are duplicates also removed and original order preserved?"""

def test_load_gff_files_merge_alias_attr(self):
config = helpers.make_paths_file()
config['gff_files'] = [
{'path': "/same/path", 'alias': ['attr1', 'attr2']},
{'path': "/same/path", 'alias': ['attr1', 'attrN']},
{'path': "/different/path", 'alias': ['attr3']}
]

# Patch GFFValidator so that it isn't called (not relevant)
with patch('tiny.rna.counter.counter.GFFValidator'):
gff_files = counter.load_gff_files(config, [], {})

expected = {
"/same/path": ['attr1', 'attr2', 'attrN'],
"/different/path": ['attr3']
}

self.assertDictEqual(gff_files, expected)

if __name__ == '__main__':
unittest.main()
Loading