Motivation: Several functional gene annotation databases have been developed in the recent years, and are widely used to infer the biological function of gene sets, by scrutinizing the attributes that appear over- and under-represented. However, this strategy is not directly applicable to the study of noncoding DNA, as the noncoding sequence span varies greatly among different gene loci in the human genome and longer loci have a higher likelihood of being selected purely by chance. Therefore, conclusions involving the function of noncoding elements that are drawn based on the annotation of neighboring genes are often biased. We assessed the systematic bias in several particular Gene Ontology categories using the standard hypergeometric test, by randomly sampling noncoding elements from the human genome and inferring their function based on the functional annotation of the closest genes. While no category is expected to occur significantly over- or under-represented for a random selection of elements, categories such as "cell adhesion", "nervous system development", and "transcription factor activities" appeared to be systematically over-represented, while others such as "olfactory receptor activity" - under-represented. Results: Our results suggest that functional inference for noncoding elements using gene annotation databases requires a special correction. We introduce a set of correction coefficients for the probabilities of the Gene Ontology categories that accounts for the variability in the length of the noncoding DNA across different loci and effectively eliminates the ascertainment bias from the functional characterization of noncoding elements. Our approach can be easily generalized to any other gene annotation database. Contact: ovcharei@ncbi.nlm.nih.gov 10.1093/bioinformatics/btp043