js2264 / HiCExperiment

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

Error #5

Open ratheraarif opened 7 months ago

ratheraarif commented 7 months ago

The execution of the following code generates some error when I execute it on my own hic data. Please note that the hic files that I am working with have chromnames as chr1, chr2,...


  aggr <- aggregate(.x, centros_pairs, maxDistance = 1e999)
  plotMatrix(
    aggr, use.scores = 'balanced', limits = c(-5, -1), 
    cmap = HiContacts::rainbowColors(), 
    caption = FALSE
  ) + ggtitle(.y)
}) ```

Error in `map2()`:
ℹ In index: 1.
ℹ With name: WT.
Caused by error in `validObject()`:
! invalid class “GRanges” object: 
    'seqlevels(seqinfo(x))' and 'levels(seqnames(x))' are not identical
Run `rlang::last_trace()` to see where the error occurred.

sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.3

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Asia/Kolkata
tzcode source: internal

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] purrr_1.0.2                 diffHic_1.34.0              InteractionSet_1.30.0      
 [4] SummarizedExperiment_1.32.0 Biobase_2.62.0              MatrixGenerics_1.14.0      
 [7] matrixStats_1.2.0           GenomicRanges_1.54.1        GenomeInfoDb_1.38.5        
[10] IRanges_2.36.0              S4Vectors_0.40.2            dplyr_1.1.4                
[13] Cairo_1.6-2                 DNAZooData_1.2.0            fourDNData_1.2.0           
[16] HiContactsData_1.4.0        ExperimentHub_2.10.0        AnnotationHub_3.10.0       
[19] BiocFileCache_2.10.1        dbplyr_2.4.0                BiocGenerics_0.48.1        
[22] HiCool_1.2.0                ggplot2_3.4.4               HiContacts_1.4.0           
[25] HiCExperiment_1.3.1        

loaded via a namespace (and not attached):
  [1] strawr_0.0.91                 rstudioapi_0.15.0            
  [3] jsonlite_1.8.8                magrittr_2.0.3               
  [5] ggbeeswarm_0.7.2              farver_2.1.1                 
  [7] rmarkdown_2.25                BiocIO_1.12.0                
  [9] zlibbioc_1.48.0               vctrs_0.6.5                  
 [11] memoise_2.0.1                 Rsamtools_2.18.0             
 [13] RCurl_1.98-1.14               htmltools_0.5.7              
 [15] S4Arrays_1.2.0                curl_5.2.0                   
 [17] Rhdf5lib_1.24.1               SparseArray_1.2.3            
 [19] rhdf5_2.46.1                  htmlwidgets_1.6.4            
 [21] basilisk_1.14.2               plotly_4.10.4                
 [23] cachem_1.0.8                  GenomicAlignments_1.38.2     
 [25] mime_0.12                     lifecycle_1.0.4              
 [27] pkgconfig_2.0.3               Matrix_1.6-5                 
 [29] R6_2.5.1                      fastmap_1.1.1                
 [31] GenomeInfoDbData_1.2.11       shiny_1.8.0                  
 [33] digest_0.6.34                 colorspace_2.1-0             
 [35] AnnotationDbi_1.64.1          plyinteractions_1.1.0        
 [37] RSpectra_0.16-1               pkgload_1.3.4                
 [39] RSQLite_2.3.5                 Rhtslib_2.4.1                
 [41] labeling_0.4.3                filelock_1.0.3               
 [43] fansi_1.0.6                   httr_1.4.7                   
 [45] abind_1.4-5                   compiler_4.3.2               
 [47] bit64_4.0.5                   withr_3.0.0                  
 [49] csaw_1.36.1                   BiocParallel_1.36.0          
 [51] DBI_1.2.0                     highr_0.10                   
 [53] rappdirs_0.3.3                DelayedArray_0.28.0          
 [55] sessioninfo_1.2.2             rjson_0.2.21                 
 [57] tools_4.3.2                   vipor_0.4.7                  
 [59] beeswarm_0.4.0                interactiveDisplayBase_1.40.0
 [61] httpuv_1.6.14                 glue_1.7.0                   
 [63] restfulr_0.0.15               promises_1.2.1               
 [65] rhdf5filters_1.14.1           grid_4.3.2                   
 [67] generics_0.1.3                BSgenome_1.70.1              
 [69] gtable_0.3.4                  tzdb_0.4.0                   
 [71] rmdformats_1.0.4              tidyr_1.3.1                  
 [73] data.table_1.14.10            hms_1.1.3                    
 [75] metapod_1.10.1                utf8_1.2.4                   
 [77] XVector_0.42.0                BiocVersion_3.18.1           
 [79] pillar_1.9.0                  stringr_1.5.1                
 [81] limma_3.58.1                  vroom_1.6.5                  
 [83] later_1.3.2                   lattice_0.22-5               
 [85] rtracklayer_1.62.0            bit_4.0.5                    
 [87] tidyselect_1.2.0              locfit_1.5-9.8               
 [89] Biostrings_2.70.1             knitr_1.45                   
 [91] bookdown_0.37                 edgeR_4.0.12                 
 [93] xfun_0.41                     statmod_1.5.0                
 [95] stringi_1.8.3                 lazyeval_0.2.2               
 [97] yaml_2.3.8                    evaluate_0.23                
 [99] codetools_0.2-19              tibble_3.2.1                 
[101] BiocManager_1.30.22           cli_3.6.2                    
[103] xtable_1.8-4                  reticulate_1.34.0            
[105] munsell_0.5.0                 Rcpp_1.0.12                  
[107] dir.expiry_1.10.0             png_0.1-8                    
[109] XML_3.99-0.16.1               ggrastr_1.0.2                
[111] parallel_4.3.2                ellipsis_0.3.2               
[113] readr_2.1.5                   blob_1.2.4                   
[115] basilisk.utils_1.14.1         plyranges_1.22.0             
[117] bitops_1.0-7                  viridisLite_0.4.2            
[119] scales_1.3.0                  crayon_1.5.2                 
[121] rlang_1.1.3                   KEGGREST_1.42.0              
[123] cowplot_1.1.3         

please suggest any help with the code example too
js2264 commented 3 months ago

This error mostly comes from the chromosome names used in your imported HiC data, compared to the chromosome names used in centros_pairs. Can you confirm they are all the same (table(seqnames(regions(centros_pairs)) %in% seqnames(regions(.x))))?