saeyslab / nichenetr

NicheNet: predict active ligand-target links between interacting cells
452 stars 113 forks source link

`make_line_plot` bugs #272

Closed csangara closed 1 month ago

csangara commented 1 month ago

Two bugs discovered:

  1. Extra line segments when rank(agnostic) == rank(focused)
    
    # Minimal reproducible code
    # Create dataframe of random ligand activities
    ligand_activities <- data.frame(test_ligand = paste0("ligand", 1:100),
                                rank = c(1, 2, 2, 3, 3, 6:100))

Get 20 random numbers

set.seed(0) potential_ligands <- c(paste0("ligand", sample(1:100, 20)))

nichenetr::make_line_plot(ligand_activities = ligand_activities, potential_ligands = potential_ligands)

![image](https://github.com/saeyslab/nichenetr/assets/17024850/d9c4813c-b74a-43e7-9e48-f359148485db)

2. Error when there are no ties
When ligand activities is instead defined as:

ligand_activities <- data.frame(test_ligand = paste0("ligand", 1:100), rank = 1:100)

The following error occurs:

Error in filter(): ℹ In argument: ystart < cutoff. Caused by error: ! object 'ystart' not found Run rlang::last_trace() to see where the error occurred.