% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/liana_tensor.R
\name{preprocess_scores}
\alias{preprocess_scores}
\title{Helper function to deal with tensor sparsity and liana's scores as in Python}
\usage{
preprocess_scores(
  context_df_dict,
  score_col = "magnitude_rank",
  sender_col = "source",
  receiver_col = "target",
  ligand_col = "ligand.complex",
  receptor_col = "receptor.complex",
  outer_fraction = 0,
  invert = TRUE,
  invert_fun = function(x) 1 - x,
  non_negative = TRUE,
  non_negative_fill = 0,
  lr_sep = "^",
  verbose = TRUE
)
}
\arguments{
\item{context_df_dict}{Dictionary (named list) containing a dataframe for
each context. The dataframe must contain columns containing sender (source) cells,
receiver (target) cells, ligands, receptors, and communication scores, separately.
Keys are context names and values are dataframes. NULL by default.
If not NULL will be used instead of `sce@metadata$liana_res`.}

\item{score_col}{Name of the column containing the communication scores in
all context dataframes.}

\item{sender_col}{Name of the column containing the sender cells in all context
dataframes.}

\item{receiver_col}{Name of the column containing the receiver cells in all context
dataframes.}

\item{ligand_col}{Name of the column containing the ligands in all context
dataframes.}

\item{receptor_col}{Name of the column containing the receptors in all context
dataframes.}

\item{outer_fraction}{controls the elements to include in the union scenario of the `how` options.
Only elements that are present at least in this fraction of samples/contexts will be included.
When this value is 0, considers all elements across the samples. When this value is 1, it acts as using `how='inner'`}

\item{invert}{boolean wheter to invert the score (TRUE by defeault)}

\item{invert_fun}{function used to invert scores}

\item{non_negative}{whether to set negative scores to 0}

\item{non_negative_fill}{the value to be used to fill negative values}

\item{lr_sep}{ligand-receptor separator; `^` by default.}

\item{verbose}{verbosity logical}
}
\description{
Helper function to deal with tensor sparsity and liana's scores as in Python
}
