<jupyter_start><jupyter_text>Saliency logos Saliency logos are used to represent important nucleotides as predicted by deep neural networks. Logomaker uses the method [Saliency_to_matrix](https://logomaker.readthedocs.io/en/latest/matrix.htmlsaliency-to-matrix) to represent saliency logos. The inputs to this method are a sequence string, and an array of numerical values corresponding to the saliency of the characters in the sequence string. The output is a dataframe that can be passed in to the [Logo](https://logomaker.readthedocs.io/en/latest/Logo.html) class to see the logo.We begin by importing some useful packages<jupyter_code>import numpy as np
import pandas as pd

import matplotlib.pyplot as plt
%matplotlib inline 
plt.ion()

import logomaker as lm<jupyter_output><empty_output><jupyter_text>SpliceAI saliency logo Here we show to draw a saliency logo representing the importance of nucleotides in the vicinity of *U2SUR* exon 9, as predicted by a deep neural network model of splice site selection. (This logo was adapted with permission from the authors of ([1](Jaganathan))).<jupyter_code># load saliency data
with lm.open_example_datafile('nn_saliency_values.txt') as f:
    saliency_data_df = pd.read_csv(f, comment='#', sep='\t')
    
# preview dataframe
saliency_data_df.head()<jupyter_output>Description of example matrix "nn_saliency_values.txt":
# 
# Saliency values illustrated in Figure 1F.
# Data are from Figure 1D of Janganathan et al. (2019),
# and were kindly provided by <NAME> and <NAME>.
# 
# References:
# 
# J<NAME> et al. (2019) Predicting Splicing from Primary Sequence with
# Deep Learning. Cell. 176(3):535–548.e24.
#<jupyter_text>We can extract the sequences and values from this dataframe and enter them into the Logo class to see the logo.<jupyter_code># create saliency matrix
saliency_mat_df = lm.saliency_to_matrix(seq=saliency_data_df['character'], 
                                               values=saliency_data_df['value'])
# preview saliency dataframe.
saliency_mat_df.head()
# show logo
lm.Logo(saliency_mat_df, figsize=(18,3))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08037825059101655, 'fraction_numerical': 0.013238770685579196, 'mean_word_length': 5.011363636363637, 'pattern_counts': {'":': 1, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '285023', 'license': 'MIT', 'n_tokens_mistral': 697, 'n_tokens_neox': 634, 'n_words': 230, 'path': 'logomaker/tutorials/4_saliency_logos.ipynb', 'repo_name': 'BlingArida/logomaker', 'size': '2135'}