ComputationalRegulatoryGenomicsICL / GenomicInteractions

R/Bioconductor package for handling Genomic interaction data, annotating genomic features with interaction information and producing summary plots / statistics
7 stars 0 forks source link

extracting annotation information #18

Open MurliNair opened 1 year ago

MurliNair commented 1 year ago

Hi, I have created a GenomicInteractions object using makeGenomicInteractionsFromFile() and then annotated it with promoter and enhancer data using annotateInteractions() methods. Is there a convenient method to query the annotated object to extract the coordinates of interacting regions (promoter or enhancer) and it annotated hic coordinates? I tried to search through the methods using str(GenomicInteractionObject), but got lost in the list of methods. Appreciate your input on this. Thanks ../Murli

liz-is commented 1 year ago

Hi,

I think probably the easiest way to get all the coordinates will be to use the linkOverlaps function from the InteractionSet package - you can use this to find any interactions in a GenomicInteractions object which link a promoter to an enhancer. This is more flexible and lets you directly extract the overlapping regions. Let me know if you have trouble with using it and I'll see if I can help.

MurliNair commented 1 year ago

Thanks for the lead on using linkOverlaps function. It returns a data frame with a list of index positions for query, subject1, and subject2. My query is a annotated GInteractions object and the two subjects are GRange objects for promoter and enhancers. Is there a convenient way to combine all the data using the corresponding index position returned by linkOverlaps function? Converting it into a data frame for instance, is that possible. I am able to query it, without any problem. Any thoughts on that? Thanks ../Murli

liz-is commented 1 year ago

You could subset the query and subject datasets using the indices from linkOverlaps, convert each of the three objects into a data frame (perhaps also selecting only the columns of interest), and then use cbind to combine them side-by-side so each row contains the data for one interaction between your subject datasets. Let me know if that's unclear or doesn't address your question!

MurliNair commented 1 year ago

Thanks Liz, that is exactly how I am extracting it. I was wondering if there was a better way to subset them. It works so that is fine.