コード例 #1
0
 def _openHTML(self, e=None):
     reportHtml = self.protocol.createHtmlReport()
     reportPath = reportHtml.reportPath
     if pwutils.exists(reportPath):
         text._open_cmd(reportPath)
     else:
         self.showInfo('Your html file is not ready yet. Please try again in a minute.')
コード例 #2
0
    def visualize(self, obj, **args):
        data = self.protocol._getPath('emxData/data.mrc')
        DataView(data).show()

        # open EMX file in web browser
        fn = self.protocol._getPath('emxData/data.emx')
        text._open_cmd(fn, self.getTkRoot())
コード例 #3
0
ファイル: viewers.py プロジェクト: EyeSeeTea/scipion-em-eman2
 def _showHtmlReport(self, paramName=None):
     reportPath = self.protocol._getFileName('reportHtml',
                                             run=self.protocol._getRun())
     if pwutils.exists(reportPath):
         text._open_cmd(reportPath, self.getTkRoot())
     else:
         self.showInfo(
             'Your html report is not ready yet. Please try again in a minute.'
         )
コード例 #4
0
 def _openHTML(self, e=None):
     reportHtml = self.protocol.createHtmlReport()
     reportPath = reportHtml.reportPath
     if pwutils.exists(reportPath):
         text._open_cmd(reportPath)
     else:
         self.showInfo(
             'Your html file is not ready yet. Please try again in a minute.'
         )
コード例 #5
0
    def _openConfigFile(self, configFile, userOnly=False):
        """ Open an Scipion configuration file, if the user have one defined,
        also open that one with the defined text editor.
        """
        if not userOnly:
            _open_cmd(pw.getConfigPath(configFile))

        userHostConf = os.path.join(pwutils.getHomePath(), '.config',
                                    'scipion', configFile)
        if os.path.exists(userHostConf):
            _open_cmd(userHostConf)
コード例 #6
0
ファイル: project.py プロジェクト: I2PC/scipion
    def _openConfigFile(self, configFile, userOnly=False):
        """ Open an Scipion configuration file, if the user have one defined,
        also open that one with the defined text editor.
        """
        if not userOnly:
            _open_cmd(pw.getConfigPath(configFile))

        userHostConf = os.path.join(pwutils.getHomePath(),
                                    '.config', 'scipion', configFile)
        if os.path.exists(userHostConf):
            _open_cmd(userHostConf)
コード例 #7
0
 def _openConfigFile(configFile):
     """ Open an Scipion configuration file, if the user have one defined,
     also open that one with the defined text editor.
     """
     _open_cmd(configFile)
