psite_annotation.annotators.ClinicalBasketAnnotator

class psite_annotation.annotators.ClinicalBasketAnnotator(annotation_file)

Bases: object

Annotate pandas dataframe with clinical baskets from Annika.

Requires Gene names column in the dataframe to be annotated.

Example

annotator = ClinicalBasketAnnotator(<path_to_annotation_file>)
annotator.load_annotations()
df = annotator.annotate(df)

Initialize the input files and options for ClinicalBasketAnnotator.

Parameters:

annotation_file (str) – excel file with basket-gene annotations

Methods

annotate

Adds column with baskets the gene names correspond to.

load_annotations

Reads in excel file with basket-gene annotations.

annotate(df, inplace=False)

Adds column with baskets the gene names correspond to.

Adds the following annotation columns to dataframe:

  • Clinical baskets = semicolon separated list of clinical baskets the gene name corresponds to

Parameters:
  • df (DataFrame) – pandas dataframe with ‘Gene names’ column

  • inplace (bool) – Whether to modify the DataFrame rather than creating a new one.

Returns:

annotated dataframe

Return type:

pd.DataFrame

Required columns:

Gene names

load_annotations()

Reads in excel file with basket-gene annotations.

Creates a dataframe basket_df with two columns:

  • Gene names contains a single gene name

  • Clinical baskets contains a semicolon-separated list of basket identifiers the gene is featured in

Return type:

None

Returns:

None