The GEMTools is a powerful C library that allows you to postprocess files in GEM alignment format. Bindings exist to call the library from higher-level languages (currently Python). More functionality will be progressively added.
At the moment, the library is in its final stages of development. The impatient can download a snapshot.