## 2 Materials and Methods
### Spectrum Graph  
Each mass-spectrum datum is a set of peaks (m/z, intensity). The spectrum is vectorized into a very large vector in DeepNovo. It also increases computational complexity and memory overhead to adapt to high-resolution data. Here, we refer to the previous method of constructing a spectrum graph. We describe the spectrum graph as an undirected graph, in contrast to the prior approach, and construct features for each node in the graph. The benefit of performing this step is that the weights of edges can be evaluated without a scoring function based on prior knowledge. The scoring function of the current predicted amino acid can be automatically learned by GCN model. Each spectrum has a different number of peaks. We fixed the number of peaks to 500 to ease the subsequent model training. Since the majority of peaks in the spectrum may be lower than 500, we utilized 0 to pad if a spectrum had fewer than 500 peaks. Finally, we denoted \(\mathrm{M}=(\mathrm{m}/\mathrm{z}_{1},\dots,\mathrm{m}/\mathrm{z}_{n})\) as the observed m/z vector and \(\mathrm{i}=(\mathrm{i}_{1},\dots,\mathrm{i}_{n})\) as intensity vector. Before constructing the graph, four virtual peaks needed to be added to the spectrum: proton mass, H2O mass, peptide mass, and the mass of the peptide loss H2O. The intensities of virtual peaks were set to the max of intensity vector. These peaks were not included in the original spectrum, but the determination of amino acids at both ends of the peptide sequence is crucial. The four virtual peaks were used as the starting node and end node of the N-terminal and C-terminal pathways. Here, we have:  
\[\mathrm{D}=\left|(\mathrm{|M}-\mathrm{M}^{\mathrm{T}}|)-\mathrm{M}_{\mathrm{aa }}\right| \tag{1}\]  
\[\mathrm{A}= \begin{cases}1,\mathrm{D}_{\mathrm{ij}}&\leq\delta\\ 0,\mathrm{D}_{\mathrm{ij}}&>\delta\end{cases}  \tag{2}\]  
where M\({}^{\mathrm{T}}\) represents the transposition of M and Maa is the matrix of masses of different amino acids. The absolute value of the difference between any two spectral peaks is first calculated, and the difference is then compared to the mass of amino acids. Each element of  
Figure 1: The process of mass-spectrum generation. matrix D represents the matching error of amino-acid mass and difference between peaks. Next, if the error is within a given \(\delta\) (by default \(\delta=0.02\)), the corresponding element of A is marked as 1; otherwise, it is marked as 0. In high-resolution tandem-mass-spectrum data, the fragment-ion error is generally not more than 0.02 Da, so we set \(\delta=0.02\) here. The A denotes the adjacency matrix of the spectrum graph. In addition, we construct features for each peak based on the currently predicted amino-acid sequence. We enumerate all possible amino acids and consider different fragment-ion types formed by different amino acids. Here, we consider 26 different amino acids and 12 different fragment-ion types. The 26 amino acids include 20 amino acids, 3 special symbols, and 3 variable modifications. The three special symbols are \"start\", \"end,\" and \"pad,\" and the three variable modifications are oxidation of M and deamidation of NQ. The 12 fragment-ion types include twelve types of ion: b, y, a, b\({}^{2+}\), y\({}^{2+}\), a\({}^{2+}\), b-H\({}_{2}\)O, y-H\({}_{2}\)O, a-H\({}_{2}\)O, b-NH\({}_{3}\), y-NH\({}_{3}\), and a-NH\({}_{3}\). Next, we obtain the theoretical fragment-ion m/z matrix of shape (26,12). We reshape the theoretical fragment ion m/z matrix to shape (1, 26 \(\times\) 12). Here we have:  
\[\mathrm{E=}\mathrm{M^{T}-M_{t}} \tag{3}\]  
\[\mathrm{E=exp\{-\left|\mathrm{E}\right|\,\times c}} \tag{4}\]  
\[\mathrm{X=E\,\oplus i} \tag{5}\]  
where M\({}_{t}\) represents the theoretical fragment-ion matrix. Firstly, we can compute the m/z difference matrix E, in which each element represents the difference between the m/z value for an observed peak and the theoretical m/z for a token and ion-type pair. Here, the exponential and absolute operations are all element-wise operations and set c = 100.