Beispiel #1
0
def info():
    from bioconvert.core.registry import Registry
    r = Registry()
    info = r.get_info()
    converters = [x for x in info.items()]
    data = [info[k] for k,v in info.items()]
    msg = "Bioconvert contains {} converters including {} methods"
    return msg.format(len(converters), sum(data)) 
Beispiel #2
0
def main(args=None):
    if args is None:
        args = sys.argv[1:]

    arg_parser = argparse.ArgumentParser(
        prog="bioconvert",
        description="""Convertor infer the
                                         formats from the first command. We do
                                         not scan the input file. Therefore
                                         users must ensure that their input
                                         format files are properly
                                         formatted.""",
        formatter_class=argparse.RawDescriptionHelpFormatter,
        epilog="""
Please visit http://bioconvert.readthedocs.org for more information about the
project or formats available.

Bioconvert is an open source collaborative project. Please feel free to 
join us at https://github/biokit/bioconvert
""")

    arg_parser.add_argument(
        "-v",
        "--verbosity",
        default=bioconvert.logger.level,
        help="Set the outpout verbosity.",
        choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
    )
    arg_parser.add_argument("--no-plot", action="store_true")

    args = arg_parser.parse_args(args)

    from bioconvert.core.registry import Registry
    r = Registry()
    info = r.get_info()

    # The available unique converters
    converters = [x for x in info.items()]

    # the number of methods per converter
    data = [info[k] for k, v in info.items()]

    # the number of formats
    A1 = [x[0] for x in list(r.get_conversions())]
    A2 = [x[1] for x in list(r.get_conversions())]
    formats = set(A1 + A2)

    print("Number of formats: {}".format(len(formats)))
    print("Number of converters: {}".format(len(converters)))
    print("Number of methods : {}".format(sum(data)))

    if args.no_plot is False:
        from pylab import hist, clf, xlabel, grid, show
        clf()
        hist(data, range(17), ec="k", zorder=2, align="left")
        xlabel("Number of methods")
        grid(zorder=-1)
        show()
Beispiel #3
0
# If not, see <http://www.gnu.org/licenses/>.                             #
###########################################################################
"""
Available methods per converter
=====================================

Plot number of implemented methods per converter.


"""
#################################################
#
from bioconvert.core.registry import Registry

r = Registry()
info = r.get_info()

# The available unique converters
converters = [x for x in info.items()]

# the number of methods per converter
data = [info[k] for k, v in info.items()]

# the number of formats
A1 = [x[0] for x in list(r.get_conversions())]
A2 = [x[1] for x in list(r.get_conversions())]
formats = set(A1 + A2)

print("Number of formats: {}".format(len(formats)))
print("Number of converters: {}".format(len(converters)))
print("Number of methods : {}".format(sum(data)))
Beispiel #4
0
# create the sphinx code to include all converters
# author: Thomas Cokelaer 2018
from bioconvert.core.registry import Registry

reg = Registry()

convs = list(reg.get_info())
names = sorted([l.__module__ for l in convs])


def underline(text, character="-"):
    return text + "\n" + character * len(text) + "\n"


print(underline("Reference converters", "="))
print(underline("Summary", "-"))
print(".. autosummary::\n")
for name in names:
    print("\t{}".format(name))

print(underline("All converters documentation", "-"))
print()
for name in names:
    print("""
.. automodule:: {}
    :members:
    :synopsis:
    :private-members:""".format(name))