コード例 #1
0
def main():
    logging.basicConfig(level=logging.DEBUG,
                        format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
    parser = argparse.ArgumentParser()
    parser.add_argument("-p", dest="num_processes", type=int, default=1)
    parser.add_argument("--pattern", dest="pattern", default=r'{{CHROM}}.phastCons46way.bw')
    parser.add_argument('--window-sizes', dest='window_sizes', default='30,60,90,150,300,600,900,1500,3000')
    parser.add_argument('--bed', dest='bed_file', default=None)
    parser.add_argument("bigwig_file_dir")
    args = parser.parse_args()
    if which(BIGWIG_TO_BEDGRAPH_BIN) is None:
        parser.error('bigWigToBedGraph binary not found in PATH')
    if args.bed_file is not None:
        if not os.path.exists(args.bed_file):
            parser.error('bed file %s not found' % (args.bed_file))
    else:
        parser.error('specify a bed file using --bed')
    window_sizes = map(int, args.window_sizes.split(','))
    num_processes = max(1, args.num_processes)
    # find bigwig files
    chrom_bigwig_dict = find_bigwig_files(args.bigwig_file_dir, args.pattern)
    if num_processes > 1:
        conservation_parallel(args.bed_file, window_sizes, chrom_bigwig_dict, num_processes)
    else:
        conservation_serial(args.bed_file, window_sizes, chrom_bigwig_dict)
    return 0
コード例 #2
0
def main():
    logging.basicConfig(
        level=logging.DEBUG,
        format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
    parser = argparse.ArgumentParser()
    parser.add_argument("-p", dest="num_processes", type=int, default=1)
    parser.add_argument("--pattern",
                        dest="pattern",
                        default=r'{{CHROM}}.phastCons46way.bw')
    parser.add_argument('--window-sizes',
                        dest='window_sizes',
                        default='30,60,90,150,300,600,900,1500,3000')
    parser.add_argument('--bed', dest='bed_file', default=None)
    parser.add_argument("bigwig_file_dir")
    args = parser.parse_args()
    if which(BIGWIG_TO_BEDGRAPH_BIN) is None:
        parser.error('bigWigToBedGraph binary not found in PATH')
    if args.bed_file is not None:
        if not os.path.exists(args.bed_file):
            parser.error('bed file %s not found' % (args.bed_file))
    else:
        parser.error('specify a bed file using --bed')
    window_sizes = map(int, args.window_sizes.split(','))
    num_processes = max(1, args.num_processes)
    # find bigwig files
    chrom_bigwig_dict = find_bigwig_files(args.bigwig_file_dir, args.pattern)
    if num_processes > 1:
        conservation_parallel(args.bed_file, window_sizes, chrom_bigwig_dict,
                              num_processes)
    else:
        conservation_serial(args.bed_file, window_sizes, chrom_bigwig_dict)
    return 0
コード例 #3
0
def main():
    logging.basicConfig(
        level=logging.DEBUG,
        format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
    parser = argparse.ArgumentParser()
    parser.add_argument("-p", dest="num_processes", type=int, default=1)
    parser.add_argument("-t", dest="sig_threshold", type=float, default=2.0)
    parser.add_argument('--window-sizes', dest='window_sizes', default='')
    parser.add_argument("--pattern",
                        dest="pattern",
                        default=r'{{CHROM}}.phyloP46way.bw')
    parser.add_argument('--bed', dest='bed_file')
    parser.add_argument("bigwig_file_dir")
    args = parser.parse_args()
    num_processes = max(1, args.num_processes)
    sig_threshold = args.sig_threshold
    if args.window_sizes:
        window_sizes = map(int, args.window_sizes.split(','))
    else:
        window_sizes = []
    if which(BIGWIG_TO_BEDGRAPH_BIN) is None:
        parser.error('bigWigToBedGraph binary not found in PATH')
    if args.bed_file is not None:
        if not os.path.exists(args.bed_file):
            parser.error('bed file %s not found' % (args.bed_file))
    else:
        parser.error('specify a bed file using --bed')
    # find bigwig files
    logging.info("Indexing bigWig files at path %s" % (args.bigwig_file_dir))
    chrom_bigwig_dict = find_bigwig_files(args.bigwig_file_dir, args.pattern)
    header_fields = ['name', 'mean', 'frac', 'length']
    header_fields.extend(map(str, [('window%d' % x) for x in window_sizes]))
    print '\t'.join(header_fields)
    if num_processes > 1:
        conservation_parallel(args.bed_file, chrom_bigwig_dict, sig_threshold,
                              window_sizes, num_processes)
    else:
        conservation_serial(args.bed_file, chrom_bigwig_dict, sig_threshold,
                            window_sizes, num_processes)
    return 0
コード例 #4
0
def main():
    logging.basicConfig(level=logging.DEBUG,
                        format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
    parser = argparse.ArgumentParser()
    parser.add_argument("-p", dest="num_processes", type=int, default=1)
    parser.add_argument("-t", dest="sig_threshold", type=float, default=2.0)
    parser.add_argument('--window-sizes', dest='window_sizes', default='')
    parser.add_argument("--pattern", dest="pattern", default=r'{{CHROM}}.phyloP46way.bw')
    parser.add_argument('--bed', dest='bed_file')
    parser.add_argument("bigwig_file_dir")
    args = parser.parse_args()
    num_processes = max(1, args.num_processes)
    sig_threshold = args.sig_threshold
    if args.window_sizes:
        window_sizes = map(int, args.window_sizes.split(','))
    else:
        window_sizes = []
    if which(BIGWIG_TO_BEDGRAPH_BIN) is None:
        parser.error('bigWigToBedGraph binary not found in PATH')
    if args.bed_file is not None:
        if not os.path.exists(args.bed_file):
            parser.error('bed file %s not found' % (args.bed_file))
    else:
        parser.error('specify a bed file using --bed')
    # find bigwig files
    logging.info("Indexing bigWig files at path %s" % (args.bigwig_file_dir))
    chrom_bigwig_dict = find_bigwig_files(args.bigwig_file_dir, args.pattern)
    header_fields = ['name', 'mean', 'frac', 'length']
    header_fields.extend(map(str, [('window%d' % x) for x in window_sizes]))
    print '\t'.join(header_fields)
    if num_processes > 1:
        conservation_parallel(args.bed_file, chrom_bigwig_dict, sig_threshold, 
                              window_sizes, num_processes)
    else:
        conservation_serial(args.bed_file, chrom_bigwig_dict, sig_threshold,
                            window_sizes, num_processes)
    return 0