function initTableDrugs () {
                    var filename = (scope.output ? scope.output + '-' : '') + 'known_drugs';
                    table = elem[0].getElementsByTagName('table');
                    dtable = $(table).dataTable(otUtils.setTableToolsParams({
                        'data': formatDrugsDataToArray(scope.ext.data),
                        'autoWidth': false,
                        'paging': true,
                        'order': [[5, 'desc']],
                        'buttons': [
                            {
                                extend: 'csv',
                                text: '<span title="Download as .csv"><span class="fa fa-download"></span> Download .csv</span>',
                                title: filename
                            },
                            {
                                extend: 'csv',
                                text: '<span title="Download as .csv"><span class="fa fa-download"></span> Download .tsv</span>',
                                title: filename,
                                fieldSeparator: '\t',
                                extension: '.tsv'
                            },
                            {
                                text: '<span title="Download as .csv"><span class="fa fa-download"></span> Download .json</span>',
                                title: filename,
                                extension: '.json',
                                action: function () {
                                    var data = {data: scope.ext.rawdata.data};
                                    var b = new Blob([JSON.stringify(data)], {type: 'text/json;charset=utf-8'});
                                    saveAs(b, filename + '.json');
                                }
                            }
                        ],
                        'columnDefs': [
                            // set column widths
                            // disease (col 1) is unset so it takes up whatever space left (10-13%)
                            {
                                'targets': [0],    // the access-level (public/private icon)
                                'width': '3%'
                            },
                            {
                                'targets': [3, 9, 13, 16],
                                'width': '10%'
                            },
                            {
                                'targets': [7, 8, 11, 12, 15],
                                'width': '8%'
                            },
                            {
                                'targets': [5],
                                'width': '7%'
                            },
                            // set columns visiblity and filters
                            // access-level
                            {
                                'targets': [0],
                                'visible': otConfig.show_access_level
                            },
                            // disease
                            {
                                'targets': [1],
                                'mRender': otColumnFilter.mRenderGenerator(18),
                                'mData': otColumnFilter.mDataGenerator(1, 18)
                            },
                            {
                                'targets': [2],
                                'visible': false
                            },
                            // drug
                            {
                                'targets': [3],
                                'mRender': otColumnFilter.mRenderGenerator(19),
                                'mData': otColumnFilter.mDataGenerator(3, 19)
                            },
                            // drug id
                            {
                                'targets': [4],
                                'visible': false
                            },
                            {
                                'targets': [6],
                                'visible': false
                            },
                            // mech of action
                            {
                                'targets': [9],
                                'mRender': otColumnFilter.mRenderGenerator(20),
                                'mData': otColumnFilter.mDataGenerator(9, 20)
                            },
                            {
                                'targets': [10],
                                'visible': false
                            },
                            // target
                            {
                                'targets': [13],
                                'mRender': otColumnFilter.mRenderGenerator(22),
                                'mData': otColumnFilter.mDataGenerator(13, 22)
                            },
                            // target ID
                            {
                                'targets': [14],
                                'visible': false
                            },
                            // evidence source
                            {
                                'targets': [16],
                                'mRender': otColumnFilter.mRenderGenerator(21),
                                'mData': otColumnFilter.mDataGenerator(16, 21)
                            },
                            // evidence URL
                            {
                                'targets': [17],
                                'visible': false
                            }
                        ],
                        initComplete: otColumnFilter.initCompleteGenerator(dropdownColumns)
                    }, filename));
                }
/*
                * This is the hardcoded data for the Known Drugs table and
                * will obviously need to change and pull live data when available
                */
