Esempio n. 1
0
def genotype(context, force):
    """Upload results from sequencing to the genotype platform."""
    mip_case = context.obj["case"]
    store = TabooDatabase(context.obj["taboo_db"])

    with codecs.open(context.obj["rsnumber_ref"]) as rs_stream:
        if mip_case.bcf_path and mip_case.bcf_path.exists():
            analyses = load_bcf(store, mip_case.bcf_path, rs_stream, force=force)
        else:
            analyses = load_vcf(store, mip_case.ready_vcf, rs_stream, force=force)
        for analysis in analyses:
            logger.info("added analysis: %s", analysis.sample.sample_id)
            sample_id = analysis.sample.sample_id
            ped_sex = mip_case.ped.individuals[sample_id].sex
            analysis.sample.expected_sex = SEX[ped_sex]
        store.save()
Esempio n. 2
0
def parse_payload(db, payload, config, force=False):
    """Process an action to upload genotypes."""
    taboo_db = TabooDatabase(config['TABOO_URI'])
    mip_analysis = load_analysis(payload['family_dir'])

    with open(config['TABOO_RSNUMBERS']) as rs_stream:
        if mip_analysis.bcf_path and mip_analysis.bcf_path.exists():
            analyses = load_bcf(taboo_db, mip_analysis.bcf_path, rs_stream,
                                force=force)
        else:
            analyses = load_vcf(taboo_db, mip_analysis.ready_vcf, rs_stream,
                                force=force)

        for analysis in analyses:
            logger.info("added analysis: %s", analysis.sample.sample_id)
            sample_id = analysis.sample.sample_id
            ped_sex = mip_analysis.ped.individuals[sample_id].sex
            analysis.sample.expected_sex = SEX[ped_sex]
        taboo_db.save()