Ejemplo n.º 1
0
    def registerPlugin(cls, name):
        """ Register a new plugin. This function should only be called when
        creating a class with __metaclass__=PluginMeta that will trigger this.
        """
        m = importlib.import_module(name)

        # Define variables
        m.Plugin._defineVariables()
        m.Domain = cls  # Register the domain class for this module
        # TODO avoid loading bibtex here and make a lazy load like the rest.
        # Load bibtex
        m._bibtex = {}
        bib = cls.__getSubmodule(name, 'bibtex')
        if bib is not None:
            if hasattr(bib, "_bibtex"):
                print("WARNING FOR DEVELOPERS:  %s/%s._bibtex unnecessarily declared. Just the doc string is enough." % (name, "bibtex"))
            else:
                try:
                    m._bibtex = pwutils.LazyDict(lambda: pwutils.parseBibTex(bib.__doc__))
                except Exception:
                    pass
        cls._plugins[name] = m  # Register the name to as a plugin
Ejemplo n.º 2
0
    def registerPlugin(cls, name):
        """ Register a new plugin. This function should only be called
        when creating a class with __metaclass__=PluginMeta that will
        trigger this.
        """
        m = importlib.import_module(name)
        cls._plugins[name] = m  # Register the name to as a plugin
        # TODO: Load subclasses (protocols, viewers, wizards)

        # Define variables
        m.Plugin._defineVariables()

        # Load bibtex
        m._bibtex = {}
        bib = cls.__getSubmodule(name, 'bibtex')
        if bib is not None:
            try:
                m._bibtex = pwutils.parseBibTex(bib.__doc__)
            except Exception:
                pass

        return m
Ejemplo n.º 3
0
number = "",
pages = "",
year = "",
note = "submitted",
issn = "",
doi = "",
url = "",
author = "Marabini et al.",
keywords = "Contrast transfer function"
}

@article{Sorzano2015b,
  title                    = "Cryo-EM and the elucidation of new macromolecular structures: Random Conical Tilt revisited.",
  author                   = "Sorzano, C O S. and Alcorlo, M. and de la Rosa-Trevin, J. M. and Melero, R. and Foche, I. and Zaldivar-Peraza, A. and del Cano, L. and Vargas, J. and Abrishami, V. and Oton, J. and Marabini, R. and Carazo, J. M.",
  journal                  = "Scientific Reports",
  year                     = "2015",
  pages                    = "14290",
  volume                   = "5",

  doi                      = "http://dx.doi.org/10.1038/srep14290",
  url                      = "http://dx.doi.org/10.1038/srep14290"
}

"""



from pyworkflow.utils import parseBibTex

_bibtex = parseBibTex(_bibtexStr)  
Ejemplo n.º 4
0
# *
# *  All comments concerning this program package may be sent to the
# *  e-mail address '*****@*****.**'
# *
# **************************************************************************
"""
Bibtex string file for Xmipp package.
"""

_bibtexStr = """
@article{Heymann2007,
title = "Bsoft: Image processing and molecular modeling for electron microscopy ",
journal = "Journal of Structural Biology ",
volume = "157",
number = "1",
pages = "3 - 18",
year = "2007",
issn = "1047-8477",
doi = "http://dx.doi.org/10.1016/j.jsb.2006.06.006",
url = "http://www.sciencedirect.com/science/article/pii/S1047847706001997",
author = "J. Bernard Heymann and David M. Belnap",
keywords = "Single particle analysis Tomography",
}
"""



from pyworkflow.utils import parseBibTex

_bibtex = parseBibTex(_bibtexStr)  
Ejemplo n.º 5
0
def printPluginInfo(pluginName, verbosity):
    """ Print info about a given plugin """
    showBase = verbosity > 0
    subclasses = {}
    emCategories = [('Imports', em.ProtImport),
                    ('Micrographs', em.ProtMicrographs),
                    ('Particles', em.ProtParticles), ('2D', em.Prot2D),
                    ('3D', em.Prot3D)]

    plugin = Domain.getPlugin(pluginName)
    version = PluginInfo('scipion-em-%s' % pluginName).pipVersion
    print("Plugin name: %s, version: %s\n" % (pluginName, version))

    print("Plugin binaries: ")
    env = createEnvironment()
    plugin.Plugin.defineBinaries(env)
    print(env.printHelp())

    # print bibtex
    bib, error2 = getSubmodule(pluginName, 'bibtex')
    if bib is None:
        if error2 is None:
            msg = " missing bibtex"
        else:
            msg = " error -> %s" % error2
    else:
        print("Plugin references:")
        bibtex = pwutils.parseBibTex(bib.__doc__)

        for citeStr in bibtex:
            text = Protocol()._getCiteText(bibtex[citeStr])
            print(text)

    # print protocols
    sub, error = getSubmodule(pluginName, 'protocols')
    if sub is None:
        if error is None:
            msg = " missing protocols"
        else:
            msg = " error -> %s" % error

    else:
        for name in dir(sub):
            attr = getattr(sub, name)
            if inspect.isclass(attr) and issubclass(attr, Protocol):
                # Set this special property used by Scipion
                attr._package = plugin
                subclasses[name] = attr

    print("Plugin protocols:\n")
    print("%-35s %-35s %-10s %-s" %
          ('NAME', 'LABEL', 'CATEGORY', 'DESCRIPTION'))

    prots = OrderedDict(sorted(subclasses.items()))
    for prot in prots:
        label = prots[prot].getClassLabel()
        desc = getFirstLine(prots[prot].__doc__)
        cat = 'None'

        for c in emCategories:
            if issubclass(prots[prot], c[1]):
                cat = c[0]
            if prots[prot].isBase():
                cat = 'Base prot'

        # skip Base protocols if not requested
        if prots[prot].isBase() and not showBase:
            continue
        else:
            print("%-35s %-35s %-10s %-s" % (prot, label, cat, desc))
Ejemplo n.º 6
0
        version = PluginInfo('scipion-em-%s' % pluginName).pipVersion
        bin = PluginInfo('scipion-em-%s' % pluginName).printBinInfoStr()
        print("Plugin name: %s, version: %s" % (pluginName, version))
        print("Plugin binaries: %s" % bin)

        # print bibtex
        bib, error2 = getSubmodule(plugin, pluginName, 'bibtex')
        if bib is None:
            if error2 is None:
                msg = " missing bibtex"
            else:
                exitWithErrors = True
                msg = " error -> %s" % error2
        else:
            print("Plugin references:")
            bibtex = pwutils.parseBibTex(bib.__doc__)

            for citeStr in bibtex:
                text = Protocol()._getCiteText(bibtex[citeStr])
                print(text)

        # print protocols
        sub, error = getSubmodule(plugin, pluginName, 'protocols')
        if sub is None:
            if error is None:
                msg = " missing protocols"
            else:
                exitWithErrors = True
                msg = " error -> %s" % error

        else: