scout/commands/export/variant.py
def variants(context, collaborator, document_id, case_id, json):
    """Export causatives for a collaborator in .vcf format"""
    LOG.info("Running scout export variants")
    adapter = context.obj['adapter']
    collaborator = collaborator or 'cust000'

    variants = export_variants(
        adapter,
        collaborator,
        document_id=document_id,
        case_id=case_id
    )

    if json:
        click.echo(dumps([var for var in variants]))
        return

    vcf_header = VCF_HEADER

    #If case_id is given, print more complete vcf entries, with INFO,
    #and genotypes
    if case_id:
        vcf_header[-1] = vcf_header[-1] + "\tFORMAT"
        case_obj = adapter.case(case_id=case_id)
        for individual in case_obj['individuals']:
            vcf_header[-1] = vcf_header[-1] + "\t" + individual['individual_id']

    #print header
    for line in vcf_header:
        click.echo(line)

    for variant_obj in variants:
        variant_string = get_vcf_entry(variant_obj, case_id=case_id)
        click.echo(variant_string)
def variants(context, collaborator, document_id, case_id, json):
    """Export causatives for a collaborator in .vcf format"""
    LOG.info("Running scout export variants")
    adapter = context.obj['adapter']
    collaborator = collaborator or 'cust000'

    variants = export_variants(
        adapter,
        collaborator,
        document_id=document_id,
        case_id=case_id
    )

    if json:
        click.echo(dumps([var for var in variants]))
        return

    vcf_header = VCF_HEADER

    #If case_id is given, print more complete vcf entries, with INFO,
    #and genotypes
    if case_id:
        vcf_header[-1] = vcf_header[-1] + "\tFORMAT"
        case_obj = adapter.case(case_id=case_id)
        for individual in case_obj['individuals']:
            vcf_header[-1] = vcf_header[-1] + "\t" + individual['individual_id']

    #print header
    for line in vcf_header:
        click.echo(line)

    for variant_obj in variants:
        variant_string = get_vcf_entry(variant_obj, case_id=case_id)
        click.echo(variant_string)
Export causatives for a collaborator in .vcf format