sequence database population and algorithm partially ported to the mapper function