diff --git a/dimelo/plot_read_browser.py b/dimelo/plot_read_browser.py index a49d496..febccac 100644 --- a/dimelo/plot_read_browser.py +++ b/dimelo/plot_read_browser.py @@ -342,13 +342,17 @@ def make_browser_figure( colorscales: dictionary mapping motif names to plotly colorscale specifications TODO: Think about how this interfaces with different types of initial sorting... - TODO: Make it so that this method does NOT modify the input dataframe TODO: Should this method do the collapsing, or should this method require collapsing outside? """ if collapse: index_map = collapse_rows(read_extent_df, **kwargs) - read_extent_df["y_index"] = read_extent_df["y_index"].map(index_map) - mod_event_df["y_index"] = mod_event_df["y_index"].map(index_map) + # NOTE: `DataFrame.assign` performs a deep copy, preventing the modification of the array that is passed in. For very large datasets, this duplication may cause memory issues. + read_extent_df = read_extent_df.assign( + y_index=read_extent_df["y_index"].map(index_map) + ) + mod_event_df = mod_event_df.assign( + y_index=mod_event_df["y_index"].map(index_map) + ) # Build final figure # TODO: Enable setting some relevant parameters