Esempio n. 1
0
    def getPDB(self):
        """
        Connect to pdb.org and download PDB files using PDBID
        @type self: koala.PDBDownload.PDBDownload
        """
        try:

            pdb_org = "http://www.rcsb.org/pdb/files/"

            pdbs = []  # pdbs id
            i = 0
            pdbsid = self.opts.inputIDs.split('#')
            for pdbid in range(len(pdbsid)):
                if len(pdbsid[pdbid]) > 0:
                    pdbidn = pdbsid[pdbid].strip()
                    pdbs.append(pdbidn)
                    i = i + 1

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

            pdb_files = []
            for i, pdbid in enumerate(pdbs):
                url = "%s%s.pdb" % (pdb_org,  pdbid)
                open_url(url, path_output, "%s.pdb" % pdbid)
                pdb_files.append(os.path.join(path_output, "%s.pdb" % pdbid))

            send_multiple_outputs(
                    path_output,
                    pdb_files,
                    self.opts.galaxydir,
                    self.opts.outputID)

        except Exception, e:
            show_error_message(str(e))
Esempio n. 2
0
    def run_SplitPDB(self):
        """
        Get the PDB input files and run the splitting
        @type self: koala.SplitPDB.SplitPDB
        """
        try:
            self.path_runs.set_path_execute()
            self.path_runs.set_execution_directory()

            link_name = os.path.join(self.opts.outputdir, os.path.basename(self.opts.pdbName))
            if not os.path.exists(link_name):
                os.symlink(self.opts.inputPDB, link_name)
                os.system("cp %s %s" % (link_name, self.path_runs.get_path_execution()))

            pdbs = parse_pdb(
                    self.path_runs.get_path_execution(),
                    os.path.join(self.path_runs.get_path_execution(), self.opts.pdbName))

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

            send_multiple_outputs(
                    self.path_runs.get_path_execution(),
                    pdbs, self.opts.galaxydir,
                    self.opts.outputID)

            if self.opts.createCompressFile == "True":
                if compress_files(pdbs, self.path_runs.get_path_execution(), self.opts.toolname):
                    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(), '%s.zip' % self.opts.toolname))

        except Exception, e:
            show_error_message(str(e))
Esempio n. 3
0
            path_output, file_output = os.path.split(self.opts.output)

            pdbs_accepted = list_directory(self.path_runs.get_path_execution(), "*.pdb")

            if compress_files(pdbs_accepted, self.path_runs.get_path_execution(), "PDBsChecked"):
                send_output_results(
                        path_output,
                        file_output,
                        os.path.join(self.path_runs.get_path_execution(), 'PDBsChecked.zip'))

            if(os.path.exists(
                    os.path.join(self.path_runs.get_path_execution(), self.check_pdb_log))):
                send_multiple_outputs(
                        path_output,
                        [os.path.join(self.path_runs.get_path_execution(), self.check_pdb_log)],
                        self.opts.galaxydir,
                        self.opts.outputID)

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

if __name__ == '__main__':
    op = optparse.OptionParser()
    op.add_option('-i', '--inputPDBs', default=None)
    op.add_option('-f', '--forceField', default='amber99sb-ildn')
    op.add_option('-n', '--inputnames', default=None)
    op.add_option('-o', '--output', default=None)
    op.add_option('-d', '--outputdir', default=None)
    op.add_option('-r', '--galaxyroot', default=None)
    op.add_option('-s', '--compressedFile', default=None)