コード例 #8
0
    def _chainPair(self, e=None):
        if self.doInvert.get():
            commandDisplayInteractions = """
SELECT count(*), protId_2, modelId_2, chainId_2,
       aaName_2 || aaNumber_2, protId_1, modelId_1,
       chainId_1,  aaName_1 || aaNumber_1
FROM view_ND_2
WHERE modelId_1='{}' AND protId_1='{}' AND chainId_1='{}'
  AND modelId_2='{}' AND protId_2='{}' AND chainId_2='{}'
GROUP BY protId_1, modelId_1, chainId_1,
         aaNumber_1, aaName_1, protId_2,
         modelId_2, chainId_2, aaNumber_2,
         aaName_2
ORDER BY protId_2, modelId_2, chainId_2,
        protId_1, modelId_1, chainId_1,
        aaNumber_2, aaName_2,  aaNumber_1, aaName_1;
"""
        else:
            commandDisplayInteractions = """
SELECT count(*), protId_1, modelId_1, chainId_1,
       aaName_1 || aaNumber_1, protId_2, modelId_2,
       chainId_2,  aaName_2 || aaNumber_2
FROM   view_ND_2
WHERE modelId_1='{}' AND protId_1='{}' AND chainId_1='{}'
  AND modelId_2='{}' AND protId_2='{}' AND chainId_2='{}'
GROUP BY protId_1, modelId_1, chainId_1,
         aaNumber_1, aaName_1, protId_2,
         modelId_2, chainId_2, aaNumber_2,
         aaName_2
ORDER BY protId_1, modelId_1, chainId_1,
         protId_2, modelId_2, chainId_2,
         aaNumber_1, aaName_1,  aaNumber_2, aaName_2;
"""
        f = open(self.getInteractionFileName(), 'w')
        if len(self.all_pair_chains) == self.chainPair.get():
            f.write("No contacts found by applying symmetry: Is the symmetry "
                    "center equal to the origin of coordinates?")
        else:
            row = self.all_pair_chains[self.chainPair.get()]
            command = commandDisplayInteractions.format(
                row[1], row[2], row[3], row[4], row[5], row[6])
            # print command
            rows_count = self.c.execute(command)
            all_rows = self.c.fetchall()

            f.write("RESULTS for: {}\n".format(', '.join(str(s) for s in row)))
            f.write(
                "# atoms, prot_1, model_1, chain_1, AA_1, prot_2, model_2, chain2, AA_2\n"
            )
            first = None
            last = None
            first2 = None
            last2 = None
            aaDistance = self.aaDistance.get()
            for row in all_rows:
                AA_1 = row[4]
                AA_1Int = int(AA_1[3:])
                AA_2 = row[8]
                AA_2Int = int(AA_2[3:])
                if first is None:
                    first = AA_1
                    last = first
                    lastInt = AA_1Int

                    first2 = AA_2
                    firstInt2 = AA_2Int
                    last2 = first2
                    lastInt2 = AA_2Int
                else:
                    if (AA_1Int - lastInt) > aaDistance:

                        f.write(">>>> {first}".format(first=first))
                        if last != first:
                            f.write("_{last}".format(last=last))
                        f.write(" ---- {first}".format(first=first2))
                        if last2 != first2:
                            f.write("_{last}".format(last=last2))
                        if (lastInt2 - firstInt2) > 20:
                            f.write("????\n\n")
                        else:
                            f.write("?\n\n")

                        first = AA_1
                        last = first
                        lastInt = AA_1Int
                        first2 = AA_2
                        firstInt2 = AA_2Int
                        last2 = AA_2
                        lastInt2 = AA_2Int
                    else:
                        last = AA_1
                        lastInt = int(AA_1[3:])
                        tmpLastInt2 = int(AA_2[3:])
                        if lastInt2 < tmpLastInt2:
                            last2 = AA_2
                            lastInt2 = tmpLastInt2
                        if firstInt2 > tmpLastInt2:
                            first2 = AA_2
                            firstInt2 = tmpLastInt2

                f.write(', '.join(str(s) for s in row) + "\n")
                # print first, last, first2, last2, firstInt2, lastInt2
            f.write(">>>> {first}".format(first=first))
            if last != first:
                f.write("_{last}".format(last=last))
            f.write(" ---- {first}".format(first=first2))
            if last2 != first2:
                f.write("_{last}".format(last=last2))
            if (lastInt2 - firstInt2) > 20:
                f.write("????\n\n")
            else:
                f.write("?\n\n")

        f.close()
        _open_cmd(self.getInteractionFileName(), self.getTkRoot())
コード例 #9
0
 def _visualizeChainPairFile(self, e=None):
     """Show file with the chains that interact."""
     _open_cmd(self.getPairChainsFileName(), self.getTkRoot())
コード例 #10
0
 def onGeneral(self):
     # Config -> General
     _open_cmd(pw.getConfigPath('scipion.conf'))
コード例 #11
0
 def _visualizeLogFile(self, e=None):
     """Show refmac log file."""
     refineLogFileName = self.protocol._getExtraPath(
         self.protocol.refineLogFileName)
     _open_cmd(refineLogFileName, self.getTkRoot())
