koustav-pal / HiCBricks

HiCBricks offers user-friendly and efficient solutions for handling large high-resolution Hi-C datasets. The package provides a R/Bioconductor framework with the bricks to build more complex data analysis pipelines and algorithms.
Other
3 stars 4 forks source link

Norm.factor not found #7

Closed cmdoret closed 5 years ago

cmdoret commented 5 years ago

Hello, I have been trying to load an mcool file into HiCBricks, but keep getting the following error:

Error in Brick_load_data_from_mcool(Brick = file_brick, mcool = "file.mcool",  : 
  object 'Norm.factor' not found

Here is what I did:

  1. Use cooler to generate mcool from a pairs file:

    cooler cload pairs -c1 2 -p1 3 -c2 4 -p2 5 \
                       chromsizes:10000 \
                       file.pairs file.cool
    cooler balance -p 12 --mad-max 10 file.cool
    cooler zoomify --balance --balance-args '--mad-max 10' file.cool
  2. Load into HiCBricks

file_brick = CreateBrick_from_mcool(Brick='file.brick', mcool='file.mcool', binsize=10000)
file_data = Brick_load_data_from_mcool(Brick=file_brick, mcool='file.mcool', chr1='chr1', chr2='chr1', binsize=10000)

I tried setting norm.factor to NULL in Brick_load_data_from_mcool, but keep getting the same error.

Do you have an idea why this is happening ?

Here are the attributes of file.mcool::/resolutions/10000:

'@attrs':
  bin-size: 10000
  bin-type: fixed
  creation-date: 2019-05-09 19:52:48.969380
  format: HDF5::Cooler
  format-url: https://github.com/mirnylab/cooler
  format-version: 3
  generated-by: cooler-0.8.5
  genome-assembly: unknown
  metadata: {}
  nbins: 313767
  nchroms: 95
  nnz: 136619590
  storage-mode: symmetric-upper
  sum: 373921250
bins:
  '@attrs': {}
  chrom:
    '@attrs': {}
  end:
    '@attrs': {}
  start:
    '@attrs': {}
  weight:
    '@attrs': {cis_only: false, converged: true, ignore_diags: 2, mad_max: 10, min_count: 0,
      min_nnz: 10, scale: 2275.654791260843, tol: 1.0e-05, var: 9.55998041947331e-06}
chroms:
  '@attrs': {}
  length:
    '@attrs': {}
  name:
    '@attrs': {}
indexes:
  '@attrs': {}
  bin1_offset:
    '@attrs': {}
  chrom_offset:
    '@attrs': {}
pixels:
  '@attrs': {}
  bin1_id:
    '@attrs': {}
  bin2_id:
    '@attrs': {}
  count:
    '@attrs': {}
koustav-pal commented 5 years ago

Hi @cmdoret ,

Can you please let me know which version of R and HiCBricks you are currently using?

This was a bug in the older release of HiCBricks from Bioconductor version 3.8. I would suggest that you either install the most current version of HiCBricks from Bioconductor version 3.9 or from github master. This version will need R version 3.6.

Please note, that the github version of the package is the most latest version of HiCBricks. To use the same package from Bioconductor, you would need to use Bioconductor devel. If you want to install the github version, please consider using the install_github function from the devtools package.

You can also check which normalisations are present in the .mcool file using Brick_mcool_normalisation_exists. This function requires as input the binsize and norm.factor parameters. The norm.factor values parameter can be found in Brick_list_mcool_normalisations(names.only = TRUE).

koustav-pal commented 5 years ago

closing due to user inactivity

cmdoret commented 5 years ago

Thanks for the help !

I was indeed using R 3.5.1. I updated my R environment and reinstalled HiCBricks using bioconductor 3.9 and it solved the issue.