@click.command()
@click.option('-t', '--transcripts', is_flag=True,
              help='focus only on transcripts on the database level')
@click.argument('bed_stream', callback=validate_stdin,
                type=click.File(encoding='utf-8'), default='-', required=False)
@click.pass_context
def link(context, transcripts, bed_stream):
    only_tx = transcripts or context.obj.get('transcripts') or False
    base = TXBASE if only_tx else BASE
    chanjo_db = Store(uri=context.obj['database'], base=base)
    try:
        if only_tx:
            result = load.link_transcripts(bed_stream)
            with click.progressbar(result.models, length=result.count,
                                   label='adding transcripts') as bar:
                for tx_model in bar:
                    chanjo_db.session.add(tx_model)
            chanjo_db.save()
        else:
            link_elements(chanjo_db, bed_stream)
    except IntegrityError:
        click.echo("elements already linked, use 'chanjo db setup --reset' "
                   "to re-build")
Model expression as a string suitable for use with patsy/statsmodels.
dataset/ETHPy150Open robinandeer/chanjo/chanjo/cli/link.py/link--crossover with--dataset/ETHPy150Open UDST/urbansim/urbansim/models/dcm.py/MNLDiscreteChoiceModel.str_model_expression