Beispiel #1
0
    def run_Random(self):
        """
        Create the 2PG Random configuration file and begin the execution.

        @type self: koala.Random2PG.Random2PG
        """

        try:
            self.path_runs.set_path_execute()
            if self.opts.inputEmail:
                email = validate_email(self.opts.inputEmail)
                self.path_runs.set_execution_directory(email)
            else:
                self.path_runs.set_execution_directory()

            self.sequence = create_local_fasta_file(
                    self.path_runs.get_path_execution(),
                    self.opts.fromFasta,
                    self.opts.inputFasta,
                    self.opts.toolname,
                    self.framework)

            SizePopulation = create_local_pop_file(
                    self.path_runs.get_path_execution(),
                    self.opts.inputPop,
                    self.framework)

            if SizePopulation > 1:
                show_error_message(
                    "Error: The population file must contain only one model")

            copy_necessary_files(
                self.path_runs.get_path_execute(),
                self.path_runs.get_path_execution(),
                self.framework.get_framework())

            self.framework.set_parameter(
                'rotamer_library', self.opts.rotamerLibrary)
            self.framework.set_parameter(
                'StepNumber', self.opts.stepNumber)
            self.framework.set_parameter(
                'How_Many_Rotation', self.opts.howManyRotation)
            self.framework.set_parameter(
                'force_field', self.opts.forceField)
            self.framework.set_parameter(
                    'SequenceAminoAcidsPathFileName',
                    self.path_runs.get_path_execution() + 'fasta.txt')
            self.framework.set_parameter(
                'Local_Execute', self.path_runs.get_path_execution())
            self.framework.set_parameter(
                    'Path_Gromacs_Programs',
                    get_path_gromacs())
            self.framework.set_parameter(
                'NativeProtein', '%s1VII.pdb' % self.path_runs.get_path_execution())
            self.framework.set_parameter(
                    'Database',
                    '%s/Database/' %
                    get_path_algorithms('2pg_build_conformation'))

            create_configuration_file(
                self.path_runs.get_path_execution(), self.framework)

            self.framework.set_command(
                self.path_runs.get_path_execution(),
                'protpred-Gromacs-Random_Algorithm')

            config = 'configuration.conf'

            cl = [self.framework.get_command(), config, '&']

            retProcess = subprocess.Popen(
                cl, 0, stdout=None,  stderr=subprocess.STDOUT, shell=False)
            retCode = retProcess.wait()
            if(retCode != 0):
                show_error_message(
                    "The 2PG framework finished wrong.\nContact the system administrator.")

            parse_pdb(
                    self.path_runs.get_path_execution(),
                    'random_algorithm_solutions.pdb',
                    20,
                    'randomSolution')

            if(self.opts.runMinimization == 'true'):
                self.do_minimization("randomSolution")

            pdbs = list_directory(
                self.path_runs.get_path_execution(), 'randomSolution-M*.pdb')

            build_images(pdbs, self.path_runs.get_path_execution())

            path_output, file_output = os.path.split(self.opts.filehtml)

            name, ext = os.path.splitext(self.opts.filehtml)

            htmldir = os.path.join(path_output, '%s_files' % name)

            if not os.path.exists(htmldir):
                os.makedirs(htmldir)

            self.opts.htmlfiledir = htmldir

            result, filesHtml = get_result_files(
                    self.path_runs.get_path_execution(),
                    self.opts.toolname,
                    'randomSolution-M')

            send_output_files_html(self.opts.htmlfiledir, filesHtml)
            send_output_files_html(self.opts.htmlfiledir, [result])

            if self.opts.createCompressFile == "True":
                if compress_files(pdbs, self.path_runs.get_path_execution(), "2PGRandom"):
                    path_output, file_output = os.path.split(self.opts.outputZip)
                    send_output_results(
                            path_output,
                            file_output,
                            os.path.join(self.path_runs.get_path_execution(), '2PGRandom.zip'))

            self.makeHtml()

            if(self.opts.useJmol in ('True', 'true')):
                self.makeHtmlWithJMol(pdbs[0])

            if(self.opts.inputEmail):
                send_email(
                        '*****@*****.**',
                        email,
                        '%s Execution on Galaxy - Cloud USP' % self.opts.toolname,
                        get_message_email(self.opts.toolname),
                        [],
                        'smtp.gmail.com')

        except Exception, e:
            show_error_message(str(e))
    def main(self):
        """
        Create the ProtPred-EDA configuration file and begin the execution.

        @type self: koala.ProtPredEDA.ProtPredEDA
        """
        try:
            self.path_runs.set_path_execute()
            if self.opts.inputEmail:
                email = validate_email(self.opts.inputEmail)
                self.path_runs.set_execution_directory(email)
            else:
                self.path_runs.set_execution_directory()

            self.sequence = create_local_fasta_file(
                    self.path_runs.get_path_execution(),
                    self.opts.fromFasta,
                    self.opts.SequenceFile,
                    self.opts.toolname,
                    self.framework)

            copy_necessary_files(
                self.path_runs.get_path_execute(),
                self.path_runs.get_path_execution(),
                self.framework.get_framework())

            # Config
            self.framework.set_parameter('OptimMethod', 'rboa')
            self.framework.set_parameter('MaxEval', self.opts.MaxEval)
            self.framework.set_parameter('Threshold', self.opts.Threshold)

            # FitnessPSP
            self.framework.set_parameter('VanderWaals', self.opts.VanderWaals)
            # ClassColection.setParameter('SASA', self.opts.SASA)
            self.framework.set_parameter('Coulomb', self.opts.Coulomb)
            self.framework.set_parameter('Solvatation', self.opts.Solvatation)
            self.framework.set_parameter('HydrogenBond', self.opts.HydrogenBond)
            self.framework.set_parameter('Torsion', self.opts.Torsion)
            self.framework.set_parameter('UseAngleDB', self.opts.UseAngleDB)
            self.framework.set_parameter('AminoAcidL', self.opts.AminoAcidL)

            # rboa
            self.framework.set_parameter('PopSize', self.opts.PopSize)
            self.framework.set_parameter('SelSize', self.opts.SelSize)
            self.framework.set_parameter('MaxParents', self.opts.MaxParents)
            self.framework.set_parameter('MixtureComponents', self.opts.MixtureComponents)

            create_configuration_file(
                self.path_runs.get_path_execution(), self.framework)

            self.framework.set_command(
                self.path_runs.get_path_execution(),
                'protpred')

            config = 'input.ini'

            cl = [self.framework.get_command(), config, '&']

            retProcess = subprocess.Popen(
                cl, 0, stdout=None,  stderr=None, shell=False)
            retCode = retProcess.wait()
            if(retCode != 0):
                show_error_message(
                    "The ProtPred-EDA framework finished wrong.\nContact the system administrator.")

            copy_files_to_execute_folder(
                self.path_runs.get_path_execution(),
                'ProtPredEDA_rBOA')

            if(self.opts.runMinimization == 'true'):
                self.do_minimization("ProtPredEDA_rBOA")

            pdbs = sorted(list_directory(self.path_runs.get_path_execution(), '*.pdb'))

            build_images(pdbs, self.path_runs.get_path_execution())

            path_output, file_output = os.path.split(self.opts.filehtml)

            name, ext = os.path.splitext(self.opts.filehtml)

            htmldir = os.path.join(path_output, '%s_files' % name)

            if not os.path.exists(htmldir):
                os.makedirs(htmldir)

            self.opts.htmlfiledir = htmldir

            result, filesHtml = get_result_files(
                self.path_runs.get_path_execution(),
                self.opts.toolname)

            send_output_results(path_output, file_output, result)

            send_output_files_html(self.opts.htmlfiledir, filesHtml)
            send_output_files_html(self.opts.htmlfiledir, [result])

            if self.opts.createCompressFile == "True":
                if compress_files(pdbs, self.path_runs.get_path_execution(), "ProtPredEDA-rBOA"):
                    path_output, file_output = os.path.split(self.opts.outputZip)
                    send_output_results(
                            path_output,
                            file_output,
                            os.path.join(
                                self.path_runs.get_path_execution(), 'ProtPredEDA-rBOA.zip'))

            self.makeHtml()

            if(self.opts.useJmol in ('True', 'true')):
                self.makeHtmlWithJMol(pdbs[0])

            if(self.opts.inputEmail):
                send_email(
                        '*****@*****.**',
                        email,
                        '%s Execution on Galaxy - Cloud USP' % self.opts.toolname,
                        get_message_email(self.opts.toolname),
                        [],
                        'smtp.gmail.com')

        except Exception, e:
            show_error_message(str(e))
