Makes the script file to be run by yap.

def __script(self, mode, filestem):
        """
        Makes the script file to be run by yap.
        """
        scriptPath = '%s/%s' % (self.tmpdir, Aleph.SCRIPT)
        script = open(scriptPath, 'w')

        # Permit the owner to execute and read this script
        os.chmod(scriptPath, S_IREAD | S_IEXEC)

        cat = lambda x: script.write(x + '\n')
        cat(":- initialization(run_aleph).")
        cat("run_aleph :- ")
        cat("consult(aleph),")
        cat("read_all('%s')," % filestem)
        # Cat all the non-default settings
        for setting, value in self.settings.items():
            cat("set(%s, %s)," % (setting, str(value)))
        cat("%s," % mode)

        eof = ',' if self.postScript else '.'
        if mode == 'induce_features':
            cat("consult(features),")
            features_fn = filestem + Aleph.FEATURES_SUFFIX
            dataset_fn = filestem + Aleph.PROP_DATASET_SUFFIX
            cat('save_features(%s),' % features_fn)
            cat('save_dataset(%s)%s' % (dataset_fn, eof))
        else:
            rules_fn = filestem + Aleph.RULES_SUFFIX
            cat("write_rules('%s')%s" % (rules_fn, eof))
        if self.postScript:
            cat(self.postGoal + ".")
            cat(self.postScript)
        script.close()