예제 #1
0
 def _validate(self):
     errors = checkInputHasFasta(self)
     from pyworkflow.utils.which import which
     if which("curl") == "":
         errors.append("Cannot find curl in the path. Install with apt-get install curl, yum install wget or equivalent in your system")
     if which("wget") == "":
         errors.append("Cannot find curl in the path. Install with apt-get install wget, yum install wget or equivalent in your system")
     return errors
예제 #2
0
 def _validate(self):
     errors = []
     if self.email.get() == "":
         errors.append("The email cannot be empty")
     from pyworkflow.utils.which import which
     if which("curl") == "":
         errors.append(
             "Cannot find curl in the path. Install with apt-get install curl, yum install curl or equivalent in your system"
         )
     if which("wget") == "":
         errors.append(
             "Cannot find curl in the path. Install with apt-get install wget, yum install wget or equivalent in your system"
         )
     return errors
    def _validate(self):
        errors = []
        nmaBin = Plugin.getVar(NMA_HOME)
        nma_programs = [
            'nma_check_modes', 'nma_diag_arpack', 'nma_diagrtb',
            'nma_elnemo_pdbmat'
        ]
        # Check Xmipp was compiled with NMA flag to True and
        # some of the nma programs are under the Xmipp/bin/ folder
        for prog in nma_programs:
            if not exists(join(nmaBin, prog)):
                errors.append(
                    "Some NMA programs are missing in the NMA folder.")
                #errors.append("Check that Scipion was installed with NMA: 'scipion installb nma'")
                errors.append("Check that Scipion was installed with NMA")
                break
        from pyworkflow.utils.which import which
        if (which("csh") == "") and (which("bash") == ""):
            errors.append(
                "Please install csh (can be a link to tcsh) or bash (e.g., on Ubuntu 'sudo apt-get install csh' or 'sudo apt-get install bash')"
            )

        return errors
예제 #4
0
    def _validate(self):
        errors = []
        nmaBin = os.environ["NMA_HOME"]
        nma_programs = ["nma_check_modes", "nma_diag_arpack", "nma_diagrtb", "nma_elnemo_pdbmat"]
        # Check Xmipp was compiled with NMA flag to True and
        # some of the nma programs are under the Xmipp/bin/ folder
        for prog in nma_programs:
            if not exists(join(nmaBin, prog)):
                errors.append("Some NMA programs are missing in the NMA folder.")
                errors.append("Check that Scipion was installed with NMA: 'scipion install nma'")
                break
        from pyworkflow.utils.which import which

        if which("csh") == "":
            errors.append("Cannot find csh in the PATH")

        return errors
예제 #5
0
    def _validate(self):
        errors = []
        nmaBin = Plugin.getVar(NMA_HOME)
        nma_programs = [
            'nma_check_modes', 'nma_diag_arpack', 'nma_diagrtb',
            'nma_elnemo_pdbmat'
        ]
        # Check Xmipp was compiled with NMA flag to True and
        # some of the nma programs are under the Xmipp/bin/ folder
        for prog in nma_programs:
            if not exists(join(nmaBin, prog)):
                errors.append(
                    "Some NMA programs are missing in the NMA folder.")
                errors.append(
                    "Check that Scipion was installed with NMA: 'scipion install nma'"
                )
                break
        from pyworkflow.utils.which import which
        if which("csh") == "":
            errors.append("Cannot find csh in the PATH")

        return errors
    def qualifyModesStep(self,
                         numberOfModes,
                         collectivityThreshold,
                         structureEM,
                         suffix=''):
        self._enterWorkingDir()

        fnVec = glob("modes/vec.*")

        if len(fnVec) < numberOfModes:
            msg = "There are only %d modes instead of %d. "
            msg += "Check the number of modes you asked to compute and/or consider increasing cut-off distance."
            msg += "The maximum number of modes allowed by the method for atomic normal mode analysis is 6 times"
            msg += "the number of RTB blocks and for pseudoatomic normal mode analysis 3 times the number of pseudoatoms. "
            msg += "However, the protocol allows only up to 200 modes as 20-100 modes are usually enough. If the number of"
            msg += "modes is below the minimum between these two numbers, consider increasing cut-off distance."
            self._printWarnings(redStr(msg % (len(fnVec), numberOfModes)))
            print(
                redStr('Warning: There are only %d modes instead of %d.' %
                       (len(fnVec), numberOfModes)))
            print(
                redStr(
                    "Check the number of modes you asked to compute and/or consider increasing cut-off distance."
                ))
            print(
                redStr(
                    "The maximum number of modes allowed by the method for atomic normal mode analysis is 6 times"
                ))
            print(
                redStr(
                    "the number of RTB blocks and for pseudoatomic normal mode analysis 3 times the number of pseudoatoms."
                ))
            print(
                redStr(
                    "However, the protocol allows only up to 200 modes as 20-100 modes are usually enough. If the number of"
                ))
            print(
                redStr(
                    "modes is below the minimum between these two numbers, consider increasing cut-off distance."
                ))

        fnDiag = "diagrtb.eigenfacs"

        if structureEM:
            if which("csh") != "":
                self.runJob("nma_reformatForElNemo.csh",
                            "%d" % len(fnVec),
                            env=getNMAEnviron())
            else:
                if which("bash") != "":
                    self.runJob("nma_reformatForElNemo.sh",
                                "%d" % len(fnVec),
                                env=getNMAEnviron())

            fnDiag = "diag_arpack.eigenfacs"

        self.runJob("echo",
                    "%s | nma_check_modes" % fnDiag,
                    env=getNMAEnviron())
        cleanPath(fnDiag)

        fh = open("Chkmod.res")
        mdOut = xmippLib.MetaData()
        collectivityList = []

        for n in range(len(fnVec)):
            line = fh.readline()
            collectivity = float(line.split()[1])
            collectivityList.append(collectivity)

            objId = mdOut.addObject()
            modefile = self._getPath("modes", "vec.%d" % (n + 1))
            mdOut.setValue(xmippLib.MDL_NMA_MODEFILE, modefile, objId)
            mdOut.setValue(xmippLib.MDL_ORDER, long(n + 1), objId)

            if n >= 6:
                mdOut.setValue(xmippLib.MDL_ENABLED, 1, objId)
            else:
                mdOut.setValue(xmippLib.MDL_ENABLED, -1, objId)
            mdOut.setValue(xmippLib.MDL_NMA_COLLECTIVITY, collectivity, objId)

            if collectivity < collectivityThreshold:
                mdOut.setValue(xmippLib.MDL_ENABLED, -1, objId)
        fh.close()
        idxSorted = [
            i[0] for i in sorted(
                enumerate(collectivityList), key=lambda x: x[1], reverse=True)
        ]

        score = []
        for j in range(len(fnVec)):
            score.append(0)

        modeNum = []
        l = 0
        for k in range(len(fnVec)):
            modeNum.append(k)
            l += 1

        # score = [0]*numberOfModes
        for i in range(len(fnVec)):
            score[idxSorted[i]] = idxSorted[i] + modeNum[i] + 2
        i = 0
        for objId in mdOut:
            score_i = float(score[i]) / (2.0 * l)
            mdOut.setValue(xmippLib.MDL_NMA_SCORE, score_i, objId)
            i += 1
        mdOut.write("modes%s.xmd" % suffix)
        cleanPath("Chkmod.res")

        self._leaveWorkingDir()