Giter Site home page Giter Site logo

byzhang23 / treecortreat Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 0.0 44.29 MB

TreeCorTreat

License: GNU General Public License v3.0

R 100.00%
single-cell-genomics canonical-correlation-analysis hierarchical-clustering multi-resolution treecortreat-plot association-analysis visualization

treecortreat's People

Contributors

byzhang23 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

treecortreat's Issues

Running extract_hrchy_seurat(..., type = 'seurat_obj') fails despite input being of appropriate type

Hello,
I believe there may be a problem with extract_hrchy_seurat for type = 'seurat_obj'. My code is below; the data is publicly available and unalterd from the supplemental files in GSE123587.

library(Seurat)
library(ggplot2)
library(dplyr)
library(tidyr)
library(TreeCorTreat)

progmat <- Seurat::ReadMtx(mtx = '10X_Matricies_GSE123587/GSM3507490_progression/matrix.mtx',
                features = '10X_Matricies_GSE123587/GSM3507490_progression/genes.tsv',
                cells = '10X_Matricies_GSE123587/GSM3507490_progression/barcodes.tsv')
colnames(progmat) <- paste0("progression:",colnames(progmat))

regmat <- Seurat::ReadMtx(mtx = '10X_Matricies_GSE123587/GSM3507491_regression/matrix.mtx',
                          features = '10X_Matricies_GSE123587/GSM3507491_regression/genes.tsv',
                          cells = '10X_Matricies_GSE123587/GSM3507491_regression/barcodes.tsv')
colnames(regmat) <- paste0("regression:",colnames(regmat))

if(all.equal(1:nrow(progmat),
              match(rownames(progmat),
                    rownames(regmat)
                    )
              ) 
    ){
  full.mat <- cbind(progmat,regmat)
}

sample.metdat <- data.frame("sample" = c("progression","regression"),
                            "condition" = c("progression","regression"),
                            "study" = rep("GSE123587",2))

output_dir <- paste0(getwd(),'/10X_Matricies_GSE123587/')
integration <- treecor_harmony(count = full.mat, 
                               sample_meta = sample.metdat, 
                               output_dir = output_dir)

integrated_data <- access_data_seurat(seurat_obj = integration,
                                      output_dir = output_dir)

hierarchy_structure <- extract_hrchy_seurat(input = integration, type = 'seurat_obj')

Error in `x[[i, drop = TRUE]]`:
! `i` must be one of "orig.ident", "nCount_RNA", "nFeature_RNA", "percent.mt", "sample",
  "condition", "study", "RNA_snn_res.0.5", or "seurat_clusters", not "tip.label".
Backtrace:
 1. TreeCorTreat::extract_hrchy_seurat(input = integration, type = "seurat_obj")
 3. SeuratObject:::`$.Seurat`(phylo_tree, "tip.label")
 5. SeuratObject:::`[[.Seurat`(i = i)

Examining the results of View(extract_hrchy_seurat) leads me to believe that there may be an error in line 12 of the function, where an if() statement is not followed by an open/close curly bracket ("{ ... }") which traditionally encase the conditional code chunk, but I am far from an expert in scRNAseq or R so I may be wrong. Thanks in advance!


> sessionInfo()
R version 4.2.3 (2023-03-15)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.4

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

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

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

other attached packages:
[1] TreeCorTreat_0.9.0      tidyr_1.3.0             dplyr_1.1.2             ggplot2_3.4.2           Seurat_4.9.9.9049      
[6] SeuratObject_4.9.9.9084 sp_1.6-1               

