Beispiel #1
0
def popexist_db(existing_db, exon_lines):
    result = link_elements(exon_lines)
    existing_db.add(*result.models)
    result = load_transcripts(exon_lines, sample_id="sample", group_id="group")
    existing_db.add(result.sample)
    existing_db.add(*result.models)
    existing_db.save()
    yield existing_db
Beispiel #2
0
def popexist_db(existing_db, exon_lines):
    result = link_elements(exon_lines)
    existing_db.add(*result.models)
    result = load_transcripts(exon_lines, sample_id='sample', group_id='group')
    existing_db.add(result.sample)
    existing_db.add(*result.models)
    existing_db.save()
    yield existing_db
Beispiel #3
0
def populated_db(chanjo_db, exon_lines):
    exon_lines = list(exon_lines)
    result = link_elements(exon_lines)
    chanjo_db.add(*result.models)
    results = [
        load_transcripts(exon_lines, sample_id="sample", group_id="group"),
        load_transcripts(exon_lines, sample_id="sample2", group_id="group"),
    ]
    for result in results:
        chanjo_db.add(result.sample)
        chanjo_db.add(*result.models)
    chanjo_db.save()
    yield chanjo_db
Beispiel #4
0
def populated_db(chanjo_db, exon_lines):
    exon_lines = list(exon_lines)
    result = link_elements(exon_lines)
    chanjo_db.add(*result.models)
    results = [
        load_transcripts(exon_lines, sample_id='sample', group_id='group'),
        load_transcripts(exon_lines, sample_id='sample2', group_id='group')
    ]
    for result in results:
        chanjo_db.add(result.sample)
        chanjo_db.add(*result.models)
    chanjo_db.save()
    yield chanjo_db
Beispiel #5
0
def link(context, bed_stream):
    """Link related genomic elements."""
    chanjo_db = ChanjoDB(uri=context.obj['database'])
    result = link_elements(bed_stream)
    with click.progressbar(result.models, length=result.count,
                           label='adding transcripts') as bar:
        for tx_model in bar:
            chanjo_db.add(tx_model)
    try:
        chanjo_db.save()
    except IntegrityError:
        LOG.exception('elements already linked?')
        chanjo_db.session.rollback()
        click.echo("use 'chanjo db setup --reset' to re-build")
        context.abort()
Beispiel #6
0
def link(context, bed_stream):
    """Link related genomic elements."""
    chanjo_db = ChanjoDB(uri=context.obj['database'])
    result = link_elements(bed_stream)
    with click.progressbar(result.models,
                           length=result.count,
                           label='adding transcripts') as bar:
        for tx_model in bar:
            chanjo_db.add(tx_model)
    try:
        chanjo_db.save()
    except IntegrityError:
        LOG.exception('elements already linked?')
        chanjo_db.session.rollback()
        click.echo("use 'chanjo db setup --reset' to re-build")
        context.abort()
Beispiel #7
0
def test_process(bed_lines):
    result = link.link_elements(bed_lines)
    models = list(result.models)
    assert result.count == 5  # 5 transcripts