phenopacket_mapper.utils package
This submodule contains utility functions that are used throughout the package.
- class phenopacket_mapper.utils.NotebookBuilder[source]
Bases:
object
A class to build a Jupyter notebook programmatically.
- add_markdown_cell(text)[source]
Adds a Markdown cell to the notebook.
- Parameters:
text – The Markdown content to be added to the cell.
- phenopacket_mapper.utils.loc_default(df: DataFrame, row_index: int, column_name: str, default: Any = '') Any [source]
Safely performs loc on a pd.DataFrame, returns default value if something goes wrong
- Parameters:
df – the dataframe
row_index – index of the row
column_name – name of the column
default – default value to return if some error occurs
- Returns:
Value at the row and column specified
- phenopacket_mapper.utils.str_to_valid_id(s: str) str [source]
Converts a string to a valid id
This function converts a string to a valid id by replacing spaces with underscores and removing all other non-alphanumeric characters.
- Parameters:
s – The string to convert to a valid id
- Returns:
The valid id