Exemplo n.º 1
0
    def exportAtomStructStep(self):
        exportAtomStruct = self.exportAtomStruct.get()
        originStructPath = exportAtomStruct.getFileName()
        dirName = self.filesPath.get()
        destinyStructPath = os.path.join(dirName, self.COORDINATEFILENAME)
        destinySympleStructPath = os.path.join(dirName, self.SYMPLIFIED_STRUCT)

        # save input atom struct with no change
        baseName = os.path.basename(originStructPath)
        localPath = os.path.abspath(os.path.join(dirName, baseName))
        copyFile(originStructPath, localPath)

        # call biopython to simplify atom struct and save it
        aSH = AtomicStructHandler()
        aSH.read(originStructPath)
        aSH.write(destinySympleStructPath)

        # if pdb convert to mmcif calling maxit twice
        if originStructPath.endswith(".pdb"):
            # convert pdb to cif using maxit program
            log = self._log
            fromPDBToCIF(originStructPath, destinyStructPath, log)
            try:
                # convert cif to mmCIF by using maxit program
                fromCIFTommCIF(destinyStructPath, destinyStructPath, log)
            except Exception as e:
                pass
        # if cif convert to mmcif using maxit
        elif originStructPath.endswith(".cif"):
            # convert cif to mmCIF by using maxit program
            log = self._log
            try:
                fromCIFTommCIF(originStructPath, destinyStructPath, log)
            except Exception as e:
                pass
 def _getDockInMapOutput(self):
     outAtomStructName = os.getcwd() + "/" +\
                         self._getExtraPath("placed_model.pdb")
     # convert cif to mmcif by using maxit program
     # to get the right number and name of chains
     log = self._log
     self.outAtomStructName = outAtomStructName.replace("pdb", "cif")
     fromPDBToCIF(outAtomStructName, self.outAtomStructName, log)
     fromCIFTommCIF(self.outAtomStructName, self.outAtomStructName, log)
 def createOutputStep(self, targetSym, targetAtomStructFn):
     """ save new atomic structure"""
     pdb = AtomStruct()
     pdb.setFileName(targetAtomStructFn)
     # MM: to get appropriate cif files to be visualize with Chimera
     # Transform the output cif file in mmcif
     log = self._log
     fromCIFTommCIF(pdb.getFileName(), pdb.getFileName(), log)
     self._defineOutputs(rotatedAtomStruct=pdb)
     self._defineSourceRelation(self.pdbFileToBeRefined, pdb)
 def _getRSRefineOutput(self):
     inPdbName = os.path.basename(self.inputStructure.get().getFileName())
     list_cif = []
     for item in os.listdir(self._getExtraPath()):
         p = re.compile('\d+')
         if p.search(item) is not None and item.endswith(".cif"):
             list_cif.append(item)
     name = sorted(list_cif)[-1]
     outAtomStructName = self._getExtraPath(name)
     # convert cif to mmcif by using maxit program
     # to get the right number and name of chains
     log = self._log
     self.outAtomStructName = outAtomStructName
     fromCIFTommCIF(outAtomStructName, self.outAtomStructName, log)
    def createOutputStep(self, outFileName, twoRelations=False, suffix=''):
        outFileName = os.path.abspath(outFileName)
        fnCmd = self._getExtraPath("chimera_output.cxc")
        f = open(fnCmd, 'a+')
        f.write("open %s\n" % outFileName)
        f.close()

        pdb = AtomStruct()
        pdb.setFileName(outFileName)
        # MM: to get appropriate cif files to be visualize with Chimera
        # Transform the output cif file in mmcif
        log = self._log
        fromCIFTommCIF(outFileName, outFileName, log)

        if suffix == "":
            self._defineOutputs(outputPdb=pdb)
        else:
            outputDict = {'outputPdb_chain%s' % suffix: pdb}
            self._defineOutputs(**outputDict)
        self._defineSourceRelation(self.pdbFileToBeRefined, pdb)
        if twoRelations:
            self._defineSourceRelation(self.InputAtomStruct2, pdb)
