コード例 #1
0
def get_variants(chromosome, start, end):
    """
    Return all variants between [chrom, start) and (chrom, end]
    """
    q = db_session.query(orm.Variant)
    q = q.filter_by(chromosome=chromosome).filter(and_(start >= start, start <= end))
    return [orm.dump(p) for p in q]
コード例 #2
0
def get_variants_by_individual(individual_id):
    """
    Return variants that have been called in an individual
    """
    ind_id = individual_id
    ind = db_session.query(orm.Individual).filter(orm.Individual.id == ind_id).one_or_none()
    if not ind:
        return NoContent, 404

    variants = [call.variant for call in ind.calls if call.variant is not None]
    return [orm.dump(v) for v in variants], 200
コード例 #3
0
def get_individuals_by_variant(variant_id):
    """
    Return variants that have been called in an individual
    """
    var_id = variant_id
    var = db_session.query(orm.Variant).filter(orm.Variant.id == var_id).one_or_none()
    if not var:
        return NoContent, 404

    individuals = [call.individual for call in var.calls if call.individual is not None]
    return [orm.dump(i) for i in individuals], 200
コード例 #4
0
def get_calls():
    """
    Return all calls
    """
    q = db_session.query(orm.Call)
    return [orm.dump(p) for p in q]
コード例 #5
0
def get_individuals():
    """
    Return all individuals
    """
    q = db_session.query(orm.Individual)
    return [orm.dump(p) for p in q]