Skip to content

Commit

Permalink
removed redundant mean_ligand_expression
Browse files Browse the repository at this point in the history
Function definition appeared a second time. Likely arose from merging branches earlier.
  • Loading branch information
jmitchell81 committed Nov 10, 2023
1 parent c4f45d0 commit 0182947
Showing 1 changed file with 8 additions and 29 deletions.
37 changes: 8 additions & 29 deletions R/import_fxns.R
Original file line number Diff line number Diff line change
Expand Up @@ -655,40 +655,19 @@ add_rl_column <- function(map, map_ref, conv, new_name) {
#' @return A data frame of ligand expression targeting the specified receptor
#' @export
#'
mean_ligand_expression <-
function(x, ligands, cell_ident, cell_barcodes, destination){
# initiate data frame to store results
df <- NULL

for(feat in ligands){
# index of ligand row
lig_index <- grep(paste0("^", feat, "$"), rownames(x))
# column indecies of cells belonging to cell_ident
cell_index <- colnames(x) %in% cell_barcodes

cell_df <- data.frame(
origin = paste0(cell_ident, "_", feat),
destination = destination,
mean.expression = mean(x[lig_index, cell_index])
)

df <- rbind(df, cell_df)
}
return(df)
}

#' @export
#'
mean_ligand_expression <- function(x, ligands, cell_ident, cell_barcodes, destination) {
mean_ligand_expression <- function(x, ligands, cell_ident, cell_barcodes, destination){
# initiate data frame to store results
df <- NULL
for (feat in ligands) {
for(feat in ligands){
# index of ligand row
lig_index <- grep(paste0("^", feat, "$"), rownames(x))
# column indices of cells belonging to cell_ident
# column indecies of cells belonging to cell_ident
cell_index <- colnames(x) %in% cell_barcodes
cell_df <- data.frame(origin = paste0(cell_ident, "_", feat), destination = destination, mean.expression = mean(x[lig_index,
cell_index]))
cell_df <- data.frame(
origin = paste0(cell_ident, "_", feat),
destination = destination,
mean.expression = mean(x[lig_index, cell_index])
)
df <- rbind(df, cell_df)
}
return(df)
Expand Down

0 comments on commit 0182947

Please sign in to comment.