loaded via a namespace (and not attached):
  [1] Rtsne_0.16             colorspace_2.1-0       deldir_1.0-9           ellipsis_0.3.2         ggridges_0.5.4        
  [6] RcppHNSW_0.4.1         rstudioapi_0.14        spatstat.data_3.0-1    farver_2.1.1           leiden_0.4.3          
 [11] listenv_0.9.0          graphlayouts_1.0.0     ggrepel_0.9.3          RSpectra_0.16-1        fansi_1.0.4           
 [16] codetools_0.2-19       splines_4.2.3          knitr_1.43             polyclip_1.10-4        spam_2.9-1            
 [21] jsonlite_1.8.5         ica_1.0-3              cluster_2.1.4          png_0.1-8              pheatmap_1.0.12       
 [26] uwot_0.1.14            ggforce_0.4.1          shiny_1.7.4            sctransform_0.3.5      spatstat.sparse_3.0-1 
 [31] readr_2.1.4            compiler_4.2.3         httr_1.4.6             Matrix_1.5-4.1         fastmap_1.1.1         
 [36] lazyeval_0.2.2         limma_3.54.2           cli_3.6.1              tweenr_2.0.2           later_1.3.1           
 [41] htmltools_0.5.5        tools_4.2.3            igraph_1.4.3           dotCall64_1.0-2        gtable_0.3.3          
 [46] glue_1.6.2             RANN_2.6.1             reshape2_1.4.4         Rcpp_1.0.10            slam_0.1-50           
 [51] scattermore_1.2        vctrs_0.6.2            ape_5.7-1              preprocessCore_1.60.2  spatstat.explore_3.2-1
 [56] nlme_3.1-162           progressr_0.13.0       ggraph_2.1.0           lmtest_0.9-40          spatstat.random_3.1-5 
 [61] xfun_0.39              stringr_1.5.0          globals_0.16.2         mime_0.12              miniUI_0.1.1.1        
 [66] lifecycle_1.0.3        irlba_2.3.5.1          goftest_1.2-3          future_1.32.0          MASS_7.3-60           
 [71] zoo_1.8-12             scales_1.2.1           tidygraph_1.2.3        hms_1.1.3              promises_1.2.0.1      
 [76] spatstat.utils_3.0-3   parallel_4.2.3         RColorBrewer_1.1-3     yaml_2.3.7             reticulate_1.30       
 [81] pbapply_1.7-0          gridExtra_2.3          stringi_1.7.12         fastDummies_1.6.3      harmony_0.1.1         
 [86] rlang_1.1.1            pkgconfig_2.0.3        matrixStats_1.0.0      evaluate_0.21          lattice_0.21-8        
 [91] ROCR_1.0-11            purrr_1.0.1            tensor_1.5             labeling_0.4.2         patchwork_1.1.2       
 [96] htmlwidgets_1.6.2      cowplot_1.1.1          tidyselect_1.2.0       parallelly_1.36.0      RcppAnnoy_0.0.20      
[101] plyr_1.8.8             magrittr_2.0.3         R6_2.5.1               generics_0.1.3         combinat_0.0-8        
[106] withr_2.5.0            pillar_1.9.0           fitdistrplus_1.1-11    survival_3.5-5         abind_1.4-5           
[111] tibble_3.2.1           future.apply_1.11.0    Rglpk_0.6-5            KernSmooth_2.23-21     utf8_1.2.3            
[116] spatstat.geom_3.2-1    plotly_4.10.2          tzdb_0.4.0             rmarkdown_2.22         viridis_0.6.3         
[121] grid_4.2.3             data.table_1.14.8      digest_0.6.31          xtable_1.8-4           httpuv_1.6.11         
[126] munsell_0.5.0          viridisLite_0.4.2 

Function Compatibility Issue with Seurat Upgrade: Invalid Slot Names in treecor_harmony

Hi~
I hope this message finds you well. I am writing to report an issue related to the treecor_harmony function from your tool, which seems to be incompatible with the latest version of Seurat.

With the recent update to Seurat, the function call:
integration <- treecor_harmony(count = raw_data[['count']], sample_meta = raw_data[['sample_meta']], output_dir = output_dir)

results in an error due to the Seurat package's inability to recognize certain slot names. Specifically, the error message indicates:
invalid names for slots of class “Assay5”: min_cells, min_features

It appears that these slot names are no longer valid in the updated Seurat version, I am currently using R version 4.4.0 and Seurat version 5.1.0. I modified the function as follows to adapt to the new version of Seurat:

treecor_harmony <- function(count, sample_meta, output_dir, cell_meta = NULL, num_PCs = 20, 
                              num_harmony = 20, num_features = 2000,  
                              pct_mito_cutoff = 20, exclude_genes = NULL, vars_to_regress = c("sample"), 
                              resolution = 0.5, verbose = TRUE) {
    u <- CreateSeuratObject(counts = count)
  
}

I also found similar issues in another function, access_data_seurat, which also appears to be affected by Seurat's updates.

Could you please provide guidance or an updated version of your tool to address these compatibility issues? Your assistance would be greatly appreciated.

Thank you very much for your support.

Best regards,

Yingxue Xiao

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.