Beispiel #3
0
    def run_NSGAII(self):
        """
        Create the 2PG NSGA-II configuration file and begin the execution.

        @type self: koala.NSGAII2PG.NSGAII2PG
        """
        try:
            self.path_runs.set_path_execute()
            if self.opts.inputEmail:
                email = validate_email(self.opts.inputEmail)
                self.path_runs.set_execution_directory(email)
            else:
                self.path_runs.set_execution_directory()

            self.sequence = create_local_fasta_file(
                self.path_runs.get_path_execution(),
                self.opts.fromFasta,
                self.opts.inputFasta,
                self.opts.toolname,
                self.framework,
            )

            SizePopulation = create_local_pop_file(
                self.path_runs.get_path_execution(), self.opts.inputPop, self.framework
            )

            copy_necessary_files(
                self.path_runs.get_path_execute(), self.path_runs.get_path_execution(), self.framework.get_framework()
            )

            self.framework.set_parameter("NumberGeration", self.opts.numberGeration)
            self.framework.set_parameter("SizePopulation", SizePopulation)
            self.framework.set_parameter(
                "SequenceAminoAcidsPathFileName", self.path_runs.get_path_execution() + "fasta.txt"
            )
            self.framework.set_parameter("How_Many_Rotation", self.opts.howManyRotation)
            self.framework.set_parameter("rotamer_library", self.opts.rotamerLibrary)
            self.framework.set_parameter("Local_Execute", self.path_runs.get_path_execution())
            self.framework.set_parameter("Path_Gromacs_Programs", get_path_gromacs())
            self.framework.set_parameter("NativeProtein", "%s1VII.pdb" % self.path_runs.get_path_execution())
            self.framework.set_parameter("Database", "%sDatabase/" % get_path_algorithms("2pg_build_conformation"))

            NumberObjective, Fitness_Energy = format_fitness(self.opts.inputFitness, self.opts.toolname)

            self.framework.set_parameter("NumberObjective", NumberObjective)
            self.framework.set_parameter("Fitness_Energy", Fitness_Energy)

            create_configuration_file(self.path_runs.get_path_execution(), self.framework)

            self.framework.set_command(self.path_runs.get_path_execution(), "protpred-Gromacs-NSGA2")

            config = "configuration.conf"

            cl = [self.framework.get_command(), config, "&"]

            retProcess = subprocess.Popen(cl, 0, stdout=None, stderr=subprocess.STDOUT, shell=False)
            retCode = retProcess.wait()
            if retCode != 0:
                show_error_message("The 2PG framework finished wrong.\nContact the system administrator.")

            parse_pdb(
                self.path_runs.get_path_execution(),
                "pop_NON_DOMINATED_%s.pdb" % self.opts.numberGeration,
                20,
                "NSGAIISolutions",
            )

            if self.opts.runMinimization == "true":
                self.do_minimization("NSGAIISolutions")

            pdbs = list_directory(self.path_runs.get_path_execution(), "NSGAIISolutions-M*.pdb")

            build_images(pdbs, self.path_runs.get_path_execution())

            path_output, file_output = os.path.split(self.opts.filehtml)

            name, ext = os.path.splitext(self.opts.filehtml)

            htmldir = os.path.join(path_output, "%s_files" % name)

            if not os.path.exists(htmldir):
                os.makedirs(htmldir)

            self.opts.htmlfiledir = htmldir

            result, filesHtml = get_result_files(
                self.path_runs.get_path_execution(), self.opts.toolname, "NSGAIISolutions-M"
            )

            send_output_results(path_output, file_output, result)

            send_output_files_html(self.opts.htmlfiledir, filesHtml)
            send_output_files_html(self.opts.htmlfiledir, [result])

            if self.opts.createCompressFile == "True":
                if compress_files(pdbs, self.path_runs.get_path_execution(), "2PGNSGAII"):
                    path_output, file_output = os.path.split(self.opts.outputZip)
                    send_output_results(
                        path_output, file_output, os.path.join(self.path_runs.get_path_execution(), "2PGNSGAII.zip")
                    )

            self.makeHtml()

            if self.opts.useJmol in ("True", "true"):
                self.makeHtmlWithJMol(pdbs[0])

            if self.opts.inputEmail:
                send_email(
                    "*****@*****.**",
                    email,
                    "%s Execution on Galaxy - Cloud USP" % self.opts.toolname,
                    get_message_email(self.opts.toolname),
                    [],
                    "smtp.gmail.com",
                )

        except Exception, e:
            show_error_message(str(e))
