def write_manifest(self, module_directory=""):
        """
        Write a GenePattern manifest file for the module
        :param module_directory: optionally write to subdirectory
        :return:
        """
        # First validate the spec
        self.validate()

        # Open the manifest file for writing
        manifest_file = open(os.path.join(module_directory, "manifest"), "w")

        # Write the header
        manifest_file.write("# " + self.name + "\n")
        manifest_file.write("# " + str(datetime.now()) + "\n")
        manifest_file.write("# Generated by Python Module Creator v" + __version__ + "\n")

        # Write initial attributes
        manifest_file.write("JVMLevel=\n")
        manifest_file.write("LSID=" + self.manifest_escape(self.lsid) + ':' + str(self.version) + "\n")
        manifest_file.write("author=" + self._author_line() + "\n")
        manifest_file.write("categories=" + ';'.join(self.categories) + "\n")
        manifest_file.write("commandLine=" + self.command_line + "\n")
        manifest_file.write("cpuType=" + str(self.cpu.value) + "\n")
        manifest_file.write("description=" + self.description + "\n")
        manifest_file.write("fileFormat=" + ';'.join(self.file_format) + "\n")
        manifest_file.write("language=" + self.language + "\n")
        manifest_file.write("license=" + self.license + "\n")
        manifest_file.write("name=" + self.name + "\n")
        manifest_file.write("os=" + str(self.os.value) + "\n")

        # Write parameter attributes
        for index, param in enumerate(self.parameters):
            manifest_file.write(param.manifest_repr(index+1))

        # Write footer attributes
        manifest_file.write("privacy=" + str(self.privacy.value) + "\n")
        manifest_file.write("publicationDate=" + self._publication_date() + "\n")
        manifest_file.write("quality=" + str(self.quality.value) + "\n")
        manifest_file.write("taskDoc=" + self.documentation + "\n")
        manifest_file.write("taskType=" + self._task_type() + "\n")
        manifest_file.write("userid=" + self.user + "\n")
        manifest_file.write("version=" + self.version_comment + "\n")

        # Close the file
        manifest_file.close()