Exemplo n.º 6
0
 def _runChangingCifFormatSuperpose(self, list_args):
     cwd = os.getcwd() + "/" + self._getExtraPath()
     try:
         if list_args[0].endswith(".cif") and list_args[1].endswith(".cif"):
             try:
                 # upgrade cifs
                 list_args1 = []
                 for i in range(0, 2):
                     list_args1.append(fromCIFTommCIF(list_args[i], list_args[i]))
                 args1 = list_args1[0] + " " + list_args1[1]
                 Plugin.runPhenixProgram(Plugin.getProgram(SUPERPOSE), args1,
                                         extraEnvDict=None, cwd=cwd)
             except:
                 # convert cifs to pdbs
                 list_args2 = []
                 for i in range(0, 2):
                     list_args2.append(fromCIFToPDB(
                         list_args[i], list_args[i].replace('.cif', '.pdb')))
                 args2 = list_args2[0] + " " + list_args2[1]
                 Plugin.runPhenixProgram(Plugin.getProgram(SUPERPOSE), args2,
                                         extraEnvDict=None, cwd=cwd)
         elif list_args[0].endswith(".cif") and list_args[1].endswith(".pdb"):
             try:
                 # pdbs: convert cif to pdb
                 list_args1 = []
                 list_args1.append(fromCIFToPDB(
                     list_args[0], list_args[0].replace('.cif', '.pdb')))
                 args1 = list_args1[0] + " " + list_args[1]
                 Plugin.runPhenixProgram(Plugin.getProgram(SUPERPOSE), args1,
                                         extraEnvDict=None, cwd=cwd)
             except:
                 try:
                     # cifs: convert pdb to cif
                     list_args2 = []
                     list_args2.append(fromPDBToCIF(
                         list_args[1], list_args[1].replace('.pdb', '.cif')))
                     args2 = list_args[0] + " " + list_args2[0]
                     Plugin.runPhenixProgram(Plugin.getProgram(SUPERPOSE), args2,
                                             extraEnvDict=None, cwd=cwd)
                 except:
                     # upgrade cif
                     list_args3 = []
                     list_args0 = args2.split()
                     for i in range(0, 2):
                         list_args3[i].append(fromCIFTommCIF(
                             list_args0[i], list_args0[i]))
                     args3 = list_args3[0] + " " + list_args3[1]
                     Plugin.runPhenixProgram(Plugin.getProgram(SUPERPOSE),
                                             args3, extraEnvDict=None, cwd=cwd)
         elif list_args[0].endswith(".pdb") and list_args[1].endswith(".cif"):
             try:
                 # pdbs: convert cif to pdb
                 list_args1 = []
                 list_args1.append(fromCIFToPDB(
                     list_args[1], list_args[1].replace('.cif', '.pdb')))
                 args1 = list_args[0] + " " + list_args1[0]
                 Plugin.runPhenixProgram(Plugin.getProgram(SUPERPOSE), args1,
                                         extraEnvDict=None, cwd=cwd)
             except:
                 try:
                     # cifs: convert pdb to cif
                     list_args2 = []
                     list_args2.append(fromPDBToCIF(
                         list_args[0], list_args[0].replace('.pdb', '.cif')))
                     args2 = list_args2[0] + " " + list_args[1]
                     Plugin.runPhenixProgram(Plugin.getProgram(SUPERPOSE), args2,
                                             extraEnvDict=None, cwd=cwd)
                 except:
                     # upgrade cifs
                     list_args3 = []
                     list_args0 = args2.split()
                     for i in range(0, 2):
                         list_args3.append(fromCIFTommCIF(
                             list_args0[i], list_args0[i]))
                     args3 = list_args3[0] + " " + list_args3[1]
                     Plugin.runPhenixProgram(Plugin.getProgram(SUPERPOSE),
                                             args3, extraEnvDict=None, cwd=cwd)
     except:
         # biopython conversion
         aSH = AtomicStructHandler()
         try:
             for i in range(0, 2):
                 aSH.read(list_args[i])
                 aSH.write(list_args[i])
                 args = list_args[0] + " " + list_args[1]
                 Plugin.runPhenixProgram(Plugin.getProgram(SUPERPOSE),
                                         args, extraEnvDict=None, cwd=cwd)
         except:
             print("CIF file standarization failed.")