Exemplo n.º 1
0
def report_run(run_id):
    lanes = sorted(set(e['lane_number'] for e in rest_api().get_documents('lanes', where={'run_id': run_id})))

    return render_template(
        'run_report.html',
        run_id + ' Run Report',
        include_review_modal=True,
        lane_aggregation=util.datatable_cfg(
            'Aggregation per lane',
            'lane_aggregation',
            api_url=util.construct_url('lanes', where={'run_id': run_id}),
            default_sort_col='lane_number',
            minimal=True,
            create_row='color_filter',
            review={'entity_field': 'aggregated.sample_ids', 'button_name': 'runreview'}
        ),
        tab_sets=[
            util.tab_set_cfg(
                'Demultiplexing reports per lane',
                [
                    util.datatable_cfg(
                        'Demultiplexing lane ' + str(lane),
                        'demultiplexing',
                        api_url=util.construct_url('run_elements', where={'run_id': run_id, 'lane': lane}),
                        minimal=True,
                        create_row='color_filter',
                        review={'entity_field': 'sample_id', 'button_name': 'runreview'}
                    )
                    for lane in lanes
                ]
            ),
            util.tab_set_cfg(
                'Unexpected barcodes',
                [
                    util.datatable_cfg(
                        'Unexpected barcodes lane ' + str(lane),
                        'unexpected_barcodes',
                        api_url=util.construct_url('unexpected_barcodes', where={'run_id': run_id, 'lane': lane}),
                        default_sort_col='passing_filter_reads',
                        minimal=True,
                        create_row='color_filter'
                    )
                    for lane in lanes
                ]
            )
        ],
        procs=rest_api().get_documents(
            'analysis_driver_procs',
            where={'dataset_type': 'run', 'dataset_name': run_id},
            embedded={'stages': 1},
            sort='-_created'
        )
    )
    def test_tab_set_cfg(self):

        with patch('auth.request', new=FakeRequest):
            dt_cfg = util.datatable_cfg('Test', 'demultiplexing', cfg['rest_api'])
        obs = util.tab_set_cfg('A Tab Set', [dt_cfg])
        exp = {
            'title': 'A Tab Set',
            'name': 'a_tab_set',
            'tables': [dt_cfg]
        }
        assert obs == exp