Esempio n. 1
0
def region_page(chrom, start, stop):
    db = get_db()
    try:
        _log()
        try:
            start = int(start)
        except:
            return bad_request_page('The start position {!s} is not integer.'.format(start))
        try: 
            stop = int(stop)
        except:
            return bad_request_page('The stop position {!s} is not integer.'.format(stop))
        if start > stop:
            return bad_request_page("The region '{chrom}-{start}-{stop}' stops before it starts. Did you mean '{chrom}-{stop}-{start}'?".format(chrom = chrom, start = start, stop = stop))
        if stop-start > MAX_REGION_LENGTH:
            return bad_request_page("The region '{chrom}-{start}-{stop}' is {:,} bases. We only accept regions shorter than {:,} bases.".format(stop - start, MAX_REGION_LENGTH, chrom = chrom, start = start, stop = stop))
        if start == stop:
            start -= 20
            stop += 20
        intervalset = IntervalSet.from_chrom_start_stop(chrom, start, stop)
        genes = TranscriptSet.from_chrom_start_stop(db, chrom, start, stop).genes
        return render_template(
            'region.html',
            intervalset = intervalset, genes = genes, csq = Consequence.as_obj,
        )
    except: _err(); abort(500)
Esempio n. 2
0
def region_variants_subset_api(chrom, start, stop):
    try:
        start, stop = int(start), int(stop)
        assert stop - start <= MAX_REGION_LENGTH
        intervalset = IntervalSet.from_chrom_start_stop(chrom, start, stop)
        return _get_variants_subset_response_for_intervalset(intervalset)
    except:
        _err()
        abort(500)
Esempio n. 3
0
def region_coverage_api(chrom, start, stop):
    try:
        start, stop = int(start), int(stop)
        assert stop - start <= MAX_REGION_LENGTH
        intervalset = IntervalSet.from_chrom_start_stop(chrom, start, stop)
        return jsonify(
            get_coverage_handler().get_coverage_for_intervalset(intervalset))
    except:
        _err()
        abort(500)
Esempio n. 4
0
def region_summary_api(chrom, start, stop):
    try:
        start, stop = int(start), int(stop)
        assert stop - start <= MAX_REGION_LENGTH
        intervalset = IntervalSet.from_chrom_start_stop(chrom, start, stop)
        return jsonify(
            lookups.get_summary_for_intervalset(get_db(), intervalset))
    except:
        _err()
        abort(500)
Esempio n. 5
0
def download_region_variants(chrom, start, stop):
    try:
        start, stop = int(start), int(stop)
        assert stop - start <= MAX_REGION_LENGTH
        intervalset = IntervalSet.from_chrom_start_stop(chrom, start, stop)
        return _get_variants_csv_for_intervalset(
            intervalset, 'chr{}-{}-{}.csv'.format(chrom, start, stop))
    except:
        _err()
        abort(500)