Score2Prob.Rd
Converts a cell by cell type likelihood matrix to a probability matrix by setting negative values to zero and normalizing each row to sum to 1.
Score2Prob(PhiSc)
A numeric matrix of the same dimensions as the input, where:
All negative values are set to zero
Each row sums to 1 (forms a probability distribution)
Row and column names are preserved from the input
The function performs the following steps:
Sets all negative similarity values to zero
Calculates the sum of each row
Divides each element in a row by the row sum to create probabilities
Handles edge cases where rows sum to zero after removing negatives
For rows that contain all negative values (resulting in zero sums after transformation), the function will issue a warning and set those rows to all zeros. Alternative behavior could be implemented to assign uniform probabilities.