js2264 / HiCExperiment

Importing and manipulating Hi-C data in R
http://js2264.github.io/HiCExperiment/
Other
8 stars 1 forks source link

modify HiCExperiment object based on chromosome #6

Closed wangmhan closed 3 months ago

wangmhan commented 5 months ago

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!

js2264 commented 3 months ago

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: https://github.com/js2264/HiContacts/commit/7d20050f3e6c45a5dd626f9d5f066d2483ead4eb. 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.
wangmhan commented 3 months ago

Thank you! Yes, please keep me updated. I will try out the developed version then!

Best, Menghan

On Mon, 3 Jun 2024 at 16:58, Jacques Serizay @.***> wrote:

Hi @wangmhan https://github.com/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: @.*** https://github.com/js2264/HiContacts/commit/7d20050f3e6c45a5dd626f9d5f066d2483ead4eb. 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.

— Reply to this email directly, view it on GitHub https://github.com/js2264/HiCExperiment/issues/6#issuecomment-2145420200, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJVYTVUUGUUFKIRNNDTEHEDZFR77TAVCNFSM6AAAAABFXPA4OOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBVGQZDAMRQGA . You are receiving this because you were mentioned.Message ID: @.***>