Skip to content

Commit

Permalink
simplified code in application_prediction.get_weighted_ligand_target_…
Browse files Browse the repository at this point in the history
…links
  • Loading branch information
vmedaert committed Feb 18, 2025
1 parent f9906f3 commit cd20539
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions R/application_prediction.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,8 @@ get_weighted_ligand_target_links = function(ligand, geneset,ligand_target_matrix
targets = intersect(ligand_target_matrix[,ligand] %>% .[. >= top_n_score ] %>% names(),geneset)
if (length(targets) == 0){
ligand_target_weighted_df = tibble(ligand = ligand, target = NA, weight = NA)
} else if (length(targets) == 1) {
ligand_target_weighted_df = tibble(ligand = ligand, target = targets, weight = ligand_target_matrix[targets,ligand])
} else {
ligand_target_weighted_df = tibble(ligand = ligand, target = names(ligand_target_matrix[targets,ligand])) %>% inner_join(tibble(target = names(ligand_target_matrix[targets,ligand]), weight = ligand_target_matrix[targets,ligand]), by = "target")
ligand_target_weighted_df = tibble(ligand = ligand, target = targets, weight = ligand_target_matrix[targets,ligand])
}
return(ligand_target_weighted_df)
}
Expand Down

0 comments on commit cd20539

Please sign in to comment.