コード例 #12
0
def main(args=None):
    parser = optparse.OptionParser(description=__doc__)
    add = parser.add_option  # shortcut
    add('--overwrite',
        action='store_true',
        help="Rewrite the configuration files using the original templates.")
    add(UPDATE_PARAM,
        action='store_true',
        help=(
            "Updates you local config files with the values in the template, "
            "only for those missing values."))
    add('--notify',
        action='store_true',
        help="Allow Scipion to notify usage data (skips user question) "
        "TO BE DEPRECATED, use unattended param instead")
    add('--unattended',
        action='store_true',
        help="Scipion will skipping questions")
    add('-p', help='Prints the config variables associated to plugin P')

    add(COMPARE_PARAM,
        action='store_true',
        help="Check that the configurations seems reasonably well set up.")

    add('--show',
        action='store_true',
        help="Show the config files used in the default editor")

    options, args = parser.parse_args(args)

    if args:  # no args which aren't options
        sys.exit(parser.format_help())

    unattended = options.notify or options.unattended

    if options.p:
        import pyworkflow.utils as pwutils
        pluginName = options.p
        plugin = (pwutils.Config.getDomain().importFromPlugin(
            pluginName, 'Plugin'))

        if plugin is not None:
            plugin._defineVariables()

            print("Variables defined by plugin '%s':\n" % pluginName)
            for k, v in plugin._vars.items():
                print("%s = %s" % (k, v))
            print("\nThese variables can be added/edited in '%s'" %
                  os.environ[SCIPION_CONFIG])
        else:
            print(
                "No plugin found with name '%s'. Module name is expected,\n"
                "i.e. 'scipion3 config -p xmipp3' shows the config variables "
                "defined in 'scipion-em-xmipp' plugin." % pluginName)

        sys.exit(0)
    elif options.show:
        from pyworkflow.gui.text import _open_cmd
        scipionConf = os.environ[SCIPION_CONFIG]
        homeConf = os.environ[SCIPION_LOCAL_CONFIG]
        _open_cmd(scipionConf)
        if homeConf != scipionConf and os.path.exists(homeConf):
            _open_cmd(os.environ[SCIPION_LOCAL_CONFIG])
        sys.exit(0)
    try:
        # where templates are
        templates_dir = getTemplatesPath()

        scipionConfigFile = os.environ[SCIPION_CONFIG]
        # Global installation configuration files.
        for fpath, tmplt in [
            (scipionConfigFile, SCIPION_CONF),
            (getConfigPathFromConfigFile(scipionConfigFile,
                                         PROTOCOLS), PROTOCOLS),
            (getConfigPathFromConfigFile(scipionConfigFile, HOSTS), HOSTS)
        ]:
            if not exists(fpath) or options.overwrite:
                print(fpath, tmplt)
                createConf(fpath,
                           join(templates_dir, getTemplateName(tmplt)),
                           unattended=unattended)
            else:
                checkConf(fpath,
                          join(templates_dir, getTemplateName(tmplt)),
                          update=options.update,
                          unattended=unattended)

        # Check paths for the config
        checkPaths(os.environ[SCIPION_CONFIG])

    except Exception as e:
        # This way of catching exceptions works with Python 2 & 3
        print('Config error: %s\n' % e)
        import traceback
        traceback.print_exc()
        sys.exit(1)
コード例 #13
0
ファイル: project.py プロジェクト: I2PC/scipion
 def onGeneral(self):
     # Config -> General
     _open_cmd(pw.getConfigPath('scipion.conf'))
コード例 #14
0
 def visualize(self, obj, **kwargs):
     _open_cmd(obj._getPath("report.pdf"))
コード例 #15
0
 def _generateHTML(self, e=None):
     reportHtml = self.protocol.createHtmlReport()
     reportPath = reportHtml.generate(self.protocol.isFinished())
     text._open_cmd(reportPath)