optimization procedure

handles gene re-indexing and trimming