Skip to content

Commit

Permalink
Adding supported genomes to species page, returning None from Require…
Browse files Browse the repository at this point in the history
…dYieldQ30._get_yield if no yield found
  • Loading branch information
mwhamgenomics committed Nov 20, 2018
1 parent 191e01f commit 65877c0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion etc/example_reporting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ rest_app:
username: user
password: pass

available_coverages: [1, 2, 5, 10, 20]
available_coverages: [1, 2, 4, 5, 10, 20]
available_yields: # keys are required yields, and values are associated required yield q30s
5: 4
10: 8
Expand Down
6 changes: 6 additions & 0 deletions reporting_app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,12 @@ def species_page(species):
util.construct_url('species', where={'name': species}),
minimal=True
),
util.datatable_cfg(
'Supported genomes',
'genomes',
util.construct_url('genomes', where={'species': species}, max_results=1000),
minimal=True
),
util.datatable_cfg(
'Yield requirements',
'yields',
Expand Down
3 changes: 2 additions & 1 deletion rest_api/aggregation/database_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ def _get_yield(self, genome_size, required_coverage):
into a required yield q30.
"""
required_yield = super()._get_yield(genome_size, required_coverage)
return self.quantised_yields[required_yield]
if required_yield:
return self.quantised_yields[required_yield]


class MostRecent(Calculation): # TODO: Should replace server_side.MostRecent
Expand Down
1 change: 1 addition & 0 deletions tests/test_reporting_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,4 @@ def test_project_status_report(self):

def test_genome_page(self):
self._test_render_template('/species')
self._test_render_template('/species/a_species')
18 changes: 10 additions & 8 deletions tests/test_rest_api/test_aggregation/test_database_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,21 +480,23 @@ def test_nb_unique_mutable_elements():

def test_required_yield():
e = database_hooks.RequiredYield('approximate_genome_size')
assert e.evaluate({'approximate_genome_size': 1990.6}) == {
assert e.evaluate({'approximate_genome_size': 2100.6}) == {
'1X': 5,
'2X': 5,
'5X': 10,
'10X': 20,
'20X': 40
'4X': 10,
'5X': 20,
'10X': 40,
'20X': None
}


def test_yield_for_quoted_coverage():
e = database_hooks.RequiredYieldQ30('approximate_genome_size')
assert e.evaluate({'approximate_genome_size': 1990.6}) == {
assert e.evaluate({'approximate_genome_size': 2100.6}) == {
'1X': 4,
'2X': 4,
'5X': 8,
'10X': 16,
'20X': 32
'4X': 8,
'5X': 16,
'10X': 32,
'20X': None
}

0 comments on commit 65877c0

Please sign in to comment.