Creates a heatmap from output of integrated_gradients function. The first row contains
the column-wise absolute sums of IG scores and the second row the sums. Rows 3 to 6 contain the IG scores for each
position and each nucleotide. The last row contains nucleotide information.
Arguments
- integrated_grads
- Matrix of integrated gradient scores (output of - integrated_gradientsfunction).
- input_seq
- Input sequence for model. Should be the same as - input_seqinput for corresponding- integrated_gradientscall that computed input for- integrated_gradsargument.
Examples
if (FALSE) { # reticulate::py_module_available("tensorflow") && requireNamespace("ComplexHeatmap", quietly = TRUE)
library(reticulate)
model <- create_model_lstm_cnn(layer_lstm = 8, layer_dense = 3, maxlen = 20, verbose = FALSE)
random_seq <- sample(0:3, 20, replace = TRUE)
input_seq <- array(keras::to_categorical(random_seq), dim = c(1, 20, 4))
ig <- integrated_gradients(
  input_seq = input_seq,
  target_class_idx = 3,
  model = model)
heatmaps_integrated_grad(integrated_grads = ig,
                         input_seq = input_seq)
 
}
