Closed liulei3566 closed 1 year ago
Can you show how many cells there are for each predicted.id? What's output of:
table(combined$predicted.id)
Closing this as I haven't heard back, please reopen if you are still having issues and can provide the requested information
Hi, I think I have the same problem - thanks for any help you can provide! Here is my code:
library(Seurat)
library(Signac)
library(EnsDb.Hsapiens.v86)
library(BSgenome.Hsapiens.UCSC.hg38)
folder = '/wynton/home/pollen/jwallace/S234_analysis/Signac/V4/'; dir.create(folder); setwd(folder)
fragment_dir = '/wynton/scratch/jwallace/Fragment_files/Fragment_files_all_prefix/'
macs2_temp = '/wynton/scratch/jwallace/Fragment_files/Macs2_temp/'; dir.create(macs2_temp)
macs2_path = "/wynton/home/pollen/jwallace/envs/env_signac/bin/macs2"
rna <- readRDS('rna.rds')
annotation <- readRDS("annotation.rds")
newlevels <- paste('chr', seqlevels(annotation), sep=""); newlevels[25] <- "chrM"; seqlevels(annotation) <- newlevels
genome(annotation) <- "hg38"
human_rna <- subset(rna, species == 'human')
#Make fragment objects for all conditions
file_prefixes = c("S_","K1_","K6_","1_K1_t1_","2_K1_t1_","1_K1_t2_","1_K6_t1_",
"2_K6_t1_","1_K6_t2_","2_S_t1_","1_S_t2_","1_P1_t2_","1_P6_t2_") #make sure these are in same order as barcode prefixes
barcode_prefixes = c("S","K1","K6","k1_t1_1","k1_t1_2","k1_t2","k6_t1_1","k6_t1_2",
"k6_t2","s_t1_2","s_t2","p1","p6")
frags_list = list()
for (i in seq_along(file_prefixes)){
cells = colnames(subset(human_rna, subset = orig.ident== barcode_prefixes[i]))
frags_list[i] <- CreateFragmentObject(path = file.path(fragment_dir,paste(file_prefixes[i], "Human_fragments.tsv.gz",sep="")), cells = cells)
}
fragpath = dir(fragment_dir,"*gz$",full.names=TRUE)
#call peaks using macs2 on all cells
peaks_all <- CallPeaks(fragpath, macs2.path = macs2_path,fragment.tempdir = macs2_temp, verbose = TRUE)#if getting weird errors, restart session
peaks_all <- keepStandardChromosomes(peaks_all, pruning.mode = "coarse")
peaks_all <- subsetByOverlaps(x = peaks_all, ranges = blacklist_hg38_unified, invert = TRUE)
macs2_counts <- FeatureMatrix(fragments = frags_list,features = peaks_all,cells = NULL)
During the FeatureMatrix step, I get the output and error:
Extracting reads overlapping genomic regions
Extracting reads overlapping genomic regions
Extracting reads overlapping genomic regions
Extracting reads overlapping genomic regionsection refused
Extracting reads overlapping genomic regions
Extracting reads overlapping genomic regions
Extracting reads overlapping genomic regions
Extracting reads overlapping genomic regions
Extracting reads overlapping genomic regions
Extracting reads overlapping genomic regions
Extracting reads overlapping genomic regions
Extracting reads overlapping genomic regions
Extracting reads overlapping genomic regions
Error: non-conformable matrix dimensions in dimCheck(e1, e2)
I also tried
cells = colnames(human_rna)
in the call to FeatureMatrix, but that gave the same error. I do not get the error if I call FeatureMatrix on each fragment object individually instead of the whole list.
My session info is: R version 4.2.0 (2022-04-22) Platform: x86_64-pc-linux-gnu (64-bit) Running under: CentOS Linux 7 (Core)
Matrix products: default BLAS: /wynton/home/cbi/shared/software/CBI/R-4.2.0-gcc10/lib64/R/lib/libRblas.so LAPACK: /wynton/home/cbi/shared/software/CBI/R-4.2.0-gcc10/lib64/R/lib/libRlapack.so
locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US$ [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C $ [9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATIO$
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] Signac_1.9.0 SeuratObject_4.1.3 Seurat_4.3.0
loaded via a namespace (and not attached): [1] Rtsne_0.16 colorspace_2.1-0 deldir_1.0-6 ellipsis_0.3.2 ggri$ [6] XVector_0.38.0 GenomicRanges_1.50.2 rstudioapi_0.14 spatstat.data_3.0-1 leid$ [11] listenv_0.9.0 ggrepel_0.9.3 fansi_1.0.4 codetools_0.2-19 spli$ [16] RcppRoll_0.3.0 polyclip_1.10-4 jsonlite_1.8.4 Rsamtools2.14.0 ica$ [21] cluster_2.1.4 png_0.1-8 uwot_0.1.14 shiny_1.7.4 sctr$ [26] spatstat.sparse_3.0-1 compiler_4.2.0 httr_1.4.6 Matrix_1.5-4 fast$ [31] lazyeval_0.2.2 cli_3.6.1 later_1.3.1 htmltools_0.5.5 tool$ [36] igraph_1.4.2 gtable_0.3.3 glue_1.6.2 GenomeInfoDbData_1.2.9 RANN$ [41] reshape2_1.4.4 dplyr_1.1.2 fastmatch_1.1-3 Rcpp_1.0.10 scat$ [46] Biostrings_2.66.0 vctrs_0.6.2 spatstat.explore_3.2-1 nlme_3.1-162 prog$ [51] lmtest_0.9-40 spatstat.random_3.1-5 stringr_1.5.0 globals_0.16.2 mime$ [56] miniUI_0.1.1.1 lifecycle_1.0.3 irlba_2.3.5.1 goftest_1.2-3 futu$ [61] zlibbioc_1.44.0 MASS_7.3-60 zoo_1.8-12 scales_1.2.1 prom$ [66] spatstat.utils_3.0-3 parallel_4.2.0 RColorBrewer_1.1-3 reticulate_1.28 pbap$ [71] gridExtra_2.3 ggplot2_3.4.2 stringi_1.7.12 S4Vectors_0.36.2 Bioc$ [76] BiocParallel_1.32.6 GenomeInfoDb_1.34.9 rlang_1.1.1 pkgconfig_2.0.3 matr$ [81] bitops_1.0-7 lattice_0.21-8 ROCR_1.0-11 purrr_1.0.1 tens$ [86] patchwork_1.1.2 htmlwidgets_1.6.2 cowplot_1.1.1 tidyselect_1.2.0 para$ [91] RcppAnnoy_0.0.20 plyr_1.8.8 magrittr_2.0.3 R6_2.5.1 IRan$ [96] generics_0.1.3 pillar_1.9.0 fitdistrplus_1.1-11 survival_3.5-5 abin$ [101] RCurl_1.98-1.12 sp_1.6-0 tibble_3.2.1 future.apply_1.10.0 cray$ [106] KernSmooth_2.23-21 utf8_1.2.3 spatstat.geom_3.2-1 plotly_4.10.1 grid$ [111] data.table_1.14.8 digest_0.6.31 xtable_1.8-4 tidyr_1.3.0 http$ [116] stats4_4.2.0 munsell_0.5.0 viridisLite_0.4.2
Hi, I got the Error: non-conformable matrix dimensions in dimCheck(e1, e2) when I used FeatureMatrix function after the CallPeaks. I run several tissues with the same code, all of them are successful except Muscle. When I change group.by = "predicted.id" to group.by = "seurat_clusters", it also worked. I have no idea how to solve the error when set group.by = "predicted.id".
The command and error are as follow: library(Signac) library(Seurat) library(GenomicRanges)
setwd('/Desktop/datafile') dir.create('./3callpeakDAR/output_Muscle_predict') combined <- readRDS("./2transfer/output_Muscle/Muscle_transfer.rds")
DefaultAssay(combined) <- "ATAC" peaks <- CallPeaks(object = combined, effective.genome.size = 2.5e9, combine.peaks = TRUE, group.by = "predicted.id")
quantify counts in each peak
macs2_counts <- FeatureMatrix(Fragments(combined), features=peaks, cells = colnames(combined))
...... [W::hts_idx_load3] The index file is older than the data file: /Desktop/datafile/Muscle/fragments.tsv.gz.tbi |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02m 28s Error: non-conformable matrix dimensions in dimCheck(e1, e2)