Esempio n. 1
0
    def _visualize(self, obj, **kwargs):
        views = []
        cls = type(obj)

        # For now handle both types of SetOfTiltSeries together
        if issubclass(cls, schrodingerScipion.objects.SchrodingerAtomStruct) or \
           issubclass(cls, schrodingerScipion.objects.SchrodingerBindingSites) or \
           issubclass(cls, schrodingerScipion.objects.SchrodingerPoses):
            pwutils.runJob(None,
                           Plugin.getHome('maestro'),
                           obj.getFileName(),
                           env=Plugin.getEnviron())

        return views
Esempio n. 2
0
 def preparationStep(self):
     if isinstance(self.inputStructure.get(), AtomStruct):
         fnIn = self._getExtraPath("atomStructIn.pdb")
         aStruct1 = AtomicStructHandler(
             self.inputStructure.get().getFileName())
         aStruct1.write(fnIn)
         fnIn = 'extra/atomStructIn.pdb'
         self.runJob(schrodinger_plugin.getHome('maestro'),
                     "-b %s" % fnIn,
                     cwd=self._getPath())
     else:
         fnIn = self._getExtraPath(
             "atomStructIn") + self.inputStructure.get().getExtension()
         createLink(self.inputStructure.get().getFileName(), fnIn)
         fnIn = os.path.join('extra', os.path.split(fnIn)[1])
         self.runJob(schrodinger_plugin.getHome('maestro'),
                     "-m %s" % fnIn,
                     cwd=self._getPath())
    def prepareGrid(self, fnSite, fnTarget):
        n = fnSite.split('@')[0]

        args = schrodinger_plugin.getPluginHome('utils/schrodingerUtils.py') + " centroid %s %s" % \
               (fnSite, self._getTmpPath("centroid.txt"))
        schrodinger_plugin.runSchrodinger(self, "python3", args)
        fh = open(self._getTmpPath("centroid.txt"))
        line = fh.readline()
        fh.close()
        x, y, z = line.split()

        fnGridDir = "grid-%s" % n
        makePath(self._getPath(fnGridDir))
        fnTargetLocal = self._getPath("%s/%s.maegz" % (fnGridDir, fnGridDir))
        createLink(fnTarget, fnTargetLocal)

        fnJob = self._getPath('%s/%s.inp' % (fnGridDir, fnGridDir))
        fh = open(fnJob, 'w')
        fh.write("GRIDFILE %s.zip\n" % fnGridDir)
        fh.write("OUTPUTDIR %s\n" % fnGridDir)
        fh.write("RECEP_FILE %s.maegz\n" % fnGridDir)
        fh.write("REC_MAECHARGES True\n")
        fh.write("HBOND_DONOR_AROMH %s\n" % self.HbondDonorAromH.get())
        if self.HbondDonorAromH.get():
            fh.write("HBOND_DONOR_AROMH_CHARGE %f\n" %
                     self.HbondDonorAromHCharge.get())
        fh.write("HBOND_ACCEP_HALO %s\n" % self.HbondAcceptHalo.get())
        fh.write("HBOND_DONOR_HALO %s\n" % self.HbondDonorHalo.get())
        fh.write("INNERBOX %d,%d,%d\n" %
                 (self.innerX.get(), self.innerY.get(), self.innerZ.get()))
        fh.write("ACTXRANGE %d\n" % self.outerX.get())
        fh.write("ACTYRANGE %d\n" % self.outerY.get())
        fh.write("ACTZRANGE %d\n" % self.outerZ.get())
        fh.write("OUTERBOX %d,%d,%d\n" %
                 (self.outerX.get(), self.outerY.get(), self.outerZ.get()))
        fh.write("GRID_CENTER %s,%s,%s\n" % (x, y, z))
        fh.close()

        args = "-WAIT -LOCAL -NJOBS %d %s.inp" % (self.numberOfThreads.get(),
                                                  fnGridDir)
        self.runJob(schrodinger_plugin.getHome('glide'),
                    args,
                    cwd=self._getPath(fnGridDir))
