def make_spikein_per_transcript_plot(quantifications, library_id, quantification='FPKM'):
    spikein_cpc = pandas.DataFrame(models.get_single_spike_cpc(), columns=['copies'])
    library = quantifications[library_id]
    spikes = library[library.index.isin(spikein_cpc.index)]
    copies_vs_quant = pandas.concat([spikein_cpc, spikes], axis=1)

    source = ColumnDataSource(
        data=dict(
            x = copies_vs_quant['copies'],
            y = copies_vs_quant[library_id],
            desc = copies_vs_quant.index,
        )
    )
    hover = HoverTool(
        tooltips=[
            ('index', '$index'),
            ('transcripts', '$x'),
            ('fpkms', '$y'),
            ('desc', '@desc'),
        ]
    )
    plot = figure(
        title="Spike-in for library {}".format(library_id),
        tools=["pan","wheel_zoom","reset","resize",hover]
    )
    plot.xaxis.axis_label = "transcripts spiked in"
    plot.yaxis.axis_label = "RNA-Seq RSEM ({})".format(quantification)
    plot.circle('x', 'y', source=source)
    return plot
def make_spikein_variance_plot(quantifications, experiments, experiment, quantification='FPKM'):
    spikein_cpc = models.get_single_spike_cpc().sort(inplace=False)
    library_ids = experiments[experiment]
    libraries = quantifications[library_ids]
    spikes = libraries[libraries.index.isin(spikein_cpc.index)]
    spikes_sorted = spikes.reindex(spikein_cpc.index)

    plot = BoxPlot(
        spikes_sorted.T,
        title="Spike-in variance for experiment {}".format(experiment),
        outliers=True,
        xlabel="spike-in",
        ylabel="RNA-Seq RSEM ({})".format(quantification),
        width=900,
    )
    return plot