spac.phenotyping.apply_phenotypes(data_df, phenotypes_dic)[source]

Add binary columns to the DataFrame indicating if each cell matches a phenotype.

Parameters:
  • data_df (pandas.DataFrame) – The DataFrame to which binary phenotype columns will be added.

  • phenotypes_dic (dict) – A dictionary where the keys are phenotype names and the values are dictionaries mapping column names to values.

Returns:

A dictionary where the keys are phenotype names and the values are the counts of rows that match each phenotype.

Return type:

dict

Notes

The function creates binary columns in the DataFrame for each phenotype and counts the number of rows matching each phenotype.