Elaborators

class pygna.elaborators.TableElaboration[source]

This class contains static methods to clean and filter specific columns of a table

static clean_table(table: pandas.core.frame.DataFrame, stat_col: str = 'stat') → pandas.core.frame.DataFrame[source]

This function clean the table from the N/A values

Parameters:
  • table – dataframerepresenting the table to be cleaned
  • stat_col – the column to be cleaned
Returns:

the table cleaned from the N/A values

Example

>>> import numpy as np
>>> table = pd.DataFrame(np.random.randint(0,100,size=(100, 1)), columns=list('mycol'))
>>> table = TableElaboration.clean_table(table, "mycol")
static filter_table(table: pandas.core.frame.DataFrame, filter_column: str = 'padj', alternative: str = 'less', threshold: float = 0.01) → pandas.core.frame.DataFrame[source]

This method filters a table according to a filter rule èassed as input

Parameters:
  • table – The table to be filtered
  • filter_column – Column with the values to be filtered
  • alternative – Alternative to use for the filterK with “less” the filter is applied <threshold; otherwise >= threshold
  • threshold – Threshold for the filter
Returns:

The table filtered

Example

>>> import numpy as np
>>> table = pd.DataFrame(np.random.randint(0,100,size=(100, 1)), columns=list('pval'))
>>> table = TableElaboration.filter_table(table, filter_column="pval")