From Project ROSALIND: Computing GC Content http://rosalind.info/problems/gc/ Version History 2020-04-13 — David M. Ng — Initial version.
This project started from a copy of project “FASTA Parser”. This provided not only the FASTA_Read custom block, but also variables needed by FASTA_Read and starter/sample code that calls FASTA_Read. See the “FASTA Parser” project for Instructions, and Notes and Credits. There are two main parts to the code. First, repeat for each sequence from the FASTA file and compute the CG content (basically, count the number of G and C bases in the sequence and divide by the total number of bases). The descriptions and corresponding CG content (as a percentage) are saved in parallel lists. In the second part of the code, search for the greatest GC content in the parallel lists. The code searches sequentially through the list. Two variables, maxValue and maxIndex, record the maximum value and corresponding index seen so far. These are initialized with the first entry in the lists: after we have seen one entry, that entry is is best. Every iteration of the loop, we check to see if the next entry is greater than what we have seen before and if so, the maxValue and maxIndex variables are updated.