Esempio n. 4
0
    def sitemapStep(self):
        prog = Plugin.getHome('sitemap')

        fnIn = self._getExtraPath(
            "atomStructIn") + self.inputStructure.get().getExtension()
        createLink(self.inputStructure.get().getFileName(), fnIn)
        fnIn = os.path.join('extra', os.path.split(fnIn)[1])

        args = '-WAIT -prot %s -j job -keeplogs -keepeval' % fnIn
        args += " -maxsites %d" % self.maxsites.get()

        self.runJob(prog, args, cwd=self._getPath())
Esempio n. 5
0
    def preparationStep(self):
        if isinstance(self.inputStructure.get(),AtomStruct):
            fnIn = self._getExtraPath("atomStructIn.pdb")
            aStruct1 = AtomicStructHandler(self.inputStructure.get().getFileName())
            aStruct1.write(fnIn)
            fnIn='extra/atomStructIn.pdb'
        else:
            fnIn = self._getExtraPath("atomStructIn.mae")
            createLink(self.inputStructure.get().getFileName(),fnIn)
            fnIn='extra/atomStructIn.mae'

        self.runJob(schrodinger_plugin.getHome('maestro'), "-b %s"%fnIn, cwd=self._getPath())
    def _viewResults(self, e=None):
        views = []
        i = self.pose.get()
        fnPose = None
        for small in self.protocol.outputSmallMolecules:
            if small.getObjId() == i:
                fnPose = small.poseFile.get()
                break
        if fnPose:
            i = int(fnPose.split('@')[0])
            fnPv = self.protocol.outputPoses.getFileName()
            fnPose = self.protocol._getTmpPath('posei.maegz')
            pwutils.runJob(None, schrodinger_plugin.getHome('utilities/maesubset'),
                           "-n %d:%d %s -o %s" % (i, i, fnPv, fnPose))
            fnStruct = self.protocol.inputGrid.get().structureFile.get()
            fnBoth = self.protocol._getTmpPath('pv.maegz')
            pwutils.runJob(None, schrodinger_plugin.getHome('utilities/structcat'),
                           "-imae %s -imae %s -o %s" % (fnPose,fnStruct,fnBoth))

            pwutils.runJob(None, schrodinger_plugin.getHome('maestro'), fnBoth,
                           env=schrodinger_plugin.getEnviron())
        return views
    def convertStep(self):
        progStructConvert = Plugin.getHome('utilities/structconvert')

        if self.inputType == 0:
            outputSmallMolecules = SetOfSmallMolecules().create(
                path=self._getPath(), suffix='SmallMols')

            for mol in self.inputSmallMols.get():
                fnSmall = mol.smallMoleculeFile.get()
                fnRoot = os.path.splitext(os.path.split(fnSmall)[1])[0]

                args = inputArg(fnSmall)
                fnOut, argout = outputArg(fnRoot, self.outputFormatSmall.get(),
                                          self)
                args += argout

                self.runJob(progStructConvert, args)
                if self.outputFormatSmall.get() == 2:
                    putMol2Title(fnOut)
                smallMolecule = SmallMolecule(smallMolFilename=fnOut)
                outputSmallMolecules.append(smallMolecule)

            if len(outputSmallMolecules) > 0:
                self._defineOutputs(outputSmallMols=outputSmallMolecules)
                self._defineSourceRelation(self.inputSmallMols,
                                           outputSmallMolecules)
        else:
            fnStructure = self.inputStructure.get().getFileName()
            args = inputArg(fnStructure)
            fnRoot = os.path.splitext(os.path.split(fnStructure)[1])[0]
            fnOut, argout = outputArg(fnRoot, self.outputFormatTarget.get())
            args += argout
            self.runJob(progStructConvert, args)

            if fnOut.endswith('.maegz'):
                target = SchrodingerAtomStruct(filename=fnOut)
            else:
                target = AtomStruct(filename=fnOut)
            self._defineOutputs(outputStructure=target)
            self._defineSourceRelation(self.inputStructure, target)
    def primeStep(self):
        prog=Plugin.getHome('prime')

        fnInputStructure = self.inputStructure.get().getFileName()
        fnIn=self._getPath("atomStructIn")+self.inputStructure.get().getExtension()

        createLink(fnInputStructure,fnIn)
        fnIn=os.path.split(fnIn)[1]

        fhJob = open(self._getPath('job.inp'),'w')
        fhJob.write("STRUCT_FILE %s\n" % fnIn)
        if self.operation.get()==0:
            # Side chain prediction
            fhJob.write("PRIME_TYPE  SIDE_PRED\n")
            fhJob.write("SELECT  pick\n")
            i=0
            for residue in self.residueList.get().split(','):
                fhJob.write("RESIDUE_%d %s\n"%(i,residue.strip()))
                i+=1
        elif self.operation.get()==1:
            # Minimization of all hydrogens
            fhJob.write("PRIME_TYPE  REAL_MIN\n")
            fhJob.write("SELECT  asl = (atom.ele H)\n")
        elif self.operation.get()==2:
            # Loop prediction
            fhJob.write("PRIME_TYPE  LOOP_BLD\n")
            fhJob.write("LOOP_0_RES_0 %s\n"%self.residueFirst.get())
            fhJob.write("LOOP_0_RES_1 %s\n"%self.residueLast.get())
            fhJob.write("RES_SPHERE %f\n"%self.resSphere.get())
            fhJob.write("MIN_OVERLAP %f\n"%self.minOverlap.get())

        fhJob.write("USE_CRYSTAL_SYMMETRY no\n")
        fhJob.write("USE_RANDOM_SEED no\n")
        fhJob.write("SEED 0\n")
        fhJob.write("EXT_DIEL 80.00\n")
        fhJob.write("USE_MEMBRANE no\n")
        fhJob.close()
        args='-WAIT -LOCAL job.inp'
        self.runJob(prog,args,cwd=self._getPath())
    def splitStep(self):
        args = Plugin.getMMshareDir('python/common/split_structure.py')
        if self.splitMode.get() == 0:
            args += " -m chain"
            if self.mergeLigands.get():
                args += " -merge_ligands_with_chain"
            if self.mergeWaters.get():
                args += " -merge_waters_with_chain"
        elif self.splitMode.get() == 1:
            args += " -m molecule"
        elif self.splitMode.get() == 2:
            args += " -m residue"
        elif self.splitMode.get() == 3:
            args += " -m ligand"
        elif self.splitMode.get() == 4:
            args += " -m pdb"
            if self.positiveASL.get() != "":
                args += ' -positive_ion_asl "%s"' % self.positiveASL.get()
            if self.negativeASL.get() != "":
                args += ' -negative_ion_asl "%s"' % self.negativeASL.get()
        if self.keepProperties.get():
            args += " --keep_properties"
        if self.splitMode.get() != 4 and self.groupWaters.get():
            args += " -groupwaters"
        if self.splitAll.get():
            args += " -splitall"
        if self.ligandASL.get() != "":
            args += ' -ligand_asl "%s"' % self.ligandASL.get()
        if self.cofactorASL.get() != "":
            args += ' -cofactor_asl "%s"' % self.cofactorASL.get()
        args += " -many_files %s %s" % (self.inputStructure.get().getFileName(
        ), self._getExtraPath('output.maegz'))

        self.runJob(Plugin.getHome('run'), args)

        def getNumber(fn, suffix):
            fnBase = os.path.splitext(os.path.split(fn)[1])[0]
            tokens = fnBase.split(suffix)
            return tokens[1]

        for fn in glob.glob(self._getExtraPath("output*")):
            if "_receptor" in fn:
                target = SchrodingerAtomStruct(filename=fn)
                number = getNumber(fn, "_receptor")
                outputDict = {'outputStructure%s' % number: target}
                self._defineOutputs(**outputDict)
                self._defineSourceRelation(self.inputStructure, target)
            elif "_ligand" in fn:
                ligand = SmallMolecule(smallMolFilename=fn)
                number = getNumber(fn, "_ligand")
                outputDict = {'outputLigand%s' % number: ligand}
                self._defineOutputs(**outputDict)
                self._defineSourceRelation(self.inputStructure, ligand)
            elif "_cof_ion" in fn:
                cof = SchrodingerAtomStruct(filename=fn)
                number = getNumber(fn, "_cof_ion")
                outputDict = {'outputCofactors%s' % number: cof}
                self._defineOutputs(**outputDict)
                self._defineSourceRelation(self.inputStructure, cof)
            else:
                print("Scipion: I don't know how to handle %s" % fn)
    def prepareStep(self):
        def addParam(headerLine, lineToPrint, lineNo, param, value=None):
            if value is None:
                if hasattr(mol, param):
                    value = getattr(mol, param).get()
            if value is not None:
                if lineNo == 0:
                    if headerLine != "":
                        headerLine += "; "
                    headerLine += param
                if lineToPrint != "":
                    lineToPrint += "; "
                lineToPrint += str(value)
            return headerLine, lineToPrint

        def getGridRun(mol):
            fn = mol.poseFile.get()
            return fn.split('Runs/')[1][0:6]

        progStructConvert = Plugin.getHome('utilities/structconvert')
        progMaeSubset = Plugin.getHome('utilities/maesubset')
        grids = {}
        gridNo = 1
        for mol in self.inputSmallMols.get():
            gridRun = getGridRun(mol)
            if not gridRun in grids:
                grids[gridRun] = gridNo
                gridNo += 1

        fh = open(self._getExtraPath("smallMolecules.csv"), 'w')
        lineNo = 0
        headerLine = ""
        for mol in self.inputSmallMols.get():
            fnSmall = mol.smallMoleculeFile.get()
            fnMol = os.path.split(fnSmall)[1]
            fnRoot = os.path.splitext(fnMol)[0]
            if "-" in fnRoot:
                fnRoot = fnRoot.split('-')[0]

            lineToPrint = ""
            headerLine, lineToPrint = addParam(headerLine, lineToPrint, lineNo,
                                               "smallMolecule", fnRoot)
            if fnRoot.startswith("ZINC"):
                headerLine, lineToPrint = addParam(
                    headerLine, lineToPrint, lineNo, "url",
                    "https://zinc15.docking.org/substances/%s" % fnRoot)

            headerLine, lineToPrint = addParam(headerLine, lineToPrint, lineNo,
                                               "bindingSiteScore")
            headerLine, lineToPrint = addParam(headerLine, lineToPrint, lineNo,
                                               "dockingScore")
            headerLine, lineToPrint = addParam(headerLine, lineToPrint, lineNo,
                                               "ligandEfficiency")

            headerLine, lineToPrint = addParam(headerLine, lineToPrint, lineNo,
                                               "gridNumber",
                                               grids[getGridRun(mol)])

            fnOut = self._getExtraPath("pose_%d.pdb" % lineNo)
            if not os.path.exists(fnOut):
                fnAux = self._getTmpPath("tmp.mae")
                n, fnRaw = mol.poseFile.get().split('@')
                args = "-n %s %s -o %s" % (n, fnRaw, fnAux)
                self.runJob(progMaeSubset, args)

                args = "-imae %s -opdb %s" % (fnAux, fnOut)
                self.runJob(progStructConvert, args)

            headerLine, lineToPrint = addParam(headerLine, lineToPrint, lineNo,
                                               "poseFile",
                                               os.path.split(fnOut)[1])

            if lineNo == 0:
                fh.write(headerLine + "\n")
            fh.write(lineToPrint + "\n")
            lineNo += 1
        fh.close()
