Beispiel #1
0
def test_all():
    from genelocator import get_genelocator
    gl = get_genelocator(grch_build=38,
                         gencode_version=32,
                         only_codinglike_genetypes=True)
    gene = gl.at('chr19', 1234)
    assert gene == [('ENSG00000176695.8', '19', 107104, 117102, 'OR4F17')]
def main():
    # TODO (future) Creating the tree is the slow step. A potential performance enhancement would be to allow searching
    #   for multiple positions from a single run of the command line (so we get many searches but pay startup penalty once)
    args = parse_args()
    gencode_version = args.version
    try:
        genelocator = get_genelocator(
            args.build,
            gencode_version=gencode_version,
            common_genetypes_only=args.common_genetypes_only,
            auto_fetch=args.auto_fetch)
    except gene_exc.UnsupportedDatasetException:
        logger.error('No source found for the requested dataset; exiting')
        sys.exit(1)

    for gene in genelocator.at(args.chromosome, args.position):
        print('{chrom}\t{start}\t{end}\t{ensg}\t{symbol}'.format(**gene))
Beispiel #3
0
def build38finder():
    # Mostly, tests are slow because of the time to build this tree. It's immutable, so only do this 1x per run
    return get_genelocator('GRCh38',
                           gencode_version=32,
                           common_genetypes_only=True)
Beispiel #4
0
import json
import sqlite3

from flask import Blueprint, abort, jsonify, redirect, request, url_for
from genelocator import exception as gene_exc, get_genelocator  # type: ignore
from zorp import readers  # type: ignore

from .. import model
from ..api.format import (
    TISSUES_PER_STUDY,
    TISSUES_TO_SYSTEMS,
    position_to_variant_id,
)
from .format import gencodeParser, gencodeTranscriptParser

gl = get_genelocator("GRCh38", gencode_version=32, coding_only=True)

views_blueprint = Blueprint("frontend", __name__, template_folder="templates")


@views_blueprint.route("/region/", methods=["GET"])
def region_view():
    """Region view"""
    # The canonical form of this view uses start and end query params
    #  However, for convenience, some plots will want to link by a single position.
    # We implement this as a simple redirect that otherwise preserves the query string.
    pos = request.args.get("position", None)
    if pos:
        args = request.args.copy()
        pos = int(pos)
        args.pop("position")
Beispiel #5
0
 def test_creates_locator_from_filepath(self):
     """This should work (measured by not raising an exception)"""
     filepath = assets._get_cache_filepath('GRCh37', 32, 'common_genetypes')
     get_genelocator(filepath)