Recent works investigated the possibility to design solutions for pattern recognition problems by exploiting the huge amount of work done in bioinformatics. If the pattern recognition problem is cast in biological terms, then a huge range of algorithms, exploitable for classification, detection, visualization, etc. can be effectively borrowed. In this paper, we exploit biological sequence alignment tools to classify 2D shapes, tailoring the biological parameters of these tools to account for the different semantic of the 2D shape scenario. In particular, we propose a novel substitution matrix, which is the crucial parameter determining the sequence alignment solution. The new matrix, called S-BLOSUM, learns the rates of matches/mismatches in conserved portions of shapes belonging to the same category, and incorporates prior knowledge on the chosen representation for the 2D shape. On one hand, the experimental evaluation showed that the S-BLOSUM provides a significant improvement over the biological counterpart (BLOSUM); on the other hand, classification results prove that our approach is competitive with respect to the state of the art.