phenotrex.util package

Submodules

phenotrex.util.helpers module

phenotrex.util.helpers.fail_missing_dependency(*args, **kwargs)[source]
phenotrex.util.helpers.get_groups(records: List[phenotrex.structure.records.TrainingRecord]) → numpy.ndarray[source]

Get groups from list of TrainingRecords

Parameters

records

Returns

list for groups

phenotrex.util.helpers.get_x_y_tn(records: List[phenotrex.structure.records.TrainingRecord]) → Tuple[numpy.ndarray, numpy.ndarray, str][source]

Get separate X and y from list of TrainingRecord. Also infer trait name from first TrainingRecord.

Parameters

records – a List[TrainingRecord]

Returns

separate lists of features and targets, and the trait name

phenotrex.util.logging module

phenotrex.util.logging.get_logger(initname, verb=False)[source]

This function provides a logger to all scripts used in this project.

Parameters
  • initname – The name of the logger to show up in log.

  • verb – Toggle verbosity

Returns

the finished Logger object.

phenotrex.util.plotting module

phenotrex.util.plotting.compleconta_plot(cccv_results: Union[Dict[float, Dict[float, Dict[str, float]]], List[Dict[float, Dict[float, Dict[str, float]]]]], conditions: List[str] = (), each_n: List[int] = None, title: str = '', fontsize: int = 16, figsize=(10, 7), plot_comple: bool = True, plot_conta: bool = True, colors: List = None, save_path: Union[str, pathlib.Path] = None, **kwargs)[source]

Plots Compleconta CV result for one or multiple models. For perfect completeness and variable contamination as well as perfect contamination and variable completeness, the resulting mean balanced accuracy over folds is plotted.

Parameters
  • cccv_results – a ComplecontaCV result, or list thereof

  • conditions – A list of condition names associated cccv_results

  • each_n – A list of sample counts in datasets associated with cccv_results

  • title – The plot title

  • fontsize – The fontsize of the plot

  • figsize – The figure size (tuple of width, height)

  • plot_comple – Whether to plot completeness

  • plot_conta – Whether to plot contamination

  • colors

  • save_path – The save path of the plot; if None, display it with plt.show()

  • kwargs – any further keyword arguments passed to plt.plot()

Returns

None

phenotrex.util.taxonomy module

Module contents