Skip to content

How to create a one chromosome cool matrix #370

Answered by nvictus
luciaalvarez95 asked this question in Q&A
Discussion options

You must be logged in to vote

Looks to me like there's a missing function implementation in the FIREcaller package: cooler2bedpe.

If you decide to try hacking the script to use a dataframe or matrix instead of a file, we recently discovered that you can very easily run the Python cooler package from within R using reticulate and extract what you need. In case it helps:

reticulate::use_condaenv("myenv")  # a conda environment with cooler installed
cooler <- reticulate::import("cooler")

clr <- cooler$Cooler("path/to/file.cool::resolutions/10000")
mat <- clr$matrix(balance = FALSE)$fetch("chr1")  # raw counts, unnormalized, as array
dat <- clr$matrix(balance = FALSE, as_pixels = TRUE)$fetch("chr1")   # raw counts, unnor…

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by nvictus
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #263 on January 24, 2024 16:37.