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.

notebook_content

A dictionary representing the notebook structure.

Type:

dict

add_markdown_cell(text)[source]

Adds a Markdown cell to the notebook.

Parameters:

text (str) – The Markdown content to be added to the cell.

add_code_cell(code)[source]

Adds a code cell to the notebook.

Parameters:

code (str) – The Python code to be added to the cell.

write_to_file(path: Path)[source]

Writes the notebook content to a file.

Parameters:

path (str) – The name of the file where the notebook will be saved.

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

Subpackages

Submodules