For each evidence group (Experimental, Sequence based analysis, Phylogenetic analysis, and electronic and computational analysis), in each aspect (P, C or F) keep the most granular GO term. This can be done by excluding the parent term(s) of any of the GO terms, in an iterative process.
We firstly collect all terms and then, for each of them, we get the set of their parents (all the nodes above them in the ontology) and we remove these parents, if present, from the set of terms.
For each evidence group (Experimental, Sequence based analysis, Phylogenetic analysis, and electronic and computational analysis), in each aspect (P, C or F) keep the most granular GO term. This can be done by excluding the parent term(s) of any of the GO terms, in an iterative process.