countMatchingAnnotations function

Gets the number of annotations matching a particular pattern