Esempio n. 11
0
 def __init__(self, inputFile, **kwargs):
     pwviewer.CommandView.__init__(self,
                                   "%s %s &" %
                                   (Plugin.getHome('maestro'), inputFile),
                                   env=Plugin.getEnviron(),
                                   **kwargs)
    def ligPrepStep(self):
        progLigPrep = Plugin.getHome('ligprep')
        progStructConvert = Plugin.getHome('utilities/structconvert')

        outputSmallMolecules = SetOfSmallMolecules().create(
            path=self._getPath(), suffix='SmallMols')
        outputSmallMoleculesDropped = SetOfSmallMolecules().create(
            path=self._getPath(), suffix='SmallMolsDropped')

        for mol in self.inputSmallMols.get():
            fnSmall = mol.smallMoleculeFile.get()
            fnMol = os.path.split(fnSmall)[1]
            fnRoot = os.path.splitext(fnMol)[0]

            existingFiles = glob.glob(self._getExtraPath(fnRoot + "*"))
            if len(existingFiles) == 0:
                fnSmallExtra = self._getTmpPath(fnMol)
                copyFile(fnSmall, fnSmallExtra)

                args = '-WAIT -LOCAL'
                if self.ionization.get() != 0:
                    if self.ionization.get() == 1:
                        args += " -epik"
                        if self.emb.get():
                            args += " -epik_metal_binding"
                    else:
                        args += " -i %d" % self.ionization.get() - 2
                    args += " -ph %f -pht %f" % (self.pH.get(),
                                                 self.pHrange.get())

                if self.stereoisomers.get():
                    args += " -g"
                else:
                    args += " -ac -s %d" % self.Niso.get()

                if self.optimization.get() == 1:
                    args += " -bff 14"
                elif self.optimization.get() == 2:
                    args += " -bff 16"

                if fnMol.endswith('.smi'):
                    args += " -ismi tmp/%s" % (fnMol)
                elif fnMol.endswith('.mae') or fnMol.endswith('.maegz'):
                    args += " -imae tmp/%s" % (fnMol)
                elif fnMol.endswith('.sdf'):
                    args += " -isd tmp/%s" % (fnMol)
                else:
                    print("Skipping %s" % fnSmall)
                    continue

                fnMae = "extra/%s.maegz" % fnRoot
                if not os.path.exists(fnMae):
                    args += " -omae %s" % fnMae
                    self.runJob(progLigPrep, args, cwd=self._getPath())

                if os.path.exists(self._getPath(fnMae)):
                    fnOmae = "extra/o%s.maegz" % fnRoot
                    args = "-imae %s -omae %s -split-nstructures 1" % (fnMae,
                                                                       fnOmae)
                    self.runJob(progStructConvert, args, cwd=self._getPath())
                    for fn in glob.glob(
                            self._getExtraPath("o%s*.maegz" % fnRoot)):
                        fnDir, fnOut = os.path.split(fn)
                        fnOut = self._getExtraPath(fnOut[1:])
                        moveFile(fn, fnOut)
                        smallMolecule = SmallMolecule(smallMolFilename=fnOut)
                        outputSmallMolecules.append(smallMolecule)
                    if len(glob.glob(self._getExtraPath(
                            "%s-*.maegz" % fnRoot))) > 0:
                        cleanPath(self._getPath(fnMae))
                else:
                    smallMolecule = SmallMolecule(smallMolFilename=fnSmall)
                    outputSmallMoleculesDropped.append(smallMolecule)
            else:
                for fn in glob.glob(self._getExtraPath("%s*.maegz" % fnRoot)):
                    print("Reading %s" % fn)
                    smallMolecule = SmallMolecule(smallMolFilename=fn)
                    outputSmallMolecules.append(smallMolecule)

        if len(outputSmallMolecules) > 0:
            self._defineOutputs(outputSmallMols=outputSmallMolecules)
            self._defineSourceRelation(self.inputSmallMols,
                                       outputSmallMolecules)
        if len(outputSmallMoleculesDropped) > 0:
            self._defineOutputs(
                outputSmallMolsDropped=outputSmallMoleculesDropped)
            self._defineSourceRelation(self.inputSmallMols,
                                       outputSmallMoleculesDropped)
    def dockingStep(self):
        def makeLocal(fn):
            return fn.replace(self._getPath()+'/','')

        glideProg = schrodinger_plugin.getHome('glide')
        structConvertProg = schrodinger_plugin.getHome('utilities/structconvert')
        structCatProg = schrodinger_plugin.getHome('utilities/structcat')
        propListerProg = schrodinger_plugin.getHome('utilities/proplister')

        fnGrid = self._getExtraPath("grid.zip")
        if not os.path.exists(fnGrid): # Prepared to resume
            createLink(self.inputGrid.get().getFileName(),fnGrid)

        fnLigands = self._getPath('ligands')
        if not os.path.exists(fnLigands):
            makePath(fnLigands)

        fnIn = self._getPath('job.inp')
        if not os.path.exists(fnIn): # Prepared to resume
            fhIn = open(fnIn,'w')
            fhIn.write("GRIDFILE %s\n"%makeLocal(fnGrid))

            if self.dockingMethod.get()==0:
                fhIn.write("DOCKING_METHOD confgen\n")
                fhIn.write("FLEXTORS True\n")
            elif self.dockingMethod.get()==1:
                fhIn.write("DOCKING_METHOD rigid\n")
            elif self.dockingMethod.get()==2:
                fhIn.write("DOCKING_METHOD mininplace\n")
            elif self.dockingMethod.get()==3:
                fhIn.write("DOCKING_METHOD inplace\n")

            if self.dockingPrecision.get()==0:
                fhIn.write("PRECISION HTVS\n")
            elif self.dockingPrecision.get()==1:
                fhIn.write("PRECISION SP\n")
            elif self.dockingPrecision.get()==2:
                fhIn.write("PRECISION XP\n")
                fhIn.write("WRITE_XP_DESC True\n")
                fhIn.write("POSTDOCK_NPOSE 10\n")

            fhIn.write("SAMPLE_N_INVERSIONS %s\n"%self.sampleNinversions.get())
            fhIn.write("SAMPLE_RINGS %s\n"%self.sampleRings.get())
            fhIn.write("EPIK_PENALTIES %s\n"%self.sampleNinversions.get())
            fhIn.write("SKIP_EPIK_METAL_ONLY %s\n"%self.skipMetalEpik.get())
            fhIn.write("EXPANDED_SAMPLING %s\n"%self.expandedSampling.get())
            fhIn.write("REWARD_INTRA_HBONDS %s\n"%self.rewardIntraHBonds.get())
            fhIn.write("HBOND_DONOR_AROMH %s\n"%self.HbondDonorAromH.get())
            if self.HbondDonorAromH.get():
                fhIn.write("HBOND_DONOR_AROMH_CHARGE %f\n" % self.HbondDonorAromHCharge.get())
            fhIn.write("HBOND_ACCEP_HALO %s\n"%self.HbondAcceptHalo.get())
            fhIn.write("HBOND_DONOR_HALO %s\n"%self.HbondDonorHalo.get())

            fhIn.write("MAXKEEP %d\n"%self.maxkeep.get())
            fhIn.write("SCORING_CUTOFF %f\n"%self.scoreCutoff.get())
            if self.maxref.get()>0:
                fhIn.write("MAXREF %d\n" % self.maxref.get())
            else:
                if self.dockingPrecision.get()==2:
                    fhIn.write("MAXREF %d\n" % 800)
                else:
                    fhIn.write("MAXREF %d\n" % 400)
            fhIn.write("POSES_PER_LIG %d\n"%self.posesPerLig.get())

            fh=open(self._getTmpPath("allLigands.mol2"),'w')
            for small in self.inputLibrary.get():
                fnSmall = small.getFileName()
                fnBase = os.path.splitext(os.path.split(fnSmall)[1])[0]
                if not fnSmall.endswith('.mol2'):
                    args = inputArg(fnSmall)
                    fnSmall = self._getTmpPath('ligand.mol2')
                    args += " -omol2 %s"%fnSmall
                    self.runJob(structConvertProg, args)
                    putMol2Title(fnSmall,fnBase)
                fhLigand = open(fnSmall)
                for line in fhLigand:
                    fh.write(line)
                fhLigand.close()
            fh.close()
            fhIn.write("LIGANDFILE tmp/allLigands.mol2\n")

            fhIn.close()

        args = "-WAIT -NJOBS %d -RESTART -LOCAL job.inp"%(self.numberOfThreads.get())
        self.runJob(glideProg, args, cwd=self._getPath())

        self.runJob(propListerProg,
                    '-p "title" -p "docking score" -p "glide ligand efficiency" -p "glide ligand efficiency sa" -p "glide ligand efficiency ln" -c -o %s %s'%\
                    (self._getPath("job_pv.csv"), self._getPath("job_pv.maegz")))
