Giter VIP home page Giter VIP logo

compartmap's Introduction



Compartmap: Direct inference of higher-order chromatin structure in individual cells from scRNA-seq and scATAC-seq

How to install the R package

# Release
install.packages("BiocManager")
BiocManager::install("compartmap")

# Development
install.packages("BiocManager")
BiocManager::install("biobenkj/compartmap")

Compartmap extends methods proposed by Fortin and Hansen 2015, Genome Biology (https://genomebiology.biomedcentral.com/articles/10.1186/s13059-015-0741-y) to perform direct inference of higher-order chromatin in single cells from scRNA-seq and scATAC-seq. Originally, Fortin and Hansen demonstrated that chromatin conformation could be inferred from (sc)ATAC-seq, bisulfite sequencing, DNase-seq and methylation arrays, similar to the results provided by HiC at the group level. Thus, in addition to the base information provided by the aforementioned assays, chromatin state could also be inferred.

Here, we propose a method to infer both group and single-cell level higher-order chromatin states from scRNA-seq and scATAC-seq. To accomplish this, we employ a James-Stein estimator (JSE) towards a global or targeted mean, using either chromsome or genome-wide information from scRNA-seq and scATAC-seq. Additionally, due to the sparsity of single-cell data, we employ a bootstrap procedure to quantify the uncertainty associated with the state and boundaries of inferred compartments. The output from compartmap can then be visualized directly, compared with orthogonal assay types, and/or embedded with something like UMAP or t-SNE. Further, to explore the higher-order interacting domains inferred from compartmap, we use a Random Matrix Theory (RMT) approach to resolve the "plaid-like" patterning, similar to what is observed in Hi-C and scHi-C.

compartmap's People

Contributors

biobenkj avatar kayla-morrell avatar llrs avatar martin-g avatar nturaga avatar ttriche avatar vobencha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

compartmap's Issues

Push API changes to bioc-devel

Push all the API changes into bioc-devel for the version to be associated with the paper. This also means that we need to have a version freeze for the paper.

`R CMD check` fails on Linux for Bioconductor builds

Hello,

I am not sure whether you are aware that the Bioconductor check fails on Linux x86_64 and aarch64 with:

* checking data for non-ASCII characters ... WARNING
  Error loading dataset 'k562_scatac_chr14':
   Error in .requirePackage(package) : 
    unable to find required package 'csaw'
  
  Error loading dataset 'ss3_umi_sce':
   Error in .requirePackage(package) : 
    unable to find required package 'SingleCellExperiment'
  
  The dataset(s) may use package(s) not declared in Depends/Imports.
* checking data for ASCII and uncompressed saves ... OK
* checking files in ‘vignettes’ ... OK
* checking examples ... OK
Examples with CPU (user + system) or elapsed time > 5s
                    user system elapsed
scCompartments    81.621  1.832  83.454
getDenoisedMatrix  7.197  0.272   7.468
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in ‘inst/doc’ ... OK
* checking running R code from vignettes ...
  ‘compartmap_vignette.Rmd’ using ‘UTF-8’... OK
 NONE
* checking re-building of vignette outputs ... ERROR
Error(s) in re-building vignettes:
  ...
--- re-building ‘compartmap_vignette.Rmd’ using rmarkdown

Quitting from lines 2-16 (compartmap_vignette.Rmd)
Error: processing vignette 'compartmap_vignette.Rmd' failed with diagnostics:
there is no package called 'BiocStyle'
--- failed re-building ‘compartmap_vignette.Rmd’

SUMMARY: processing the following file failed:
  ‘compartmap_vignette.Rmd’

Error: Vignette re-building failed.
Execution halted

issue with getCompartments and getArrayABsignal

Hi,

When I use the vignette example or the example in getArrayABsignal there are several errors:

library(compartmap)
data("meth_array_450k_chr14", package = "compartmap")
array_compartments <- getArrayABsignal(array.data.chr14, parallel=F, chr="chr14", bootstrap=F, genome="hg19", array.type="hm450")

Loading required package: minfi
Loading required package: bumphunter
Loading required package: foreach
Loading required package: iterators
Loading required package: locfit
locfit 1.5-9.1 	 2013-03-22
Setting options('download.file.method.GEOquery'='auto')
Setting options('GEOquery.inmemory.gpl'=FALSE)

Attaching package:minfiThe following object is masked frompackage:bsseq:

    getMeth

Filtering to open sea CpG loci...
Converting to squeezed M-values.
Imputing missing values.
Dropping samples with >80% NAs.
Imputing missing data with kNN.
Cluster size 3384 broken into 2771 613 
Cluster size 2771 broken into 1052 1719 
Done cluster 1052 
Cluster size 1719 broken into 476 1243 
Done cluster 476 
Done cluster 1243 
Done cluster 1719 
Done cluster 2771 
Done cluster 613 
Working on naive.1
Computing compartments for chr14
Calculating correlations...
Done...
Calculating eigenvectors.
Smoothing eigenvector.
Done smoothing.
Working on rTreg.2
Computing compartments for chr14
Calculating correlations...
Done...
Calculating eigenvectors.
Smoothing eigenvector.
Done smoothing.
Working on act_naive.3
Computing compartments for chr14
Calculating correlations...
Done...
Calculating eigenvectors.
Smoothing eigenvector.
Done smoothing.
Working on naive.4
Computing compartments for chr14
Calculating correlations...
Done...
Calculating eigenvectors.
Smoothing eigenvector.
Done smoothing.
Working on act_naive.5
Computing compartments for chr14
Calculating correlations...
Done...
Calculating eigenvectors.
Smoothing eigenvector.
Done smoothing.
Working on act_rTreg.6
Computing compartments for chr14
Calculating correlations...
Done...
Calculating eigenvectors.
Smoothing eigenvector.
Done smoothing.
Working on naive.7
Computing compartments for chr14
Calculating correlations...
Done...
Calculating eigenvectors.
Smoothing eigenvector.
Done smoothing.
Working on rTreg.8
Computing compartments for chr14
Calculating correlations...
Done...
Calculating eigenvectors.
Smoothing eigenvector.
Done smoothing.
Working on act_naive.9
Computing compartments for chr14
Calculating correlations...
Done...
Calculating eigenvectors.
Smoothing eigenvector.
Done smoothing.
Working on act_rTreg.10
Computing compartments for chr14
Calculating correlations...
Done...
Calculating eigenvectors.
Smoothing eigenvector.
Done smoothing.
Working on birth.11
Computing compartments for chr14
Calculating correlations...
Done...
Calculating eigenvectors.
Smoothing eigenvector.
Done smoothing.
Error in as(objects[[1L]], "CompressedGRangesList", strict = FALSE) : 
  no method or default for coercingSimpleGRangesListtoCompressedGRangesList# In addition when I use 
array_compartments <- getCompartments(array.data.chr14, type = "array", parallel = FALSE, chrs = "chr14")

Error in getCompartments(arrau.data.ch14, type = "array", parallel = FALSE, : 
could not find function "getComparments"

sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.10

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.3.3.so

locale:
 [1] LC_CTYPE=fr_FR.UTF-8       LC_NUMERIC=C               LC_TIME=fr_FR.UTF-8        LC_COLLATE=fr_FR.UTF-8    
 [5] LC_MONETARY=fr_FR.UTF-8    LC_MESSAGES=fr_FR.UTF-8    LC_PAPER=fr_FR.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] minfi_1.31.1                             bumphunter_1.27.0                       
 [3] locfit_1.5-9.1                           iterators_1.0.12                        
 [5] foreach_1.4.7                            compartmap_1.65.6                       
 [7] bsseq_1.21.1                             BiocSingular_1.1.5                      
 [9] BSgenome.Mmusculus.UCSC.mm9_1.4.0        Mus.musculus_1.3.1                      
[11] TxDb.Mmusculus.UCSC.mm10.knownGene_3.4.7 org.Mm.eg.db_3.8.2                      
[13] BSgenome.Hsapiens.UCSC.hg38_1.4.1        BSgenome_1.53.2                         
[15] rtracklayer_1.45.5                       Biostrings_2.53.2                       
[17] XVector_0.25.0                           Homo.sapiens_1.3.1                      
[19] TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2  org.Hs.eg.db_3.8.2                      
[21] GO.db_3.8.2                              OrganismDbi_1.27.1                      
[23] GenomicFeatures_1.37.4                   AnnotationDbi_1.47.1                    
[25] RaggedExperiment_1.9.1                   SummarizedExperiment_1.15.8             
[27] DelayedArray_0.11.4                      BiocParallel_1.19.2                     
[29] matrixStats_0.54.0                       Biobase_2.45.1                          
[31] GenomicRanges_1.37.15                    GenomeInfoDb_1.21.1                     
[33] IRanges_2.19.14                          S4Vectors_0.23.21                       
[35] BiocGenerics_0.31.5                     

loaded via a namespace (and not attached):
  [1] backports_1.1.4          BiocFileCache_1.9.1      plyr_1.8.4               igraph_1.2.4.1          
  [5] lazyeval_0.2.2           splines_3.6.1            ggplot2_3.2.1            digest_0.6.20           
  [9] viridis_0.5.1            magrittr_1.5             memoise_1.1.0            limma_3.41.15           
 [13] readr_1.3.1              annotate_1.63.0          R.utils_2.9.0            askpass_1.1             
 [17] siggenes_1.59.0          prettyunits_1.0.2        colorspace_1.4-1         blob_1.2.0              
 [21] rappdirs_0.3.1           dplyr_0.8.3              crayon_1.3.4             RCurl_1.95-4.12         
 [25] graph_1.63.0             genefilter_1.67.1        GEOquery_2.53.0          zeallot_0.1.0           
 [29] impute_1.59.0            survival_2.44-1.1        glue_1.3.1               registry_0.5-1          
 [33] gtable_0.3.0             zlibbioc_1.31.0          Rhdf5lib_1.7.4           HDF5Array_1.13.5        
 [37] scales_1.0.0             DBI_1.0.0                rngtools_1.4             bibtex_0.4.2            
 [41] Rcpp_1.0.2               viridisLite_0.3.0        xtable_1.8-4             progress_1.2.2          
 [45] bit_1.1-14               rsvd_1.0.2               mclust_5.4.5             preprocessCore_1.47.1   
 [49] httr_1.4.1               RColorBrewer_1.1-2       pkgconfig_2.0.2          reshape_0.8.8           
 [53] XML_3.98-1.20            R.methodsS3_1.7.1        dbplyr_1.4.2             tidyselect_0.2.5        
 [57] rlang_0.4.0              munsell_0.5.0            tools_3.6.1              RSQLite_2.1.2           
 [61] stringr_1.4.0            bit64_0.9-7              beanplot_1.2             scrime_1.3.5            
 [65] purrr_0.3.2              RANN_2.6.1               nlme_3.1-141             pbapply_1.4-2           
 [69] RBGL_1.61.0              doRNG_1.7.1              nor1mix_1.3-0            R.oo_1.22.0             
 [73] xml2_1.2.2               biomaRt_2.41.8           compiler_3.6.1           rstudioapi_0.10         
 [77] curl_4.0                 tibble_2.1.3             stringi_1.4.3            lattice_0.20-38         
 [81] Matrix_1.2-17            permute_0.9-5            multtest_2.41.0          vctrs_0.2.0             
 [85] pillar_1.4.2             BiocManager_1.30.4       data.table_1.12.2        bitops_1.0-6            
 [89] irlba_2.3.3              R6_2.4.0                 gridExtra_2.3            codetools_0.2-16        
 [93] MASS_7.3-51.4            gtools_3.8.1             assertthat_0.2.1         rhdf5_2.29.0            
 [97] openssl_1.4.1            pkgmaker_0.27            withr_2.1.2              GenomicAlignments_1.21.5
[101] Rsamtools_2.1.4          GenomeInfoDbData_1.2.1   hms_0.5.1                quadprog_1.5-7          
[105] grid_3.6.1               tidyr_0.8.3              base64_2.0               DelayedMatrixStats_1.7.1
[109] illuminaio_0.27.1   

Could you help me ?

Best,
A

Starting from a Seurat/Signac scATAC object?

Hi,
trying to figure out how to start from the standard scATAC object generated and annotated using Seurat/Signac.
Does compartmap have the ability to use those as input? There is no existing conversion method for Seurat/Signac to RangedSummarizedExperiment.
Thank you!

estRMT probable issues

While trying to replicate this function, I noticed two cases which might cause issues:

T <- nrow(.data)

Correct me if I am wrong, but it is not clear if defining a variable using the T letter (same as the abbreviation for TRUE) would pose problems later on as T variable is heavily used in the calculation. Maybe rename it to NR?

lambdas.cleaned <- c(val, rep(1, M))
lambdas.cleaned <- c(val, rep(0, M))

maybe cause problems on the handle of output (e.g. in a temporal setting), as they give consistently different lengths of eigenvalue vector. Maybe something like:

lambdas.cleaned <- c(val, rep(1, M-length(val)))

would be more preferred?

Get travis CI working again

I would love to be able to have CI working to check for things that may be breaking changes. Also, it would be excellent to have it be able to run BiocCheck, etc. with the existing devel R version and BioC packages.

Clean out dead code

What it says on the tin. Remove any dead code that is not being used or called in any way.

Add tests for code after clean out

We pretend to have some unit tests, but actually need to add them for possible edge cases. This becomes particularly relevant when we start working out of core.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.