js2264 / HiCExperiment

Importing and manipulating Hi-C data in R

Home Page:http://js2264.github.io/HiCExperiment/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

modify HiCExperiment object based on chromosome

wangmhan opened this issue · comments

Hi, Thank you for the nice package!

My data is saved in .mcool format, followed by distiller-sm pipeline. Then I imported in R.
cool1 = CoolFile(paste0(my.path,"/data/microc_mcool/rep1.mm10.mapq_30.1000.mcool"))
rep1 = import(cool1)

I followed the OHCA tutorial, and would like to calculate the correlation between replicated as mentioned in Workflow1 (https://bioconductor.org/books/devel/OHCA/pages/workflow-yeast.html#correlation-between-replicates-with-hicrep).
Then I met a problem, as my data is not split to chromosome as showed in the example: hics[['WT_G2M_rep1']]["IV"].
So I tried the subset method:
select.gr <- GRanges("chr1:1-10000000").
After that I tried to get the matrix:
mat1=subsetByOverlaps(hics$rep1, select.gr) |> as.matrix(sparse = TRUE, use.scores = 'count')
mat2=subsetByOverlaps(hics$rep2, select.gr) |> as.matrix(sparse = TRUE, use.scores = 'count')
scc <- get.scc(
mat1, mat2,
resol = my.res, h = 2
)
--> here I met an error, as the dimension of mat1 and mat2 is not the same.

In the end I managed by subset before import. But it is not convenient if I want to check for every chromosome. I wonder if there is a way to split the HiCExperiment object after import?

Also, I met other errors with functions from HiContacts if the HiCExperiment object all chromosomes, but works fine if I subset by chromosome before import. For examples,

  1. distanceLaw (Error in dplyr::mutate():),
  2. getCompartments: Error in h(simpleError(msg, call)) :
    error in evaluating the argument 'x' in selecting a method for function 'seqnames': Object '/resolutions/1e+05/chroms' does not exist in this HDF5 file.

Please let me know if there is any solutions. Thank you!

Hi @wangmhan,
The point you raised is a known limitation. So far there is no way around this bug. I'll let you know if I figure out a way to circumvent this problem.

regarding the other errors:

  1. I don't see any error for distanceLaw, do you know what was the error message in your case?
  2. I see, this error should be fixed here: js2264/HiContacts@7d20050. You'll need to install the github version if you want to immediately try it out. Please let me know if you still have problems.