In recent years Graphic Processing Units (GPUs) have seen widespread adoption in many scientific fields, from Machine Learning (ML) to Genomics. Their use makes it possible to achieve significant speedups and improvements in power efficiency over computationally intensive algorithms compared to General Purpose Central Processing Units (CPUs). However, algorithms require specific knowledge of the GPU architecture and expertise to achieve significant results. In this work, we describe a methodology for automatic GPU kernel optimization. Our methodology exploits the Berkeley Roofline Model to perform a performance analysis of the algorithm considered and aims to increase the accessibility of GPU programming automatizing the optimization process of the kernel. We provide an in-depth analysis of this methodology, an overview on the state of the art, and a description of a tool we developed that automatically applies our methodology to obtain a highly optimized GPU version of two of the most popular algorithms used in computational biology, the X-drop and Smith-Waterman algorithms. The Smith-Waterman algorithm is one of the most used algorithms in genomics pipelines. The algorithm finds the optimal local alignment between two genomic sequences, at the cost of being particularly compute-intensive. The popular X-drop algorithm reduces the time required by the alignment by searching only for high-quality alignments. The algorithms accelerated using our methodology achieve more than 6x and 3x speed-up, for the X-drop and Smith-Waterman algorithms respectively, with respect to the state of the art implementation of these algorithms.