Beispiel #4
0
    def main(self):
        """
        Create the MEAMT Build Population configuration file and begin
        the execution to create a initial population.

        @type self: koala.BuildPopulationMEAMT.BuildPopulationMEAMT
        """
        try:
            self.path_runs.set_path_execute()
            self.path_runs.set_execution_directory()

            print 'create dirs'

            self.sequence = create_local_fasta_file(
                    self.path_runs.get_path_execution(),
                    self.opts.fromFasta,
                    self.opts.inputFasta,
                    self.opts.toolname,
                    self.framework)

            print 'create fasta'

            copy_necessary_files(
                self.path_runs.get_path_execute(),
                self.path_runs.get_path_execution(),
                self.framework.get_framework())

            print 'copy files'

            self.framework.set_command(
                self.path_runs.get_path_execution(),
                'aemt-pop-up2')

            print 'set command'

            size = int(self.opts.sizePopulation) / 15

            cl = [
                self.framework.get_command(),
                str(0),
                self.opts.sizePopulation,
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(0),
                str(0),
                self.opts.VanderWaalsWeight,
                self.opts.ChargeWeight,
                str(0),
                str(0),
                str(0),
                str(0),
                str(0),
                self.opts.SolvWeight,
                self.opts.HbondWeight,
                os.path.join(self.path_runs.get_path_execution(), "fasta.txt"),
                os.path.join(self.path_runs.get_path_execution(), "result.txt"),
                os.path.join(self.path_runs.get_path_execution(), "pop_meamt.txt"),
                os.path.join(self.path_runs.get_path_execution(), "protein.pdb"),
                os.path.join(self.path_runs.get_path_execution(), "saida1.txt"),
                os.path.join(self.path_runs.get_path_execution(), "angles.txt"),
                str(0),
                os.path.join(self.path_runs.get_path_execution(), "meat.txt"),
                '&']

            print cl

            retProcess = subprocess.Popen(cl, 0, None, None, None, False)
            retProcess.wait()

            path_output, file_output = os.path.split(self.opts.output)

            result, html = get_result_files(
                self.path_runs.get_path_execution(), self.opts.toolname)

            send_output_results(path_output, file_output, result)

        except Exception, e:
            show_error_message(str(e))
    def run_Build_Conformation(self):
        """
        Create the 2PG Build Conformation configuration file and begin
        the execution to create a initial population.

        @type self: koala.BuildConformation2PG.BuildConformation2PG
        """
        try:
            self.path_runs.set_path_execute()
            self.path_runs.set_execution_directory()

            self.sequence = create_local_fasta_file(
                self.path_runs.get_path_execution(),
                self.opts.fromFasta,
                self.opts.inputFasta,
                self.opts.toolname,
                self.framework,
            )

            copy_necessary_files(
                self.path_runs.get_path_execute(), self.path_runs.get_path_execution(), self.framework.get_framework()
            )

            self.framework.set_parameter("gromacs_energy_min", self.opts.gromacsEnergyMin)
            self.framework.set_parameter("SizePopulation", self.opts.sizePopulation)
            self.framework.set_parameter("force_field", self.opts.forceField)
            self.framework.set_parameter("rotamer_library", self.opts.rotamerLibrary)

            if self.opts.forceField == "amber99sb-ildn":
                self.framework.set_parameter("c_terminal_charge", self.opts.cTerminal)
                self.framework.set_parameter("n_terminal_charge", self.opts.nTerminal)

            self.framework.set_parameter(
                "SequenceAminoAcidsPathFileName", self.path_runs.get_path_execution() + "fasta.txt"
            )
            self.framework.set_parameter("Local_Execute", self.path_runs.get_path_execution())
            self.framework.set_parameter("Path_Gromacs_Programs", get_path_gromacs())
            self.framework.set_parameter("NativeProtein", "%s1VII.pdb" % self.path_runs.get_path_execution())
            self.framework.set_parameter("Database", "%sDatabase/" % get_path_algorithms("2pg_build_conformation"))

            create_configuration_file(self.path_runs.get_path_execution(), self.framework)

            self.framework.set_command(self.path_runs.get_path_execution(), "protpred-Gromacs_pop_initial")

            config = "configuration.conf"

            cl = [self.framework.get_command(), config, "&"]

            retProcess = subprocess.Popen(cl, 0, stdout=None, stderr=subprocess.STDOUT, shell=False)
            retCode = retProcess.wait()
            if retCode != 0:
                show_error_message("The 2PG framework finished wrong.\nContact the system administrator.")

            path_output, file_output = os.path.split(self.opts.output)

            result, html = get_result_files(self.path_runs.get_path_execution(), self.opts.toolname)

            send_output_results(path_output, file_output, result)

        except Exception, e:
            show_error_message(str(e))
