scout/commands/convert.py
def convert(context, panel):
    """Convert a gene panel with hgnc symbols to a new one with hgnc ids."""
    adapter = context.obj['adapter']
    new_header = ["hgnc_id","hgnc_symbol","disease_associated_transcripts",
                 "reduced_penetrance", "genetic_disease_models", "mosaicism",
                 "database_entry_version"]
    
    genes = parse_genes(panel)
    
    adapter.add_hgnc_id(genes)
    
    click.echo("#{0}".format('\t'.join(new_header)))
    for gene in genes:
        if gene.get('hgnc_id'):
            print_info = []
            for head in new_header:
                print_info.append(str(gene[head]) if gene.get(head) else '')
            
            click.echo('\t'.join(print_info))
def convert(context, panel):
    """Convert a gene panel with hgnc symbols to a new one with hgnc ids."""
    adapter = context.obj['adapter']
    new_header = ["hgnc_id","hgnc_symbol","disease_associated_transcripts",
                 "reduced_penetrance", "genetic_disease_models", "mosaicism",
                 "database_entry_version"]
    
    genes = parse_genes(panel)
    
    adapter.add_hgnc_id(genes)
    
    click.echo("#{0}".format('\t'.join(new_header)))
    for gene in genes:
        if gene.get('hgnc_id'):
            print_info = []
            for head in new_header:
                print_info.append(str(gene[head]) if gene.get(head) else '')
            
            click.echo('\t'.join(print_info))
Convert a gene panel with hgnc symbols to a new one with hgnc ids.