acore.types.enrichment_analysis module

Contents

acore.types.enrichment_analysis module#

class EnrichmentAnalysisSchema(*args, **kwargs)[source]#

Bases: DataFrameModel

Schema for the enrichment analysis results DataFrame.

terms: str = 'terms'#
identifiers: str = 'identifiers'#
foreground: int = 'foreground'#
background: int = 'background'#
foreground_pop: int = 'foreground_pop'#
background_pop: int = 'background_pop'#
pvalue: float = 'pvalue'#
padj: float = 'padj'#
rejected: bool = 'rejected'#
direction: str = 'direction'#
comparison: str = 'comparison'#
class Config#

Bases: BaseConfig

add_missing_columns: bool = False#

add columns to dataframe if they are missing

coerce: bool = False#

coerce types of all schema components

description: str | None = None#

arbitrary textual description

drop_invalid_rows: bool = False#

drop invalid rows on validation

dtype: str | type | DataType | ExtensionDtype | dtype | None = None#

datatype of the dataframe. This overrides the data types specified in any of the fields.

from_format: Literal[Formats.csv] | Literal[Formats.dict] | Literal[Formats.json] | Literal[Formats.feather] | Literal[Formats.parquet] | Literal[Formats.pickle] | Literal[Formats.json_normalize] | Callable | None = None#

data format before validation. This option only applies to schemas used in the context of the pandera type constructor pa.typing.DataFrame[Schema](data). If None, assumes a data structure compatible with the pandas.DataFrame constructor.

from_format_kwargs: dict[str, Any] | None = None#

a dictionary keyword arguments to pass into the reader function that converts the object of type from_format to a pandera-validate-able data structure. The reader function is implemented in the pandera.typing generic types via the from_format and to_format methods.

metadata: dict | None = None#

a dictionary object to store key-value data at schema level

multiindex_coerce: bool = False#

coerce types of all MultiIndex components

multiindex_name: str | None = None#

name of multiindex

multiindex_ordered: bool = True#

validate MultiIndex in order

multiindex_strict: bool | Literal['filter'] = False#

make sure all specified columns are in validated MultiIndex - if "filter", removes indexes not specified in the schema

multiindex_unique = None#

make sure the MultiIndex is unique along the list of columns

name: str | None = 'EnrichmentAnalysisSchema'#

name of schema

ordered: bool = False#

validate columns order

strict: bool | Literal['filter'] = False#

make sure all specified columns are in the validated dataframe - if "filter", removes columns not specified in the schema

title: str | None = None#

human-readable label for schema

to_format: Literal[Formats.csv] | Literal[Formats.dict] | Literal[Formats.json] | Literal[Formats.feather] | Literal[Formats.parquet] | Literal[Formats.pickle] | Literal[Formats.json_normalize] | Callable | None = None#

data format to serialize into after validation. This option only applies to schemas used in the context of the pandera type constructor pa.typing.DataFrame[Schema](data). If None, returns a dataframe.

to_format_buffer: str | Callable | None = None#

Buffer to be provided when to_format is a custom callable. See docs for example of how to implement an example of a to format function.

to_format_kwargs: dict[str, Any] | None = None#

a dictionary keyword arguments to pass into the writer function that converts the pandera-validate-able object to type to_format. The writer function is implemented in the pandera.typing generic types via the from_format and to_format methods.

unique: str | list[str] | None = None#

make sure certain column combinations are unique

unique_column_names: bool = False#

make sure dataframe column names are unique

classmethod build_schema_(**kwargs) DataFrameSchema#
classmethod empty(*_args) DataFrame[Self]#

Create an empty DataFrame with the schema of this model.

classmethod example(**kwargs) DataFrameBase[Self]#

Generate an example of this data model specification.

classmethod from_json(source)#

Load a schema from JSON.

Parameters:

source – str, Path, or file stream with JSON content.

Returns:

the backend-specific schema object.

classmethod from_yaml(yaml_schema)#

Load a schema from YAML.

Parameters:

yaml_schema – str, Path, or file stream with YAML content.

Returns:

the backend-specific schema object.

classmethod get_metadata() dict | None#

Provide metadata for columns and schema level

classmethod pydantic_validate(schema_model: Any) DataFrameModel#

Verify that the input is a compatible dataframe model.

classmethod strategy(**kwargs)#

Create a data synthesis strategy.

classmethod to_json(target: PathLike | None = None, **kwargs)#

Convert this model’s schema to JSON.

classmethod to_json_schema()#

Serialize schema metadata into json-schema format.

Parameters:

dataframe_schema – schema to write to json-schema format.

Note

This function is currently does not fully specify a pandera schema, and is primarily used internally to render OpenAPI docs via the FastAPI integration.

classmethod to_schema() TSchema#

Create DataFrameSchema from the DataFrameModel.

classmethod to_yaml(stream: PathLike | None = None)#

Convert this model’s schema to YAML.

classmethod validate(check_obj: DataFrame, head: int | None = None, tail: int | None = None, sample: int | None = None, random_state: int | None = None, lazy: bool = False, inplace: bool = False) DataFrame[Self]#

Validate a DataFrame based on the schema specification.

Parameters:
  • check_obj (pd.DataFrame) – the dataframe to be validated.

  • head – validate the first n rows. Rows overlapping with tail or sample are de-duplicated.

  • tail – validate the last n rows. Rows overlapping with head or sample are de-duplicated.

  • sample – validate a random sample of n rows. Rows overlapping with head or tail are de-duplicated.

  • random_state – random seed for the sample argument.

  • lazy – if True, lazily evaluates dataframe against all validation checks and raises a SchemaErrors. Otherwise, raise SchemaError as soon as one occurs.

  • inplace – if True, applies coercion to the object of validation, otherwise creates a copy of the data.

Returns:

validated DataFrame

Raises:

SchemaError – when DataFrame violates built-in or custom checks.