check this: In light of Anton's PR, just want to start a discussion about future…
- User
check this:
In light of Anton's PR, just want to start a discussion about future possible functions for 2D interval operations for a later release.
I think we decided on Slack they should just internally use 1D functions along each dimension, and then combine results. So they are more of a "sugar" than core functionality, but considering our focus on Hi-C analysis this seems important enough to implement - comparing dot calls seems like a frequent task (e.g. merging different resolution annotations (might be used in the dotcaller?), or obviously finding differential dot calls). I think we need to basically implement all the same functions as we (will) have for 1D overlaps, but for 2D. Except I am not sure if there is any reason to have 2D complement, and it seems ill defined anyway. I think it would be useful to have 2D vs 1D overlaps too. This is even easier to achieve by directly using 1D functions, but I'd say again it's something quite frequently needed - e.g. to annotate dot calls with CTCF peaks (and their orientation), or other ChIP-seq/whatever-seq peaks.
and this answer:
Hi @sebgra,
One function that could eventually get migrated to bioframe support for 2D interval ops would be this one currently in cooltools, assign_view_paired: https://github.com/open2c/cooltools/blob/a5341aa03f1bbcc1087983f2919602d4f25c333a/cooltools/lib/common.py#L12
If you provide a more explicit example of what you're hoping to achieve, we might be able to give a more detailed answer
Thanks! Geoff
the link leads to:
def assign_view_paired( features, view_df, cols_paired=["chrom1", "start1", "end1", "chrom2", "start2", "end2"], cols_view=["chrom", "start", "end"], features_view_cols=["region1", "region2"], view_name_col="name", drop_unassigned=False, ): """Assign region names from the view to each feature
Assigns a regular 1D view independently to each side of a bedpe-style dataframe. Will add two columns with region names (`features_view_cols`) Parameters ---------- features : pd.DataFrame bedpe-style dataframe view_df : pandas.DataFrame ViewFrame specifying region start and ends for assignment. Attempts to convert dictionary and pd.Series formats to viewFrames. cols_paired : list of str The names of columns containing the chromosome, start and end of the genomic intervals. The default values are `"chrom1", "start1", "end1", "chrom2", "start2", "end2"`. cols_view : list of str The names of columns containing the chromosome, start and end of the genomic intervals in the view. The default values are `"chrom", "start", "end"`. features_view_cols : list of str Names of the columns where to save the assigned region names view_name_col : str Column of ``view_df`` with region names. Default "name". drop_unassigned : bool If True, drop intervals in df that do not overlap a region in the view. Default False. """ features = features.copy() features.reset_index(inplace=True, drop=True) cols_left = cols_paired[:3] cols_right = cols_paired[3:] bioframe.core.checks.is_bedframe(features, raise_errors=True, cols=cols_left) bioframe.core.checks.is_bedframe(features, raise_errors=True, cols=cols_right) view_df = bioframe.core.construction.make_viewframe( view_df, view_name_col=view_name_col, cols=cols_view ) features = bioframe.assign_view( features, view_df, drop_unassigned=drop_unassigned, df_view_col=features_view_cols[0], view_name_col=view_name_col, cols=cols_left, cols_view=cols_view, ) features[cols_right[1:]] = features[cols_right[1:]].astype( int ) # gets cast to float above... features = bioframe.assign_view( features, view_df, drop_unassigned=drop_unassigned, df_view_col=features_view_cols[1], view_name_col=view_name_col, cols=cols_right, cols_view=cols_view, ) return features - Assistant
- User
could you give an example of how this 2D interval data would look like?
- Assistant
Certainly! Let's create a simplified example to illustrate what 2D interval data, especially in the context of paired-end genomic data (like Hi-C interactions), looks like. Recall that this kind of data typically involves interactions between two genomic regions.
Conceptual Overview
For genomic intervals, data is often represented in a format detailing the chromosome and the start and end positions of a region. A single interval could be something like:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.