コード例 #1
0
ファイル: do.py プロジェクト: Clinical-Genomics/mip2scout
def load_coverage(chanjo_db, mip_case, group_id, threshold=None, use_family=False):
    """Load coverage for a case."""
    for sample_id, bed_path in mip_case.chanjo_sample_outputs():
        if use_family:
            sample_id = "{}-{}".format(mip_case.family_id, sample_id)
        logger.info("load coverage for %s", sample_id)
        if chanjo_db.query(ChanjoSample).filter_by(id=sample_id).first():
            raise ChanjoSampleLoadedError(sample_id)
        with open(bed_path, "r") as bed_stream:
            coverage.load(chanjo_db, bed_stream, source=bed_path, group=group_id, sample=sample_id, threshold=threshold)
コード例 #2
0
def test_load(chanjo_db):
    with open('tests/fixtures/coverage/ADM1136A1.bed') as bed_stream:
        coverage.load(chanjo_db, bed_stream, group='test-group')

    sample_obj = chanjo_db.query(Sample).filter_by(sample_id='ADM1136A1').one()
    assert sample_obj.sample_id == 'ADM1136A1'
    assert len(sample_obj.exon_stats) == 70 * 6

    # test loading the sample samples again
    # expect just to work without changed results
    with open('tests/fixtures/coverage/ADM1136A1.bed') as bed_stream:
        coverage.load(chanjo_db, bed_stream)
    assert chanjo_db.samples(group_id='test-group').count() == 1