Esempio n. 14
0
    def preparationStep(self):
        prog = Plugin.getHome('utilities/prepwizard')

        if isinstance(self.inputStructure.get(), AtomStruct):
            fnIn = self._getExtraPath("atomStructIn.pdb")
            aStruct1 = AtomicStructHandler(
                self.inputStructure.get().getFileName())
            aStruct1.write(fnIn)
            fnIn = 'extra/atomStructIn.pdb'
        else:
            fnIn = self._getExtraPath("atomStructIn.mae")
            createLink(self.inputStructure.get().getFileName(), fnIn)
            fnIn = 'extra/atomStructIn.mae'

        args = '-WAIT'
        if self.stage1.get():
            if self.fillSideChains.get():
                args += ' -fillsidechains'
            if self.fillLoops.get():
                args += ' -fillloops'
            if self.disulfides.get():
                args += ' -disulfides'
            if self.mse.get():
                args += ' -mse'
            if self.hydrogens.get() == 0:
                args += " -nohtreat"
            elif self.hydrogens.get() == 1:
                args += " -rehtreat"
            if self.glycosylation.get():
                args += " -glycosylation"
            if self.palmitoylation.get():
                args += " -palmitoylation"
            if self.captermini.get():
                args += " -captermini"
            if self.keepFarWat.get():
                args += " -keepfarwat -watdist %f" % self.watdist.get()
            if not self.treatMetals.get():
                args += " -nometaltreat"

        if self.stage2.get():
            if self.sampleWaters.get():
                args += " -samplewater"
            if self.xtal.get():
                args += " -xtal"
            if self.propKa.get():
                args += " -propka_pH %f" % self.propKapH.get()
            else:
                args += " -nopropka"
            if self.minadjh.get():
                args += " -minimize_adj_h"
        else:
            args += " -noprotassign"

        if self.stage3.get():
            args += " -rmsd %f" % self.rmsdD.get()
            if self.fix.get():
                args += " -fix"
            if self.force.get() == 0:
                args += " -f 2005"
            else:
                args += " -f 3"
        else:
            args += " -noimpref"

        if self.stage4.get():
            if self.ms.get():
                args += " -ms %d" % self.msN.get()
            args += " -epik_pH %f" % self.epikPh.get()
            args += " -epik_pHt %f" % self.epikPht.get()
        else:
            args += " -noepik"

        args += ' %s atomStructOut.maegz' % fnIn
        self.runJob(prog, args, cwd=self._getPath())