first check in of ploidy.pl plus some minor modifications to other scripts