예제 #1
0
def main():
    """cblaster entry point."""
    args = parsers.parse_args(sys.argv[1:])

    if args.debug:
        LOG.setLevel(logging.DEBUG)

    if args.subcommand == "makedb":
        makedb(args.genbanks, args.filename, args.indent)

    elif args.subcommand == "search":
        cblaster(
            query_file=args.query_file,
            query_ids=args.query_ids,
            mode=args.mode,
            json_db=args.json_db,
            database=args.database,
            gap=args.gap,
            unique=args.unique,
            min_hits=args.min_hits,
            require=args.require,
            min_identity=args.min_identity,
            min_coverage=args.min_coverage,
            max_evalue=args.max_evalue,
            entrez_query=args.entrez_query,
            output=args.output,
            output_hide_headers=args.output_hide_headers,
            output_delimiter=args.output_delimiter,
            output_decimals=args.output_decimals,
            binary=args.binary,
            binary_hide_headers=args.binary_hide_headers,
            binary_delimiter=args.binary_delimiter,
            binary_key=args.binary_key,
            binary_attr=args.binary_attr,
            binary_decimals=args.binary_decimals,
            rid=args.rid,
            session_file=args.session_file,
            indent=args.indent,
            recompute=args.recompute,
            plot=args.plot,
            blast_file=args.blast_file,
            ipg_file=args.ipg_file,
            hitlist_size=args.hitlist_size,
        )

    elif args.subcommand == "gui":
        from cblaster.gui.main import cblaster_gui
        cblaster_gui()

    elif args.subcommand == "gne":
        gne(
            args.session,
            args.output,
            max_gap=args.max_gap,
            samples=args.samples,
            scale=args.scale,
            delimiter=args.delimiter,
            hide_headers=args.hide_headers,
            decimals=args.decimals,
            plot=args.plot,
        )

    elif args.subcommand == "extract":
        extract.extract(
            args.session,
            download=args.download,
            output=args.output,
            queries=args.queries,
            organisms=args.organisms,
            scaffolds=args.scaffolds,
            name_only=args.name_only,
            delimiter=args.delimiter,
        )
예제 #2
0
파일: main.py 프로젝트: gamcil/cblaster
def main():
    """cblaster entry point."""
    args = parsers.parse_args(sys.argv[1:])

    if args.debug:
        LOG.setLevel(logging.DEBUG)

    if args.subcommand == "config":
        if not args.email and not args.api_key:
            LOG.info(
                "No e-mail or API key specified; if this is your first time"
                " running cblaster config, please make sure you provide one.")
        config.write_config_file(
            email=args.email,
            api_key=args.api_key,
            max_tries=args.max_tries,
        )
        return

    # Set BioPython Entrez parameters
    set_entrez()

    if args.subcommand == "makedb":
        database.makedb(
            args.paths,
            database=args.name,
            cpus=args.cpus,
            batch=args.batch,
            force=args.force,
        )

    elif args.subcommand == "search":
        cblaster(
            query_file=args.query_file,
            query_ids=args.query_ids,
            query_profiles=args.query_profiles,
            mode=args.mode,
            databases=args.database,
            database_pfam=args.database_pfam,
            gap=args.gap,
            unique=args.unique,
            min_hits=args.min_hits,
            require=args.require,
            percentage=args.percentage,
            min_identity=args.min_identity,
            min_coverage=args.min_coverage,
            max_evalue=args.max_evalue,
            entrez_query=args.entrez_query,
            output=args.output,
            output_hide_headers=args.output_hide_headers,
            output_delimiter=args.output_delimiter,
            output_decimals=args.output_decimals,
            output_sort_clusters=args.sort_clusters,
            binary=args.binary,
            binary_hide_headers=args.binary_hide_headers,
            binary_delimiter=args.binary_delimiter,
            binary_key=args.binary_key,
            binary_attr=args.binary_attr,
            binary_decimals=args.binary_decimals,
            rid=args.rid,
            session_file=args.session_file,
            indent=args.indent,
            recompute=args.recompute,
            plot=args.plot,
            max_plot_clusters=args.max_plot_clusters,
            blast_file=args.blast_file,
            ipg_file=args.ipg_file,
            hitlist_size=args.hitlist_size,
            cpus=args.cpus,
            intermediate_genes=args.intermediate_genes,
            intermediate_gene_distance=args.max_distance,
            intermediate_max_clusters=args.maximum_clusters,
            testing=args.testing,
        )

    elif args.subcommand == "gui":
        from cblaster.gui.main import cblaster_gui

        cblaster_gui()

    elif args.subcommand == "gne":
        gne(
            args.session,
            args.output,
            max_gap=args.max_gap,
            samples=args.samples,
            scale=args.scale,
            delimiter=args.delimiter,
            hide_headers=args.hide_headers,
            decimals=args.decimals,
            plot=args.plot,
            testing=args.testing,
        )

    elif args.subcommand == "extract":
        extract.extract(
            args.session,
            extract_seqs=args.extract_sequences,
            output=args.output,
            queries=args.queries,
            organisms=args.organisms,
            scaffolds=args.scaffolds,
            name_only=args.name_only,
            delimiter=args.delimiter,
        )

    elif args.subcommand == "extract_clusters":
        extract_clusters.extract_clusters(
            args.session,
            args.output,
            prefix=args.prefix,
            cluster_numbers=args.clusters,
            score_threshold=args.score_threshold,
            organisms=args.organisms,
            scaffolds=args.scaffolds,
            format_=args.format,
            max_clusters=args.maximum_clusters,
        )

    elif args.subcommand == "plot_clusters":
        plot_clusters.plot_clusters(
            session=args.session,
            cluster_numbers=args.clusters,
            score_threshold=args.score_threshold,
            organisms=args.organisms,
            scaffolds=args.scaffolds,
            plot_outfile=args.output,
            max_clusters=args.maximum_clusters,
            testing=args.testing,
        )