示例#1
0
文件: cli.py 项目: J35P312/rhocall
def call(ctx, vcf, max_hets, max_het_fraction, minimum_homs, shortest_block,
         flag_upd_at_fraction, individual, block_constant, verbose):
    """Call runs of autozygosity. (deprecated: use bcftools roh instead."""
    loglevel = LEVELS.get(min(verbose, 3))
    configure_stream(level=loglevel)

    proband_vcf = VCF(vcf)

    if len(proband_vcf.samples) > 1:
        try:
            individual = int(individual)
        except TypeError:
            logger.warning("Please specify which individual to check.")
            ctx.abort()
    else:
        individual = 0

    output_bed_header()

    run_rhocall(proband_vcf=proband_vcf,
                block_constant=block_constant,
                max_hets=max_hets,
                max_het_fraction=max_het_fraction,
                minimum_homs=minimum_homs,
                shortest_block=shortest_block,
                flag_UPD_at_fraction=flag_upd_at_fraction,
                individual=individual)
示例#2
0
文件: cli.py 项目: J35P312/rhocall
def aggregate(roh, quality_threshold, output, verbose):
    """Aggregate runs of autozygosity from rhofile into windowed rho BED file.
    Accepts a bcftools roh style TSV-file with CHR,POS,AZ,QUAL."""
    loglevel = LEVELS.get(min(verbose, 3))
    configure_stream(level=loglevel)

    logger.info("Running rhocall aggregate {0}".format(__version__))

    run_aggregate(roh=roh, quality_threshold=quality_threshold, output=output)
示例#3
0
文件: cli.py 项目: J35P312/rhocall
def tally(roh, quality_threshold, flag_upd_at_fraction, output, verbose):
    """Tally runs of autozygosity from rhofile.
    Accepts a bcftools roh style TSV-file with CHR,POS,AZ,QUAL."""
    loglevel = LEVELS.get(min(verbose, 3))
    configure_stream(level=loglevel)

    logger.info("Running rhocall tally {0}".format(__version__))

    run_tally(roh=roh,
              quality_threshold=quality_threshold,
              flag_upd_at_fraction=flag_upd_at_fraction,
              output=output)
示例#4
0
文件: cli.py 项目: J35P312/rhocall
def annotate(vcf, roh, bed, v14, quality_threshold, flag_upd_at_fraction,
             output, verbose):
    """Markup VCF file using rho-calls. Use BED file to mark all variants in AZ 
    windows. Alternatively, use a bcftools v>=1.4 file with RG entries to mark 
    all vars. With the --no-v14 flag, use an older bcftools v<=1.2 style roh TSV
    to mark only selected AZ variants. Roh is broken in bcftools v1.3 
    - do not use."""
    loglevel = LEVELS.get(min(verbose, 3))
    configure_stream(level=loglevel)

    proband_vcf = VCF(vcf)

    # add this command to VCF header

    ## This is for logging the command line string ##
    frame = inspect.currentframe()
    args, _, _, values = inspect.getargvalues(frame)
    argument_list = [
        i + '=' + str(values[i]) for i in values
        if values[i] and i not in ['frame']
    ]

    logger.info("Running rhocall annotate  {0}".format(__version__))
    logger.debug("Arguments: {0}".format(', '.join(argument_list)))

    ## add additional tags to VCF header
    proband_vcf.add_to_header('##rhocall_version={0}'.format(__version__))
    proband_vcf.add_to_header("##rhocall_arguments={0}".format(
        ', '.join(argument_list)))

    if roh and not bed and not v14:
        run_annotate_var(proband_vcf=proband_vcf,
                         roh=roh,
                         quality_threshold=quality_threshold,
                         flag_upd_at_fraction=flag_upd_at_fraction,
                         output=output)
    elif roh and v14 and not bed:
        run_annotate_rg(proband_vcf=proband_vcf,
                        bcfroh=roh,
                        quality_threshold=quality_threshold,
                        flag_upd_at_fraction=flag_upd_at_fraction,
                        output=output)
    elif bed and not roh:
        run_annotate(proband_vcf=proband_vcf,
                     bed=bed,
                     quality_threshold=quality_threshold,
                     flag_upd_at_fraction=flag_upd_at_fraction,
                     output=output)
    else:
        click.echo("""Cannot use both BED and ROH at once. Please apply 
                    them sequentially instead.""")
示例#5
0
文件: cli.py 项目: yyxql/rhocall
def viz(vcf, out_dir, wig, pointsize, rho, minsnv, maxsnv, minaf, maxaf, aftag,
        minqual, mnv, window, rsid, filter, verbose):
    """Plot binned zygosity and RHO-regions."""

    loglevel = LEVELS.get(min(verbose, 3))
    configure_stream(level=loglevel)

    if not os.access(out_dir, os.F_OK):
        os.mkdir(out_dir)

    binned_zygosity = generate_bins(vcf, window, filter, mnv, minqual, rsid,
                                    minaf, aftag, maxaf, minsnv)
    roh = extract_roh(rho)
    if wig:
        out_file_basename = out_dir + "/output"
        generate_wig(binned_zygosity, roh, window, out_file_basename)
    else:
        generate_plots(binned_zygosity, roh, window, pointsize, out_dir)