Beispiel #6
0
    def main(self):
        """
        Create the MEAMT configuration file and begin
        the execution to create a initial population.

        @type self: koala.MEAMT.MEAMT
        """
        try:
            self.path_runs.set_path_execute()
            if(self.opts.inputEmail):
                email = validate_email(self.opts.inputEmail)
                self.path_runs.set_execution_directory(email)
            else:
                self.path_runs.set_execution_directory()

            self.sequence = create_local_fasta_file(
                    self.path_runs.get_path_execution(),
                    self.opts.fromFasta,
                    self.opts.inputFasta,
                    self.opts.toolname,
                    self.framework)

            SizePopulation = create_local_pop_file(
                    self.path_runs.get_path_execution(),
                    self.opts.inputPop,
                    self.framework)

            copy_necessary_files(
                self.path_runs.get_path_execute(),
                self.path_runs.get_path_execution(),
                self.framework.get_framework())

            self.framework.set_command(
                self.path_runs.get_path_execution(),
                'aemt-mo-up2')

            size = int(SizePopulation) / 15

            cl = [
                self.framework.get_command(),
                self.opts.numberGeneration,
                str(SizePopulation),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(size),
                str(0),
                str(0),
                self.opts.VanderWaalsWeight,
                self.opts.ChargeWeight,
                str(0),
                str(0),
                str(0),
                str(0),
                str(0),
                self.opts.SolvWeight,
                self.opts.HbondWeight,
                os.path.join(self.path_runs.get_path_execution(), "fasta.txt"),
                os.path.join(self.path_runs.get_path_execution(), "result.txt"),
                os.path.join(self.path_runs.get_path_execution(), "pop_meamt.txt"),
                os.path.join(self.path_runs.get_path_execution(), "MEAMT-M1.pdb"),
                os.path.join(self.path_runs.get_path_execution(), "saida1.txt"),
                os.path.join(self.path_runs.get_path_execution(), "angles.txt"),
                str(0),
                os.path.join(self.path_runs.get_path_execution(), "meat.txt"),
                '&']

            retProcess = subprocess.Popen(
                cl, 0, stdout=None,  stderr=subprocess.STDOUT, shell=False)
            retCode = retProcess.wait()
            if(retCode != 0):
                show_error_message(
                    "The MEAMT framework finished wrong.\nContact the system administrator.")

            if(self.opts.runMinimization == 'true'):
                self.do_minimization()

            pdbs = list_directory(self.path_runs.get_path_execution(), '*.pdb')

            build_images(pdbs, self.path_runs.get_path_execution())

            path_output, file_output = os.path.split(self.opts.filehtml)

            name, ext = os.path.splitext(self.opts.filehtml)

            htmldir = os.path.join(path_output, '%s_files' % name)

            if not os.path.exists(htmldir):
                os.makedirs(htmldir)

            self.opts.htmlfiledir = htmldir

            result, filesHtml = get_result_files(
                    self.path_runs.get_path_execution(),
                    self.opts.toolname)

            send_output_files_html(self.opts.htmlfiledir, filesHtml)
            send_output_files_html(self.opts.htmlfiledir, [result])

            if self.opts.createCompressFile == "True":
                if compress_files(pdbs, self.path_runs.get_path_execution(), "MEAMT"):
                    path_output, file_output = os.path.split(self.opts.outputZip)
                    send_output_results(
                            path_output,
                            file_output,
                            os.path.join(self.path_runs.get_path_execution(), 'MEAMT.zip'))

            self.makeHtml()

            if(self.opts.useJmol == 'true'):
                self.makeHtmlWithJMol(pdbs[0])

            if(self.opts.inputEmail):
                send_email(
                        '*****@*****.**',
                        email,
                        '%s Execution on Galaxy - Cloud USP' % self.opts.toolname,
                        get_message_email(self.opts.toolname),
                        [],
                        'smtp.gmail.com')

        except Exception, e:
            show_error_message(str(e))