This is the hardcoded data for the Known Drugs table and
will obviously need to change and pull live data when available
This is the hardcoded data for the Known Drugs table and will obviously need to change and pull live data when available
function initTableDrugs () {
                    var filename = (scope.output ? scope.output + '-' : '') + 'known_drugs';
                    table = elem[0].getElementsByTagName('table');
                    dtable = $(table).dataTable(otUtils.setTableToolsParams({
                        'data': formatDrugsDataToArray(scope.ext.data),
                        'autoWidth': false,
                        'paging': true,
                        'order': [[5, 'desc']],
                        'buttons': [
                            {
                                extend: 'csv',
                                text: '<span title="Download as .csv"><span class="fa fa-download"></span> Download .csv</span>',
                                title: filename
                            },
                            {
                                extend: 'csv',
                                text: '<span title="Download as .csv"><span class="fa fa-download"></span> Download .tsv</span>',
                                title: filename,
                                fieldSeparator: '\t',
                                extension: '.tsv'
                            },
                            {
                                text: '<span title="Download as .csv"><span class="fa fa-download"></span> Download .json</span>',
                                title: filename,
                                extension: '.json',
                                action: function () {
                                    var data = {data: scope.ext.rawdata.data};
                                    var b = new Blob([JSON.stringify(data)], {type: 'text/json;charset=utf-8'});
                                    saveAs(b, filename + '.json');
                                }
                            }
                        ],
                        'columnDefs': [
                            {
                                'targets': [0],    
                                'width': '3%'
                            },
                            {
                                'targets': [3, 9, 13, 16],
                                'width': '10%'
                            },
                            {
                                'targets': [7, 8, 11, 12, 15],
                                'width': '8%'
                            },
                            {
                                'targets': [5],
                                'width': '7%'
                            },
                            {
                                'targets': [0],
                                'visible': otConfig.show_access_level
                            },
                            {
                                'targets': [1],
                                'mRender': otColumnFilter.mRenderGenerator(18),
                                'mData': otColumnFilter.mDataGenerator(1, 18)
                            },
                            {
                                'targets': [2],
                                'visible': false
                            },
                            {
                                'targets': [3],
                                'mRender': otColumnFilter.mRenderGenerator(19),
                                'mData': otColumnFilter.mDataGenerator(3, 19)
                            },
                             id
                            {
                                'targets': [4],
                                'visible': false
                            },
                            {
                                'targets': [6],
                                'visible': false
                            },
                            {
                                'targets': [9],
                                'mRender': otColumnFilter.mRenderGenerator(20),
                                'mData': otColumnFilter.mDataGenerator(9, 20)
                            },
                            {
                                'targets': [10],
                                'visible': false
                            },
                            {
                                'targets': [13],
                                'mRender': otColumnFilter.mRenderGenerator(22),
                                'mData': otColumnFilter.mDataGenerator(13, 22)
                            },
                             ID
                            {
                                'targets': [14],
                                'visible': false
                            },
                            {
                                'targets': [16],
                                'mRender': otColumnFilter.mRenderGenerator(21),
                                'mData': otColumnFilter.mDataGenerator(16, 21)
                            },
                            {
                                'targets': [17],
                                'visible': false
                            }
                        ],
                        initComplete: otColumnFilter.initCompleteGenerator(dropdownColumns)
                    }, filename));
                }
function initTableDrugs ( ) { var filename = ( scope . output ? scope . output + '-' : '' ) + 'known_drugs' ; table = elem [ 0 ] . getElementsByTagName ( 'table' ) ; dtable = $ ( table ) . dataTable ( otUtils . setTableToolsParams ( { 'data' : formatDrugsDataToArray ( scope . ext . data ) , 'autoWidth' : false , 'paging' : true , 'order' : [ [ 5 , 'desc' ] ] , 'buttons' : [ { extend : 'csv' , text : '<span title="Download as .csv"><span class="fa fa-download"></span> Download .csv</span>' , title : filename } , { extend : 'csv' , text : '<span title="Download as .csv"><span class="fa fa-download"></span> Download .tsv</span>' , title : filename , fieldSeparator : '\t' , extension : '.tsv' } , { text : '<span title="Download as .csv"><span class="fa fa-download"></span> Download .json</span>' , title : filename , extension : '.json' , action : function ( ) { var data = { data : scope . ext . rawdata . data } ; var b = new Blob ( [ JSON . stringify ( data ) ] , { type : 'text/json;charset=utf-8' } ) ; saveAs ( b , filename + '.json' ) ; } } ] , 'columnDefs' : [ { 'targets' : [ 0 ] , 'width' : '3%' } , { 'targets' : [ 3 , 9 , 13 , 16 ] , 'width' : '10%' } , { 'targets' : [ 7 , 8 , 11 , 12 , 15 ] , 'width' : '8%' } , { 'targets' : [ 5 ] , 'width' : '7%' } , { 'targets' : [ 0 ] , 'visible' : otConfig . show_access_level } , { 'targets' : [ 1 ] , 'mRender' : otColumnFilter . mRenderGenerator ( 18 ) , 'mData' : otColumnFilter . mDataGenerator ( 1 , 18 ) } , { 'targets' : [ 2 ] , 'visible' : false } , { 'targets' : [ 3 ] , 'mRender' : otColumnFilter . mRenderGenerator ( 19 ) , 'mData' : otColumnFilter . mDataGenerator ( 3 , 19 ) } , { 'targets' : [ 4 ] , 'visible' : false } , { 'targets' : [ 6 ] , 'visible' : false } , { 'targets' : [ 9 ] , 'mRender' : otColumnFilter . mRenderGenerator ( 20 ) , 'mData' : otColumnFilter . mDataGenerator ( 9 , 20 ) } , { 'targets' : [ 10 ] , 'visible' : false } , { 'targets' : [ 13 ] , 'mRender' : otColumnFilter . mRenderGenerator ( 22 ) , 'mData' : otColumnFilter . mDataGenerator ( 13 , 22 ) } , { 'targets' : [ 14 ] , 'visible' : false } , { 'targets' : [ 16 ] , 'mRender' : otColumnFilter . mRenderGenerator ( 21 ) , 'mData' : otColumnFilter . mDataGenerator ( 16 , 21 ) } , { 'targets' : [ 17 ] , 'visible' : false } ] , initComplete : otColumnFilter . initCompleteGenerator ( dropdownColumns ) } , filename ) ) ; }
This is the hardcoded data for the Known Drugs table and
 will obviously need to change and pull live data when available
This is the hardcoded data for the Known Drugs table and will obviously need to change and pull live data when available
// set column widths // disease (col 1) is unset so it takes up whatever space left (10-13%) // the access-level (public/private icon) // set columns visiblity and filters // access-level // disease // drug // drug id // mech of action // target // target ID // evidence source // evidence URL