예제 #1
0
def main(annotation_file, annotation_type, verbose):
    from genmod import logger
    from genmod.log import init_log
    init_log(logger, loglevel="DEBUG")
    print(annotation_file)
    gene_trees, exon_trees = parse_annotations(annotation_file, annotation_type)
    print(gene_trees.keys())
    print(exon_trees.keys())
예제 #2
0
def cli(context, logfile, verbose):
    """Tool for annotating and analyzing genetic variants in the vcf format.\n
        For more information, please run:
        genmod COMMAND --help \n
        """
    from genmod import logger
    from genmod.log import init_log, LEVELS
    loglevel = LEVELS.get(min(verbose,2), "WARNING")
    
    init_log(logger, logfile, loglevel)
예제 #3
0
def read_config(config_file, outfile, loglevel):
    """Parse the config file and print it to the output."""

    from genmod import logger
    from genmod.log import init_log
    init_log(logger, loglevel='DEBUG')

    logger.info("Reading Config File: {0}".format(config_file))

    config_reader = ConfigParser(config_file)

    for plugin in config_reader.plugins:
        logger.info("Found plugin:{0}".format(plugin))
        logger.info("{0}: {1}".format(
            plugin,config_reader.plugins[plugin])
            )

    for category in config_reader.categories:
        logger.info("Category {0}: {1}".format(
            category, config_reader.categories[category]
        ))
예제 #4
0
from genmod.commands import models_command
from click.testing import CliRunner

ANNOTATED_VCF_FILE = "tests/fixtures/test_vcf_annotated.vcf"
VCF_FILE = "tests/fixtures/test_vcf_regions.vcf"
FAMILY_FILE = "tests/fixtures/recessive_trio.ped"
BAD_FAMILY_FILE = "tests/fixtures/annotate_models/one_ind.ped"
EMPTY_VCF_FILE = "tests/fixtures/empty.vcf"

from genmod import logger
from genmod.log import init_log
init_log(logger, loglevel="INFO")


def test_genmod_annotate_models_no_family():
    """docstring for test_genmod_annotate_models"""
    runner = CliRunner()
    result = runner.invoke(models_command, [VCF_FILE])
    
    # This should fail since there is no family file
    assert result.exit_code == 1

def test_genmod_annotate_models():
    """docstring for test_genmod_annotate_models"""
    runner = CliRunner()
    result = runner.invoke(models_command, [
        VCF_FILE, 
        '-f',
        FAMILY_FILE 
        ]
    )
예제 #5
0
            else:
                if value < threshold:
                    keep_variant = True
        else:
            if not discard:
                keep_variant = True

        if keep_variant:
            logger.debug("Keeping variant")
            nr_of_passed_variants += 1
            print_variant(variant_line=variant,
                          outfile=outfile,
                          mode='vcf',
                          silent=silent)
        else:
            logger.debug("Discarding variant")

    logger.info("Number of variants in file {0}".format(nr_of_variants))
    logger.info(
        "Number of variants passing filter {0}".format(nr_of_passed_variants))
    logger.info(
        "Number of variants filtered {0}".format(nr_of_variants -
                                                 nr_of_passed_variants))


if __name__ == '__main__':
    from genmod.log import init_log
    from genmod import logger
    init_log(logger, loglevel="DEBUG")
    filter()
예제 #6
0
            else:
                if value < threshold:
                    keep_variant = True
        else:
            if not discard:
                keep_variant = True
        
        if keep_variant:
            logger.debug("Keeping variant")
            nr_of_passed_variants += 1
            print_variant(
                variant_line=variant, 
                outfile=outfile, 
                mode='vcf', 
                silent=silent
            )
        else:
            logger.debug("Discarding variant")
            

    logger.info("Number of variants in file {0}".format(nr_of_variants))
    logger.info("Number of variants passing filter {0}".format(nr_of_passed_variants))
    logger.info("Number of variants filtered {0}".format(
        nr_of_variants - nr_of_passed_variants))

if __name__ == '__main__':
    from genmod.log import init_log
    from genmod import logger
    init_log(logger, loglevel="DEBUG")
    filter()