def _init_datatable_function(self, rois): """ Initiate :class:`DataTableFunction` to create table to link each row with sub HTML report. All table will have the same appearance. So, let's initiate its only once. """ datatable_js = DataTableFunction(rois.df, 'roi') datatable_js.datatable_options = {'scrollX': 'true', 'pageLength': 15, 'scrollCollapse' : 'true', 'dom': 'Bfrtip', 'buttons': ['copy', 'csv']} return datatable_js
def test_datatables(): bed = bedtools.GenomeCov(sequana_data("JB409847.cov.csv"), sequana_data("JB409847.gbk")) rois = bed[0].get_roi() rois.df['link'] = 'test' datatable_js = DataTableFunction(rois.df, 'roi') datatable_js.set_links_to_column('link', 'start') datatable_js.datatable_options = { 'scrollX': 'true', 'pageLength': 15, 'scrollCollapse': 'true', 'dom': 'Bfrtip', 'buttons': ['copy', 'csv'] } datatable = DataTable(rois.df, 'rois', datatable_js) html_table = datatable.create_datatable(float_format='%.3g')
def init_roi_datatable(rois): """ Initiate :class:`DataTableFunction` to create table to link each row with sub HTML report. All table will have the same appearance. We can therefore initialise the roi once for all. :param rois: can be a ROIs from ChromosomeCov instance or a simple dataframe """ # computed try: df = rois.df.copy() except: df = rois.copy() df['link'] = '' # set datatable options datatable_js = DataTableFunction(df, 'roi') if "start" in df.columns: datatable_js.set_links_to_column('link', 'start') if "end" in df.columns: datatable_js.set_links_to_column('link', 'end') datatable_js.datatable_options = {'scrollX': 'true', 'pageLength': 15, 'scrollCollapse' : 'true', 'dom': 'Bfrtip', 'buttons': ['copy', 'csv']} return datatable_js
def test_datatables(): bed = bedtools.GenomeCov(sequana_data("JB409847.bed"), sequana_data("JB409847.gbk")) fasta = sequana_data("JB409847.fasta") bed.compute_gc_content(fasta) c = bed.chr_list[0] c.run(4001) rois = c.get_rois() rois.df['link'] = 'test' datatable_js = DataTableFunction(rois.df, 'roi') datatable_js.set_links_to_column('link', 'start') datatable_js.datatable_options = {'scrollX': 'true', 'pageLength': 15, 'scrollCollapse' : 'true', 'dom': 'Bfrtip', 'buttons': ['copy', 'csv']} datatable = DataTable(rois.df, 'rois', datatable_js) html_table = datatable.create_datatable(float_format='%.3g')
def test_datatables(): bed = bedtools.GenomeCov(sequana_data("JB409847.bed"), sequana_data("JB409847.gbk")) fasta = sequana_data("JB409847.fasta") bed.compute_gc_content(fasta) c = bed.chr_list[0] c.run(4001) rois = c.get_rois() rois.df['link'] = 'test' datatable_js = DataTableFunction(rois.df, 'roi') datatable_js.set_links_to_column('link', 'start') datatable_js.datatable_options = { 'scrollX': 'true', 'pageLength': 15, 'scrollCollapse': 'true', 'dom': 'Bfrtip', 'buttons': ['copy', 'csv'] } datatable = DataTable(rois.df, 'rois', datatable_js) html_table = datatable.create_datatable(float_format='%.3g')
def init_roi_datatable(chrom): """ Initiate :class:`DataTableFunction` to create table to link each row with sub HTML report. All table will have the same appearance. So, let's initiate its only once. """ # get an roi df df = chrom.get_roi().df.copy() df['link'] = '' # set datatable options datatable_js = DataTableFunction(df, 'roi') datatable_js.set_links_to_column('link', 'start') datatable_js.set_links_to_column('link', 'end') datatable_js.datatable_options = { 'scrollX': 'true', 'pageLength': 15, 'scrollCollapse': 'true', 'dom': 'Bfrtip', 'buttons': ['copy', 'csv'] } return datatable_js