# A Neural Network Approach for the Analysis of Reproducible Ribo-Seq Profiles
## 3 Materials and Methods
### Ribosome Profiling Data Extraction
#### 3.1.3 Comparison of Digital Profiles  
The digitalized profiles can be compared to detect matches, i.e., nucleotides characterized by an identical label ( Figure 2). Calculating the relative number of matches (the ratio between the number of matches and the length of the ORF) yields the _matching score_ (\(s_{irk}\)). Intuitively, a matching score close to one could indicate a high degree of similarity between a pair of digitalized profiles, whereas a score around one-half could mean a very poor overlap because the observed matches are likely to have occurred by chance. Given each score has a certain probability of being obtained by chance, we decided to implement a statistical test able to assess the significance of the matching score [6].  
Figure 2: Pairwise comparison of two Ribo–seq profiles of the ispB gene. Two independent Ribo–seq profiles (left) are obtained by computing the coverage at each nucleotide position within the ORF. x-axis: position within the ORF (nucleotides); y-axis (top): relative coverage (number of mapping reads/total number of reads) mapping on the ORF. The Ribo–seq profiles are compared to the median coverage to produce the digitalized \(\pm 1\) profiles (right). The digitalized profiles can be easily compared to detect matches (e.g., green rectangle) and mismatches (e.g., red rectangle). The ratio between the number of matches and the total number of nucleotides in the ORF gives the matching score. A score equal to one means a perfect match between the two profiles, whereas a score equal to one-half means a poor matching [6].  
For any Ribo-seq profile involved in a pairwise comparison, a large number of randomized profiles is generated by re-distributing the reads in random positions on the reference ORF. The randomized profiles are, in turn, compared pairwise yielding a large number of random matching scores that build each null distribution. Reiterating this process, we generated \(10^{4}\) pairs of random Ribo-seq profiles and an equal number of digitalized random profiles that, compared pairwise, yielded \(10^{4}\) random matching scores. These scores are used to build an ORF-specific null distribution which allows us to estimate the probability of obtaining each similarity score just by chance.  
Given a pair of Ribo-seq profiles, the similarity score resulting from their comparison is tested for significance by comparing it to the corresponding ORF-specific null distribution. For each \(s_{i,k}\) and the corresponding null distribution, we computed a z-score \(z_{i,k}\), mapping each similarity score on a standard normal distribution.  
Subsequently, we computed the \(p\)-values \(p_{i,k}\), as the integral:  
\[p_{i,k}=\int_{z_{i,k}}^{+\infty}N_{\mathrm{S}}(z)dz\]  
where \(N_{\mathrm{S}}(z)\) is the standard normal distribution. Mapping the matching score on the null distribution will yield the \(p\)-value. The results of this process can be summarised into a matrix (called \(p\)_-value matrix_) containing all the computed \(p\)-values and composed by one column for each pairwise comparison and one row for each considered ORF (for a total of 3588 rows and 28 columns). For the sake of simplicity, Table 2 collects a small extract of such matrix. Each \(p_{i,k}\) quantifies the probability of obtaining a similarity score at least as extreme as the corresponding \(s_{i,k}\), given that the null hypothesis is true. In our context, the lower the \(p\)-value, the lower the probability that the similarity between the compared pairs of (digitalized) Ribo-seq profiles occurs by chance. If the \(p\)-value will result below a given threshold, the compared Ribo-seq profiles will exhibit a significant degree of similarity.