<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-


import sys
import os
import subprocess
import shutil
import argparse
import io
from datetime import datetime
from goatools import obo_parser
from Bio import SeqIO
from natsort import natsorted
import pandas as pd
import funannotate.library as lib
import funannotate.resources as resources


def AnnotationFound(input):
    # test if the list of dictionaries has annotation
    test = False
    for x in input:
        if len(x) > 0:
            test = True
    return test


def main(args):
        # setup menu with argparse
    class MyFormatter(argparse.ArgumentDefaultsHelpFormatter):
        def __init__(self, prog):
            super(MyFormatter, self).__init__(prog, max_help_position=48)
    parser = argparse.ArgumentParser(prog='funannotate-compare.py', usage="%(prog)s [options] genome1.gbk genome2.gbk",
                                     description='''Funannotate comparative genomics.''',
                                     epilog="""Written by <NAME> (2016) <EMAIL>""",
                                     formatter_class=MyFormatter)
    parser.add_argument('-i', '--input', nargs='+',
                        help='List of funannotate genome folders or GBK files')
    parser.add_argument('-o', '--out', default='funannotate_compare',
                        help='Name of output folder')
    parser.add_argument('--cpus', default=2, type=int,
                        help='Number of CPUs to utilize')
    parser.add_argument('--go_fdr', default=0.05, type=float,
                        help='P-value for FDR GO-enrichment')
    parser.add_argument('--heatmap_stdev', default=1.0, type=float,
                        help='Standard Deviation threshold for heatmap retention')
    parser.add_argument('--bootstrap', default=100, type=int,
                        help='Number of bootstraps to run with RAxML')
    parser.add_argument('--num_orthos', default=500, type=int,
                        help='Number of Single-copy orthologs to run with RAxML')
    parser.add_argument('--outgroup',
                        help='Name of species for RAxML outgroup')
    parser.add_argument('--eggnog_db', default='fuNOG', help='EggNog database')
    parser.add_argument('--run_dnds', choices=['estimate', 'full'],
                        help='Run dN/dS analysis with codeML for each ortholog (long runtime)')
    parser.add_argument('--proteinortho',
                        help='Pre-computed ProteinOrtho POFF')
    parser.add_argument('--ml_method', default='iqtree',
                        choices=['raxml', 'iqtree'], help='ML method')
    parser.add_argument('-d', '--database',
                        help='Path to funannotate database, $FUNANNOTATE_DB')
    args = parser.parse_args(args)

    parentdir = os.path.join(os.path.dirname(__file__))
    
    # create log file
    log_name = os.path.join(args.out, 'funannotate-compare.log')
    if os.path.isfile(log_name):
        os.remove(log_name)

    # initialize script, log system info and cmd issue at runtime
    lib.setupLogging(log_name)
    cmd_args = " ".join(sys.argv)+'\n'
    lib.log.debug(cmd_args)
    print("-------------------------------------------------------")
    lib.SystemInfo()

    # setup funannotate DB path
    if args.database:
        FUNDB = args.database
    else:
        try:
            FUNDB = os.environ["FUNANNOTATE_DB"]
        except KeyError:
            lib.log.error(
                'Funannotate database not properly configured, run funannotate setup.')
            sys.exit(1)

    # check database sources, so no problems later
    sources = [os.path.join(FUNDB, 'Pfam-A.clans.tsv'),
               os.path.join(FUNDB, 'interpro.tsv'),
               os.path.join(FUNDB, 'go.obo')]
    if not all([os.path.isfile(f) for f in sources]):
        lib.log.error(
            'Database files not found in %s, run funannotate database and/or funannotate setup' % FUNDB)<commit_msg>remove the double logging error<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-


import sys
import os
import subprocess
import shutil
import argparse
import io
from datetime import datetime
from goatools import obo_parser
from Bio import SeqIO
from natsort import natsorted
import pandas as pd
import funannotate.library as lib
import funannotate.resources as resources


def AnnotationFound(input):
    # test if the list of dictionaries has annotation
    test = False
    for x in input:
        if len(x) > 0:
            test = True
    return test


def main(args):
        # setup menu with argparse
    class MyFormatter(argparse.ArgumentDefaultsHelpFormatter):
        def __init__(self, prog):
            super(MyFormatter, self).__init__(prog, max_help_position=48)
    parser = argparse.ArgumentParser(prog='funannotate-compare.py', usage="%(prog)s [options] genome1.gbk genome2.gbk",
                                     description='''Funannotate comparative genomics.''',
                                     epilog="""Written by <NAME> (2016) <EMAIL>""",
                                     formatter_class=MyFormatter)
    parser.add_argument('-i', '--input', nargs='+',
                        help='List of funannotate genome folders or GBK files')
    parser.add_argument('-o', '--out', default='funannotate_compare',
                        help='Name of output folder')
    parser.add_argument('--cpus', default=2, type=int,
                        help='Number of CPUs to utilize')
    parser.add_argument('--go_fdr', default=0.05, type=float,
                        help='P-value for FDR GO-enrichment')
    parser.add_argument('--heatmap_stdev', default=1.0, type=float,
                        help='Standard Deviation threshold for heatmap retention')
    parser.add_argument('--bootstrap', default=100, type=int,
                        help='Number of bootstraps to run with RAxML')
    parser.add_argument('--num_orthos', default=500, type=int,
                        help='Number of Single-copy orthologs to run with RAxML')
    parser.add_argument('--outgroup',
                        help='Name of species for RAxML outgroup')
    parser.add_argument('--eggnog_db', default='fuNOG', help='EggNog database')
    parser.add_argument('--run_dnds', choices=['estimate', 'full'],
                        help='Run dN/dS analysis with codeML for each ortholog (long runtime)')
    parser.add_argument('--proteinortho',
                        help='Pre-computed ProteinOrtho POFF')
    parser.add_argument('--ml_method', default='iqtree',
                        choices=['raxml', 'iqtree'], help='ML method')
    parser.add_argument('-d', '--database',
                        help='Path to funannotate database, $FUNANNOTATE_DB')
    args = parser.parse_args(args)

    parentdir = os.path.join(os.path.dirname(__file__))


    # setup funannotate DB path
    if args.database:
        FUNDB = args.database
    else:
        try:
            FUNDB = os.environ["FUNANNOTATE_DB"]
        except KeyError:
            print('ERROR: Funannotate database not properly configured, run funannotate setup.')
            sys.exit(1)

    # check database sources, so no problems later
    sources = [os.path.join(FUNDB, 'Pfam-A.clans.tsv'),
               os.path.join(FUNDB, 'interpro.tsv'),
               os.path.join(FUNDB, 'go.obo')]
    if not all([os.path.isfile(f) for f in sources]):
        print('ERROR: Database files not found in %s, run funannotate database and/or funannotate setup' % FUNDB)
{'fraction_non_alphanumeric': 0.1214219145253628, 'fraction_numerical': 0.006124350951937159, 'mean_word_length': 2.335701598579041, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1512716', 'n_tokens_mistral': 2240, 'n_tokens_neox': 2116, 'n_words': 554}