I want to extract interaction data between specific region. Is it possible to do so with diffhic count function? I am doing this as part of pipeline where a few selected regions will be selected and interaction between them will be looked into more closely at varying resolutions. Hence, I don't want to re-run the analysis on complete data with different resolutions but focus on specific regions making it less time consuming.
I tried using the following commands. My regions of interest are "refgr". I used all the fragments matching this region to generate a new param object. I also restricted read extraction to specific chromosomes and also discarded all the other fragments. I tried various combinations of parameters but couldn't get the results and get same error as described below.
refgr <- GRanges(c("chr1","chr20"),IRanges(c(63997170,14499566),c(64500989,14999888)))
ov <- findOverlaps(refgr,hs.param$fragments)
tokeep <- subjectHits(ov)
new_frags <- hs.param$fragments[tokeep]
discard_gr <- hs.param$fragments[-c(tokeep)]
new.param <- reform(hs.param, fragments=new_frags)
new.param <- reform(new.param, restrict=c('chr1','chr20'), discard=discard_gr)
data <- squareCounts("A006.h5", new.param, width=1e5, filter=1)
Error in .baseHiCParser(current[[anchor2]], files, anchor1, anchor2, chr.limits = frag.by.chr, :
anchor1 index outside range of fragment object