Validate result format
ResultSchema
Bases: Enum
Enum for different result schema formats. Attributes: GENE_RESULT_SCHEMA (pl.Schema): Schema for gene-based results. VARIANT_RESULT_SCHEMA (pl.Schema): Schema for variant-based results. DISEASE_RESULT_SCHEMA (pl.Schema): Schema for disease-based results.
Source code in src/pheval/post_processing/validate_result_format.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
validate(results)
Validate that a DataFrame follows the expected schema. Args: results (pl.DataFrame): The DataFrame to validate. Raises: ValueError: If a required column is missing or the grouping_id column contains a null value. TypeError: If a column exists but has an incorrect data type. Returns: bool: True if the DataFrame is valid according to the schema.
Source code in src/pheval/post_processing/validate_result_format.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
validate_dataframe(schema)
Decorator to validate DataFrame input based on a ResultSchema.
Args:
schema (ResultSchema): The expected schema from the ResultSchema enum.
Returns:
Callable: A wrapped function that validates the DataFrame before execution.
Source code in src/pheval/post_processing/validate_result_format.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |