epi2me-labs / wf-alignment

Other
24 stars 21 forks source link

[Sugestion]: #15

Closed mlpereira87 closed 1 year ago

mlpereira87 commented 1 year ago

What happened?

How do I know which sample has the best alignment to a reference genome? Maybe a legend in the depth plots?

            with tabs.add_dropdown_tab(ref_file):
                # depth vs genomic coordinate plot on the left and cumulative depth
                # plot on the right
                with Grid(columns=1):
                    # TODO: maybe smooth this line a bit... yes but legend first ;)
                    plt = ezc.lineplot(
                        data=df_depth_vs_coords.round(2),
                        x="total_mean_pos",
                        y="depth",
                        hue="sample_name",
                        legend="full"
                    )
                    plt.title = {"text": "Coverage along reference"}
                    plt.xAxis = {"name": "Position along reference", "nameLocation": "middle", "nameGap": 30}
                    plt.yAxis = {"name": "Sequencing depth", "nameLocation": "middle", "nameGap": 40}
                    plt.legend = {"type": 'scroll', "orient": 'vertical', "right": "0%", "top": "15%", "bottom": "5%"}
                    plt.grid = {"width": "70%"}
                    for s in plt.series:
                        s.showSymbol = False
                    plt.tooltip = {"trigger": "item"}
                    EZChart(plt, theme=THEME, width="100%")
                with Grid(columns=1):
                    # now the cumulative depth plot
                    plt = ezc.lineplot(
                        data=df_cumul_depth.round(2),
                        x="depth",
                        y="ref_percentage",
                        hue="sample_name",
                        legend="full"
                    )

                    plt.xAxis.scale = True
                    plt.title = {"text": "Cumulative coverage"}
                    plt.xAxis = {"name": "Sequencing depth", "nameLocation": "middle", "nameGap": 30}
                    plt.yAxis = {"name": "Percentage of reference", "nameLocation": "middle", "nameGap": 40}
                    plt.legend = {"type": 'scroll', "orient": 'vertical', "right": "0%", "top": "15%", "bottom": "5%"}
                    plt.grid = {"width": "70%"}

                    # Hide symbols for the series
                    for s in plt.series:
                        s.showSymbol = False

                    plt.tooltip = {"trigger": "item"}

                    # Display the plot with the legend
                    EZChart(plt, theme=THEME, width="100%")

Enjoy ;)

Operating System

Windows 11

Workflow Execution

Command line

Workflow Execution - EPI2ME Labs Versions

No response

Workflow Execution - CLI Execution Profile

None

Workflow Version

last

Relevant log output

just wanted to know who is it when looked into the depth plots
julibeg commented 1 year ago

Hi there and many thanks for bringing to our attention that the tooltips in the depth / coverage plots were not working. This should be fixed with v0.5.1 now and the tooltip should show the sample names when hovering over the plot (we prefer this solution over a legend).

Please close this issue if you are happy with the fix and let us know otherwise!