Skip to content

Issue: TFPerturbation failures and missing infrastructure requirements #20

Description

@rootze

Description

The TFPerturbation function currently fails or produces no output due to two distinct issues: missing default parameters in the function signature and a failure to handle missing graph infrastructure during the transition probability calculation.

Error 1: Undefined Objects in Signal Propagation
The function references several variables in ApplyPropagation that are not defined in the TFPerturbation signature, causing "object not found" errors. This prevents the function from completing the gene expression propagation step.

Missing Parameters:

    row_normalize = FALSE,       
    apply_ceiling = FALSE,       
    ceiling_multiplier = 1.0,    
    prune_network = FALSE,      
    prune_percentile = 0.95,     

Error 2: Transition Probability Calculation and Empty Result
Even when the expression matrix is successfully perturbed, the function fails to calculate or return the transition vectors (the "arrows" for plotting).

  • Matrix::Matrix Error (Missing Graph): The function fails at the transition probability step if the specified graph object is not found in the Seurat object.
    • Error: Error in Matrix::Matrix(cell_graph) : invalid 'data'
    • Cause: If graph='RNA_nn' is passed but FindNeighbors has not been run (or was run using a different reduction name), the function passes a NULL object to the Matrix constructor.
  • Missing Output: Because the PerturbationTransitions step fails silently or crashes, the final seurat_obj returned to the user does not contain the necessary metadata or tool slots required for functions like PlotTransitionVectors.

Add a check or a line in the tutorial to highlight the problem/error to ask users to verify the existence of the graph object

@rootze 's notes here:
After investigating the missing plotting output, it appears (maybe) that the lack of transition vectors in Error 2 Missing Output (maybe) is a downstream consequence of the missing parameters in Error 1 and a lack of input validation.

The "Empty Plot" Issue no Error : When row_normalize, apply_ceiling, and other propagation parameters are missing, the signal propagation step (ApplyPropagation) fails to generate a valid perturbed expression matrix. Consequently, PerturbationTransitions has no "delta" (change in expression) to project onto the cell-cell graph. This results in an empty or null transition slot, meaning no vectors are shown when calling plotting functions.

Diagnostic logic: To confirm this is the cause, @rootze can used ModulePerturbation and then PlotTransitionVectors and showed vectorfield without any problem.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinginvalidThis doesn't seem right

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions