ersilia.io.types package¶
Subpackages¶
Submodules¶
ersilia.io.types.compound module¶
- class ersilia.io.types.compound.IO(input_shape)[source]¶
Bases:
object
Class to handle input/output operations for compound data.
This class provides methods to set up requirements, generate example data, parse input data, and validate compound identifiers. It supports different input shapes such as single, list, and pair of lists.
- Parameters:
input_shape (object) – Input shape specification.
Examples
>>> from ersilia.io.shape import InputShapeSingle >>> io = IO(InputShapeSingle()) >>> list(io.example(1)) [{'key': '...', 'input': '...', 'text': '...'}]
- column_delimiter()[source]¶
Get the column delimiter.
- Returns:
The column delimiter.
- Return type:
str
- example(n_samples)[source]¶
Generate example data.
- Parameters:
n_samples (int) – Number of samples to generate.
- Returns:
Generator yielding example data.
- Return type:
generator
- is_input(text)[source]¶
Check if a text is a valid input.
- Parameters:
text (str) – The text to check.
- Returns:
True if the text is a valid input, False otherwise.
- Return type:
bool
- is_key(text)[source]¶
Check if a text is a valid key.
- Parameters:
text (str) – The text to check.
- Returns:
True if the text is a valid key, False otherwise.
- Return type:
bool
- parse(datum)[source]¶
Parse a datum.
- Parameters:
datum (any) – The datum to parse.
- Returns:
Parsed datum.
- Return type:
dict
ersilia.io.types.naive module¶
ersilia.io.types.protein module¶
ersilia.io.types.text module¶
- class ersilia.io.types.text.IO(input_shape)[source]¶
Bases:
object
Class to handle input/output operations for text data.
- Parameters:
input_shape (object) – Input shape specification.
- column_delimiter()[source]¶
Get the column delimiter.
- Returns:
The column delimiter.
- Return type:
str
- example(n_samples)[source]¶
Generate example data.
- Parameters:
n_samples (int) – Number of samples to generate.
- Returns:
Generator yielding example data.
- Return type:
generator
- is_input(text)[source]¶
Check if a text is a valid input.
- Parameters:
text (str) – The text to check.
- Returns:
True if the text is a valid input, False otherwise.
- Return type:
bool
- is_key(text)[source]¶
Check if a text is a valid key.
- Parameters:
text (str) – The text to check.
- Returns:
True if the text is a valid key, False otherwise.
- Return type:
bool
- parse(datum)[source]¶
Parse a datum.
- Parameters:
datum (any) – The datum to parse.
- Returns:
Parsed datum.
- Return type:
dict