cole-trapnell-lab / cicero-release

https://cole-trapnell-lab.github.io/cicero-release/
MIT License
56 stars 14 forks source link

Error in `[.data.table`(bedpedata, , i) #42

Closed danhtruong closed 4 years ago

danhtruong commented 4 years ago

Hello. This error is driving me nuts and I don't know how to fix this. I tested the code with the chia_conns from the tutorial and that generated a plot, but my own data does not.

Error in [.data.table(bedpedata, , i) : j (the 2nd argument inside [...]) is a single symbol but column name 'i' is not found. Perhaps you intended DT[, ..i]. This difference to data.frame is deliberate and explained in FAQ 1.1. 10. stop("j (the 2nd argument inside [...]) is a single symbol but column name '", jsubChar, "' is not found. Perhaps you intended DT[, ..", jsubChar, "]. This difference to data.frame is deliberate and explained in FAQ 1.1.") 9. [.data.table(bedpedata, , i) 8. bedpedata[, i] 7. plotBedpe(sub, chrom = chr, chromstart = minbp, chromend = maxbp, connection_ymax, coaccess_cutoff, connection_width, alpha_by_coaccess, color_names) 6. GdObject@plottingFunction(GdObject, prepare = prepare) 5. .local(GdObject, ...) 4. drawGD(expandedTrackList[[i]], minBase = ranges["from"], maxBase = ranges["to"], subset = FALSE) 3. drawGD(expandedTrackList[[i]], minBase = ranges["from"], maxBase = ranges["to"], subset = FALSE) 2. plotTracks(component_list, title.width = 0.5, showTitle = TRUE, from = minbp, to = maxbp, chromosome = chr, sizes = size_track, transcriptAnnotation = "symbol", background.title = "transparent", col.border.title = "transparent", lwd.border.title = "transparent", ... 1. plot_connections(conns, "chr10", 10000500, 100335118, coaccess_cutoff = 0, connection_width = 0.5, return_as_list = FALSE)

> head(conns)
                       Peak1                     Peak2  coaccess
1: chr10_100005717_100007112 chr10_100333926_100335118 0.3932521
2: chr10_100146917_100147763 chr10_100184684_100187167 0.2977492
3: chr10_100146917_100147763 chr10_100209218_100209752 0.3271076
4: chr10_100146917_100147763 chr10_100285473_100287454 0.3059880
5: chr10_100146917_100147763 chr10_100338389_100338891 0.3741931
6: chr10_100146917_100147763 chr10_100341043_100341567 0.3778341
plot_connections(conns, "chr10", 100005000, 100335118,
                # gene_model = gene_anno,
                coaccess_cutoff = 0,
                connection_width = .5, return_as_list = FALSE)`
hpliner commented 4 years ago

Can you try casting your matrix to a data.frame using conns_df <- as.data.frame(conns) and see if that changes anything? It should work for data.tables as well, but that's what the error looks like. Either way, can you post your sessionInfo() please?

danhtruong commented 4 years ago
> class(conns_df)
[1] "data.frame"
> class(conns)
[1] "data.table" "data.frame"

Thanks. That seemed to have done it!

> sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
 [1] rtracklayer_1.46.0          dplyr_0.8.4                 future.apply_1.4.0         
 [4] future_1.16.0               Rsamtools_2.2.1             Biostrings_2.54.0          
 [7] XVector_0.26.0              data.table_1.12.8           ggplot2_3.2.1              
[10] EnsDb.Hsapiens.v86_2.99.0   ensembldb_2.10.2            AnnotationFilter_1.10.0    
[13] GenomicFeatures_1.38.1      AnnotationDbi_1.48.0        harmony_1.0                
[16] Rcpp_1.0.3                  Seurat_3.1.2                Signac_0.2.1               
[19] cicero_1.3.4.5              Gviz_1.30.1                 monocle3_0.2.0             
[22] SingleCellExperiment_1.8.0  SummarizedExperiment_1.16.1 DelayedArray_0.12.2        
[25] BiocParallel_1.20.1         matrixStats_0.55.0          GenomicRanges_1.38.0       
[28] GenomeInfoDb_1.22.0         IRanges_2.20.2              S4Vectors_0.24.3           
[31] Biobase_2.46.0              BiocGenerics_0.32.0        

loaded via a namespace (and not attached):
  [1] reticulate_1.14          R.utils_2.9.2            tidyselect_1.0.0         RSQLite_2.2.0           
  [5] htmlwidgets_1.5.1        Rtsne_0.15               devtools_2.2.1           munsell_0.5.0           
  [9] mutoss_0.1-12            codetools_0.2-16         ica_1.0-2                withr_2.1.2             
 [13] colorspace_1.4-1         knitr_1.28               rstudioapi_0.11          ROCR_1.0-7              
 [17] gbRd_0.4-11              listenv_0.8.0            labeling_0.3             Rdpack_0.11-1           
 [21] GenomeInfoDbData_1.2.2   mnormt_1.5-6             farver_2.0.3             bit64_0.9-7             
 [25] rprojroot_1.3-2          TH.data_1.0-10           vctrs_0.2.2              xfun_0.12               
 [29] biovizBase_1.34.1        BiocFileCache_1.10.2     ggseqlogo_0.1            R6_2.4.1                
 [33] rsvd_1.0.2               VGAM_1.1-2               hdf5r_1.3.1              bitops_1.0-6            
 [37] assertthat_0.2.1         SDMTools_1.1-221.2       scales_1.1.0             multcomp_1.4-12         
 [41] nnet_7.3-12              gtable_0.3.0             npsurv_0.4-0             globals_0.12.5          
 [45] processx_3.4.1           sandwich_2.5-1           rlang_0.4.4              gggenes_0.4.0           
 [49] splines_3.6.2            lazyeval_0.2.2           acepack_1.4.1            dichromat_2.0-0         
 [53] checkmate_2.0.0          yaml_2.2.1               reshape2_1.4.3           backports_1.1.5         
 [57] Hmisc_4.3-0              tools_3.6.2              usethis_1.5.1            ellipsis_0.3.0          
 [61] gplots_3.0.1.2           RColorBrewer_1.1-2       sessioninfo_1.1.1        ggridges_0.5.2          
 [65] TFisher_0.2.0            plyr_1.8.5               base64enc_0.1-3          progress_1.2.2          
 [69] zlibbioc_1.32.0          purrr_0.3.3              RCurl_1.98-1.1           ps_1.3.0                
 [73] prettyunits_1.1.1        rpart_4.1-15             openssl_1.4.1            pbapply_1.4-2           
 [77] viridis_0.5.1            cowplot_1.0.0            zoo_1.8-7                ggrepel_0.8.1           
 [81] cluster_2.1.0            fs_1.3.1                 magrittr_1.5             RSpectra_0.16-0         
 [85] lmtest_0.9-37            RANN_2.6.1               mvtnorm_1.0-12           ProtGenerics_1.18.0     
 [89] fitdistrplus_1.0-14      pkgload_1.0.2            hms_0.5.3                patchwork_1.0.0         
 [93] lsei_1.2-0               evaluate_0.14            XML_3.99-0.3             jpeg_0.1-8.1            
 [97] gridExtra_2.3            testthat_2.3.1           compiler_3.6.2           biomaRt_2.42.0          
[101] tibble_2.1.3             KernSmooth_2.23-16       crayon_1.3.4             R.oo_1.23.0             
[105] htmltools_0.4.0          Formula_1.2-3            tidyr_1.0.2              RcppParallel_4.4.4      
[109] DBI_1.1.0                dbplyr_1.4.2             MASS_7.3-51.4            rappdirs_0.3.1          
[113] Matrix_1.2-18            cli_2.0.1                R.methodsS3_1.7.1        gdata_2.18.0            
[117] metap_1.3                igraph_1.2.4.2           pkgconfig_2.0.3          sn_1.5-5                
[121] GenomicAlignments_1.22.1 numDeriv_2016.8-1.1      foreign_0.8-72           plotly_4.9.1            
[125] multtest_2.42.0          bibtex_0.4.2.2           stringr_1.4.0            VariantAnnotation_1.32.0
[129] callr_3.4.1              digest_0.6.23            tsne_0.1-3               sctransform_0.2.1       
[133] RcppAnnoy_0.0.14         rmarkdown_2.1            leiden_0.3.3             htmlTable_1.13.3        
[137] uwot_0.1.5               curl_4.3                 gtools_3.8.1             glasso_1.11             
[141] lifecycle_0.1.0          nlme_3.1-142             jsonlite_1.6.1           desc_1.2.0              
[145] viridisLite_0.3.0        askpass_1.1              BSgenome_1.54.0          fansi_0.4.1             
[149] pillar_1.4.3             lattice_0.20-38          plotrix_3.7-7            httr_1.4.1              
[153] pkgbuild_1.0.6           survival_3.1-8           glue_1.3.1               remotes_2.1.0           
[157] FNN_1.1.3                png_0.1-7                bit_1.1-15.2             stringi_1.4.5           
[161] ggfittext_0.8.1          blob_1.2.1               latticeExtra_0.6-29      caTools_1.18.0          
[165] memoise_1.1.0            irlba_2.3.3              ape_5.3     
hpliner commented 4 years ago

This should be solved for data.table now without casting. Thanks for the report!