DnaFeaturesViewer icon indicating copy to clipboard operation
DnaFeaturesViewer copied to clipboard

Cannot apply sequence translation on plot_on_multiple_lines or plot_on_multiple_pages

Open RekhaAngara opened this issue 4 years ago • 2 comments

Is it possible to use sequence translation (plot_translation) with plot_on_multiple_lines or plot_on_multiple_pages. I would like to ideally have a sequence on multiple lines/pages represented both as nuc and aminoacid sequence.

RekhaAngara avatar Aug 03 '21 17:08 RekhaAngara

Thanks, I agree that it would be an interesting feature, which is not implemented currently (I think).

A solution would be to include a call to plot_translation() in MultilinePlottableMixin.plot_on_multiple_lines() after the line https://github.com/Edinburgh-Genome-Foundry/DnaFeaturesViewer/blob/6ace5cdff96bf995aa26167868b0dbb47f5f5952/dna_features_viewer/GraphicRecord/MultilinePlottableMixin.py#L74

As a proof of concept, a call there:

line_record.plot_translation(
    ax=line_ax,
    location=(0, 66),
    fontdict={"weight": "bold"},
    long_form_translation=False,
)

returns: multiline_translation

@Zulko do you think that's a good solution? I can add a dict parameter like translation_params=None in plot_on_multiple_lines() which would be passed on to plot_translation() if not None etc.

veghp avatar Aug 04 '21 11:08 veghp

I'll try that solution, thank you for your prompt response

RekhaAngara avatar Aug 05 '21 16:08 RekhaAngara