Code Monkey home page Code Monkey logo

projectils's People

Contributors

halterc avatar jgarnica22 avatar mass-a avatar p-gueguen avatar sjcarmona avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

projectils's Issues

Package test failed

Hi,

I should also report that the test data failed as well.

I should have mentioned that I am running R 4.2.0

Thanks

Output and error below:

library(ProjecTILs)
data(query_example_seurat)

Run.ProjecTILs(query_example_seurat)
[1] "Loading Default Reference Atlas..."
[1] "/Seurat/ref_TILAtlas_mouse_v1.rds"
[1] "Loaded Reference map ref_TILAtlas_mouse_v1"
[1] "Using assay RNA for query"
Pre-filtering cells with scGate...
No scGate model specified: using default filter for T cells

Detected a total of 34 non-pure cells for Target (2.27% of total)

[1] "34 out of 1501 ( 2% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
Performing log-normalization
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
[1] "Aligning query to reference map for batch-correction..."
|======================================================================| 100%
Computing within dataset neighborhoods
Finding all pairwise anchors
Finding neighborhoods
Finding anchors
Found 645 anchors
SD on anchor distances: 0.088

Projecting corrected query onto Reference PCA space

Projecting corrected query onto Reference UMAP space
Error in cellstate.predict(ref = ref, query = x, reduction = reduction, :
trying to get slot "misc" from an object of a basic class ("NULL") with no slots

unable to install scGate or ProjecTILs libraries

Hi, I have been trying to install these libraries into R-Studio, but I keep getting the following errors:

remotes::install_github("carmonalab/scGate")
Downloading GitHub repo carmonalab/scGate@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All
2: CRAN packages only
3: None
4: stringi (1.7.6 -> 1.7.8) [CRAN]

Enter one or more numbers, or an empty line to skip updates: 1
stringi (1.7.6 -> 1.7.8) [CRAN]
Skipping 1 packages not available: UCell
Installing 2 packages: stringi, UCell
Installing packages into ‘C:/Users/ashka/Documents/renv/library/R-4.1/x86_64-w64-mingw32’
(as ‘lib’ is unspecified)

There is a binary version available but the source version is later:
binary source needs_compilation
stringi 1.7.6 1.7.8 TRUE

Binaries will be installed
trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.1/stringi_1.7.6.zip'
Content type 'application/zip' length 16449819 bytes (15.7 MB)
downloaded 15.7 MB

package ‘stringi’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\ashka\AppData\Local\Temp\Rtmpc50GBN\downloaded_packages
Running R CMD build...

  • checking for file 'C:\Users\ashka\AppData\Local\Temp\Rtmpc50GBN\remotes73b047e96ee2\carmonalab-scGate-1b23084/DESCRIPTION' ... OK
  • preparing 'scGate':
  • checking DESCRIPTION meta-information ... OK
  • checking for LF line-endings in source and make files and shell scripts
  • checking for empty or unneeded directories
  • building 'scGate_1.2.0.tar.gz'
    Installing package into ‘C:/Users/ashka/Documents/renv/library/R-4.1/x86_64-w64-mingw32’
    (as ‘lib’ is unspecified)
    ERROR: dependency 'UCell' is not available for package 'scGate'
  • removing 'C:/Users/ashka/Documents/renv/library/R-4.1/x86_64-w64-mingw32/scGate'
    Warning messages:
    1: In untar2(tarfile, files, list, exdir, restore_times) :
    skipping pax global extended headers
    2: In untar2(tarfile, files, list, exdir, restore_times) :
    skipping pax global extended headers
    3: package ‘UCell’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
4: In i.p(...) :
installation of package ‘C:/Users/ashka/AppData/Local/Temp/Rtmpc50GBN/file73b0491424d0/scGate_1.2.0.tar.gz’ had non-zero exit status

remotes::install_github("carmonalab/ProjecTILs")
Downloading GitHub repo carmonalab/ProjecTILs@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All
2: CRAN packages only
3: None
4: stringi (1.7.6 -> 1.7.8) [CRAN]

Enter one or more numbers, or an empty line to skip updates:
Running R CMD build...

  • checking for file 'C:\Users\ashka\AppData\Local\Temp\Rtmpc50GBN\remotes73b014782336\carmonalab-ProjecTILs-370abd8/DESCRIPTION' ... OK
  • preparing 'ProjecTILs':
  • checking DESCRIPTION meta-information ... OK
  • checking for LF line-endings in source and make files and shell scripts
  • checking for empty or unneeded directories
  • building 'ProjecTILs_3.0.0.tar.gz'
    Installing package into ‘C:/Users/ashka/Documents/renv/library/R-4.1/x86_64-w64-mingw32’
    (as ‘lib’ is unspecified)
    ERROR: dependencies 'UCell', 'scGate' are not available for package 'ProjecTILs'
  • removing 'C:/Users/ashka/Documents/renv/library/R-4.1/x86_64-w64-mingw32/ProjecTILs'
    Warning messages:
    1: In untar2(tarfile, files, list, exdir, restore_times) :
    skipping pax global extended headers
    2: In untar2(tarfile, files, list, exdir, restore_times) :
    skipping pax global extended headers
    3: In i.p(...) :
    installation of package ‘C:/Users/ashka/AppData/Local/Temp/Rtmpc50GBN/file73b07ff54eff/ProjecTILs_3.0.0.tar.gz’ had non-zero exit status

I have been able to successfully install the packages on another computer a few months ago, so I'm not sure what the problem is now. Can someone help me with this? Thanks!

Ensembl transcript IDs

Hello,

Great package!

I was hoping that you would be able to provide a separate reference map with ensembl transcript IDs instead of gene ids. It does not seem like Seurat supports using feature level metadata that would make converting on our end possible (when we start our analysis with ensembl transcript IDs).

Thanks!

Patrick

plot.states.radar does not work when query data not provided

Hi,
plot.states.radar does not work when query not provided contrary to what is expected based on the documentation.

 ref <- load.reference.map()
plot.states.radar(ref)
Error in row.names(query[[i]]@assays[[query.assay]]@data) : 
  trying to get slot "assays" from an object of a basic class ("NULL") with no slots

image

Reference atlases with counts data

Thanks again for this great package which is a great enrichment for the single cell RNA-seq community I think and helped me in better understanding T cell clusters.

@mass-a Would it be possible to provide the full data of the reference atlases, that means including count data, variable genes etc. (e.g. via figashare)?

The background is that with larger datasets integration via Seurat I have memory issues (with 64GB RAM available), plus it takes really long. Additionally, in several datasets integration fails with Error in idx[i, ] <- res[[i]][[1]]: number of items to replace is not a multiple of replacement length. I read issue 16, but in my dataset I have mostly T cells (between ~60-90% based on the filtering).

full log of make.projection with a list with 5 T cell datasets and ref_TIL
[1] "Using assay SCT for N_COVID_CSF"
[1] "196 out of 1524 ( 13 % ) non-pure T cells removed.  Use filter.cells=FALSE to avoid pre-filtering (NOT RECOMMENDED)"
[1] "Transforming expression matrix into space of mouse orthologs"
[1] "Aligning N_COVID_CSF to reference map for batch-correction..."
[1] "DIRECTLY projecting query onto Reference PCA space"
[1] "DIRECTLY projecting query onto Reference UMAP space"
[1] "Using assay SCT for PostCOVID_blood"
[1] "1234 out of 3667 ( 34 % ) non-pure T cells removed.  Use filter.cells=FALSE to avoid pre-filtering (NOT RECOMMENDED)"
[1] "Transforming expression matrix into space of mouse orthologs"
[1] "Aligning PostCOVID_blood to reference map for batch-correction..."
[1] "DIRECTLY projecting query onto Reference PCA space"
[1] "DIRECTLY projecting query onto Reference UMAP space"
Pre-filtering of T cells (TILPRED classifier)...
Genes in the gene sets NOT available in the dataset: 
	B.cell: 	6 (12% of 50)
	CAF: 	12 (24% of 49)
	Endo.: 	11 (24% of 46)
	Macrophage: 	5 (11% of 46)
	Mal: 	8 (18% of 45)
Computing within dataset neighborhoods
Finding all pairwise anchors
Projecting new data onto SVD
Projecting new data onto SVD
Finding neighborhoods
Finding anchors
	Found 144 anchors
Alignment failed due to: Error in idx[i, ] <- res[[i]][[1]]: number of items to replace is not a multiple of replacement length
 

Warning: alignment of query dataset failed - Trying direct projection...
Pre-filtering of T cells (TILPRED classifier)...
Genes in the gene sets NOT available in the dataset: 
	B.cell: 	6 (12% of 50)
	CAF: 	12 (24% of 49)
	Endo.: 	11 (24% of 46)
	Macrophage: 	5 (11% of 46)
	Mal: 	8 (18% of 45)
Computing within dataset neighborhoods
Finding all pairwise anchors
Projecting new data onto SVD
Projecting new data onto SVD
Finding neighborhoods
Finding anchors
	Found 124 anchors
Alignment failed due to: Error in idx[i, ] <- res[[i]][[1]]: number of items to replace is not a multiple of replacement length
 

Warning: alignment of query dataset failed - Trying direct projection...
[1] "Using assay SCT for PostCOVID_CSF"
[1] "1497 out of 5878 ( 25 % ) non-pure T cells removed.  Use filter.cells=FALSE to avoid pre-filtering (NOT RECOMMENDED)"
[1] "Transforming expression matrix into space of mouse orthologs"
[1] "Aligning PostCOVID_CSF to reference map for batch-correction..."
[1] "DIRECTLY projecting query onto Reference PCA space"
[1] "DIRECTLY projecting query onto Reference UMAP space"
[1] "Using assay SCT for IIH_CSF"
[1] "1159 out of 4887 ( 24 % ) non-pure T cells removed.  Use filter.cells=FALSE to avoid pre-filtering (NOT RECOMMENDED)"
[1] "Transforming expression matrix into space of mouse orthologs"
[1] "Aligning IIH_CSF to reference map for batch-correction..."

Projecting corrected query onto Reference PCA space
[1] "Projecting corrected query onto Reference UMAP space"
[1] "Using assay SCT for IIH_blood"
[1] "1750 out of 8326 ( 21 % ) non-pure T cells removed.  Use filter.cells=FALSE to avoid pre-filtering (NOT RECOMMENDED)"
[1] "Transforming expression matrix into space of mouse orthologs"
[1] "Aligning IIH_blood to reference map for batch-correction..."

Projecting corrected query onto Reference PCA space
[1] "Projecting corrected query onto Reference UMAP space"
Pre-filtering of T cells (TILPRED classifier)...
Genes in the gene sets NOT available in the dataset: 
	B.cell: 	6 (12% of 50)
	CAF: 	12 (24% of 49)
	Endo.: 	11 (24% of 46)
	Macrophage: 	5 (11% of 46)
	Mal: 	8 (18% of 45)
Computing within dataset neighborhoods
Finding all pairwise anchors
Projecting new data onto SVD
Projecting new data onto SVD
Finding neighborhoods
Finding anchors
	Found 118 anchors
Alignment failed due to: Error in idx[i, ] <- res[[i]][[1]]: number of items to replace is not a multiple of replacement length
 

Warning: alignment of query dataset failed - Trying direct projection...
Pre-filtering of T cells (TILPRED classifier)...
Genes in the gene sets NOT available in the dataset: 
	B.cell: 	6 (12% of 50)
	CAF: 	12 (24% of 49)
	Endo.: 	11 (24% of 46)
	Macrophage: 	5 (11% of 46)
	Mal: 	8 (18% of 45)
Computing within dataset neighborhoods
Finding all pairwise anchors
Projecting new data onto SVD
Projecting new data onto SVD
Finding neighborhoods
Finding anchors
	Found 129 anchors
Pre-filtering of T cells (TILPRED classifier)...
Genes in the gene sets NOT available in the dataset: 
	B.cell: 	6 (12% of 50)
	CAF: 	12 (24% of 49)
	Endo.: 	11 (24% of 46)
	Macrophage: 	5 (11% of 46)
	Mal: 	8 (18% of 45)
Computing within dataset neighborhoods
Finding all pairwise anchors
Projecting new data onto SVD
Projecting new data onto SVD
Finding neighborhoods
Finding anchors
	Found 150 anchors

sessionInfo [1] future.apply_1.8.1 future_1.22.1 ProjecTILs_1.0.0 Matrix_1.3-4 [5] TILPRED_1.0.2 umap_0.2.7.0 SeuratObject_4.0.2 Seurat_4.0.4 [9] forcats_0.5.1 stringr_1.4.0 dplyr_1.0.7 purrr_0.3.4 [13] readr_2.0.2 tidyr_1.1.4 tibble_3.1.5 ggplot2_3.3.5 [17] tidyverse_1.3.1

Therefore, I would like to use Harmony or Symphony which are much faster and need much less memory and are, in my experience, equally good or even better than Seurat integration ... although I am huge Seurat fan.

Maybe you could also think about using Harmony or Symphony because I think your visualizations are unique ... but probably that would mean completely rewriting the package .. so it would be great if you could provide the entire full atlases so that users can use these reference atlases with other algorithms that need the count data/variable genes.

Thank you,
Mischko

EDIT: When integrating selected CD8 clusters of different conditions (between 400-900 cells) (both with and witout filter) to the beautiful ref_LCMV_Atlas, they all fail with the same error: Error in idx[i, ] <- res[[i]][[1]]: number of items to replace is not a multiple of replacement length. I lowered seurat.k.filter = 20 without any effect.

error: could not find function "Run.ProjecTILs"

Hi there, firstly thanks for this lovely and very useful package and excellent vignettes.

Recently I've been encountering the above error when trying to run the projection wrapper function. I encounter this error both when using my query dataset and when I use the package provided query data in your vignette

see below an example:

query.projected <- Run.ProjecTILs(querydata, ref = ref)
Error in Run.ProjecTILs(querydata, ref = ref) :
could not find function "Run.ProjecTILs"

sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS 13.0.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/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] GEOquery_2.62.2 Biobase_2.54.0 BiocGenerics_0.40.0 viridis_0.6.2
[5] viridisLite_0.4.0 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.9
[9] purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.1.8
[13] tidyverse_1.3.2 magrittr_2.0.3 ProjecTILs_2.2.1 scGate_1.2.0
[17] UCell_1.3.1 pracma_2.3.8 scales_1.2.0 ggplot2_3.3.6
[21] reshape2_1.4.4 gridExtra_2.3 BiocParallel_1.28.3 Matrix_1.4-1
[25] umap_0.2.8.0 sp_1.5-0 SeuratObject_4.1.0 Seurat_4.1.1

any advice please?

Alignment failed due to: Error in intI...

Hey,

I noticed an error when running make.projection, which looks to be circumvented by an alternative approach. We are seeing some fairly major discrepancies between our manually defined clusters and ProjecTILs annotation downstream, so I'm wondering if performance is reduced due to this error, and if so can it be fixed.

If this likely isn't the issue I may open an analysis oriented issue to tackle the discrepancy directly.

Thanks in advance for any assistance, command+error shown below.

> seu.ref <- make.projection(seu, ref=ref, skip.normalize = T)
[1] "Using assay RNA for query"
Pre-filtering of T cells (TILPRED classifier)...
Genes in the gene sets NOT available in the dataset: 
	B.cell: 	10 (20% of 50)
	CAF: 	19 (39% of 49)
	Endo.: 	11 (24% of 46)
	Macrophage: 	3 (7% of 46)
	Mal: 	9 (20% of 45)
[1] "2697 out of 14001 ( 19 % ) non-pure T cells removed.  Use filter.cells=FALSE to avoid pre-filtering (NOT RECOMMENDED)"
[1] "Transforming expression matrix into space of mouse orthologs"
[1] "Aligning query to reference map for batch-correction..."
  |===========================================================================================================================| 100%
Computing within dataset neighborhoods
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=07s  
Finding all pairwise anchors
  |                                                  | 0 % ~calculating  
Alignment failed due to: Error in intI(i, n = d[1], dn[[1]], give.dn = FALSE): invalid character indexing
 

Warning: alignment of query dataset failed - Trying direct projection...

human.ortho argument should be re-enabled

Hi,

it might be worth to re-enable the human.ortho argument of make.projection(). Currently, the value of this argument is ignored, since projection.helper() automatically detects whether it should convert human to murine gene names.

However, I am using a custom reference atlas with human gene names and want to project datasets with human gene names onto that. Currently, this is only possible by hacking the package code (see below), since ProjecTILs converts gene names of the query dataset to their murine orthologs and then is (obviously) unable to find these genes in the reference.

My current workaround:

convert.orthologs.id <- function(x, ...) x
environment(convert.orthologs.id) <- asNamespace("ProjecTILs")
assignInNamespace("convert.orthologs", convert.orthologs.id, ns = "ProjecTILs")

kind regards,
Wolfgang

Error using docker images

hello,

Thank you very much for creating such great software !!!

I download the images and run following the suggestions:

docker run --rm -p 8787:8787 -e PASSWORD=pass mandrea1/projectils_demo:1.0.0
remotes::install_github("carmonalab/UCell")

But I met some erros:

Error in file(filename, "r", encoding = encoding) : 
  cannot open the connection
Calls: source -> file
In addition: Warning message:
In file(filename, "r", encoding = encoding) :
  cannot open file 'renv/activate.R': No such file or directory
Execution halted
ERROR: lazy loading failed for package ‘BiocGenerics’
* removing ‘/home/rstudio/renv/library/R-4.0/x86_64-pc-linux-gnu/BiocGenerics’
* installing *binary* package ‘bitops’ ...
* DONE (bitops)
* installing *source* package ‘GenomeInfoDbData’ ...
** using staged installation
** data
** inst
** help
*** installing help indices
** building package indices
Error in file(filename, "r", encoding = encoding) : 
  cannot open the connection
Calls: source -> file
In addition: Warning message:
In file(filename, "r", encoding = encoding) :
  cannot open file 'renv/activate.R': No such file or directory
Execution halted

Best

Pb download reference map

hello when entering ref <- load.reference.map() after installation, I got the following message after one minute of download:
Erreur dans value[3L] : Sorry, it didn't work.
De plus : Messages d'avis :
1: Dans download.file(refUrl, refFileName) :
taille téléchargée 150203817 != taille déclarée 425291994
2: Dans download.file(refUrl, refFileName) :
URL ‘https://s3-eu-west-1.amazonaws.com/pfigshare-u-files/23136746/ref_TILAtlas_mouse_v1.rds?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=4869b6042f6757f31bd777687a2b9ef25892885b2c91dcb338a857ef303f85a2&X-Amz-Date=20210923T144414Z&X-Amz-Credential=AKIAIYCQYOYV5JSSROOA/20210923/eu-west-1/s3/aws4_request’: délais maximal de 60 secondes atteint

I am using R4.1 on Linux with Rstudio1.4.17.17
Thanks

Issue Making a Reference - Dimension is zero

I'm trying to create a reference from a processed scRNAseq dataset (downloaded online). It appears the dataset is already normalized with the UMAP data present. When I run:

DimPlot(dataset, group.by = "cell_type", label = T, repel = T, label.size = 4) +
theme(aspect.ratio = 1) + NoLegend()

It produces the UMAP plot with the labels.

However, when I try to make the reference:

ref <- make.reference(ref = dataset, ndim = ndim, seed = seed, recalculate.umap = TRUE,
annotation.column = "cell_type")

It produces:

Error in svd(x, nu = 0, nv = k) : a dimension is zero

Here is the session_info():

R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=English_Canada.utf8 LC_CTYPE=English_Canada.utf8 LC_MONETARY=English_Canada.utf8 LC_NUMERIC=C
[5] LC_TIME=English_Canada.utf8

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

other attached packages:
[1] scGate_1.4.1 data.table_1.14.8 ProjecTILs_3.0.3 lubridate_1.9.2
[5] forcats_1.0.0 stringr_1.5.0 purrr_1.0.1 readr_2.1.4
[9] tibble_3.2.1 tidyverse_2.0.0 plyr_1.8.8 scMiko_0.1.0
[13] flexdashboard_0.6.1 tidyr_1.3.0 SeuratObject_4.1.3 Seurat_4.3.0
[17] dplyr_1.1.1 ggplot2_3.4.1 SingleCellExperiment_1.20.1 DESeq2_1.36.0
[21] SummarizedExperiment_1.28.0 Biobase_2.58.0 GenomicRanges_1.50.2 GenomeInfoDb_1.34.9
[25] IRanges_2.32.0 S4Vectors_0.34.0 BiocGenerics_0.44.0 MatrixGenerics_1.8.1
[29] matrixStats_0.62.0

loaded via a namespace (and not attached):
[1] utf8_1.2.3 spatstat.explore_3.1-0 reticulate_1.28 tidyselect_1.2.0 RSQLite_2.2.14
[6] AnnotationDbi_1.58.0 htmlwidgets_1.6.2 grid_4.2.0 BiocParallel_1.32.6 Rtsne_0.16
[11] munsell_0.5.0 codetools_0.2-19 ica_1.0-3 umap_0.2.10.0 future_1.32.0
[16] miniUI_0.1.1.1 withr_2.5.0 spatstat.random_3.1-4 colorspace_2.1-0 progressr_0.13.0
[21] knitr_1.42 rstudioapi_0.14 ROCR_1.0-11 tensor_1.5 listenv_0.9.0
[26] labeling_0.4.2 GenomeInfoDbData_1.2.9 polyclip_1.10-4 farver_2.1.1 bit64_4.0.5
[31] pheatmap_1.0.12 parallelly_1.35.0 vctrs_0.6.1 generics_0.1.3 xfun_0.38
[36] timechange_0.2.0 R6_2.5.1 locfit_1.5-9.7 flexmix_2.3-19 bitops_1.0-7
[41] spatstat.utils_3.0-2 cachem_1.0.7 DelayedArray_0.24.0 promises_1.2.0.1 scales_1.2.1
[46] nnet_7.3-17 gtable_0.3.3 globals_0.16.2 goftest_1.2-3 rlang_1.1.0
[51] genefilter_1.78.0 splines_4.2.0 lazyeval_0.2.2 spatstat.geom_3.1-0 yaml_2.3.7
[56] reshape2_1.4.4 abind_1.4-5 httpuv_1.6.9 tools_4.2.0 ellipsis_0.3.2
[61] jquerylib_0.1.4 RColorBrewer_1.1-3 ggridges_0.5.4 Rcpp_1.0.10 zlibbioc_1.44.0
[66] RCurl_1.98-1.12 openssl_2.0.6 deldir_1.0-6 pbapply_1.7-0 cowplot_1.1.1
[71] zoo_1.8-11 ggrepel_0.9.3 cluster_2.1.4 magrittr_2.0.3 RSpectra_0.16-1
[76] scattermore_0.8 lmtest_0.9-40 RANN_2.6.1 fitdistrplus_1.1-8 hms_1.1.3
[81] patchwork_1.1.2 mime_0.12 evaluate_0.20 xtable_1.8-4 XML_3.99-0.9
[86] gridExtra_2.3 UCell_2.2.0 compiler_4.2.0 KernSmooth_2.23-20 crayon_1.5.2
[91] htmltools_0.5.5 later_1.3.0 tzdb_0.3.0 geneplotter_1.74.0 DBI_1.1.3
[96] MASS_7.3-58.2 Matrix_1.5-3 cli_3.6.1 parallel_4.2.0 igraph_1.4.1
[101] pkgconfig_2.0.3 sp_1.6-0 plotly_4.10.1 spatstat.sparse_3.0-1 annotate_1.74.0
[106] bslib_0.4.2 EnhancedVolcano_1.14.0 XVector_0.38.0 digest_0.6.31 sctransform_0.3.5
[111] RcppAnnoy_0.0.20 pracma_2.4.2 spatstat.data_3.0-1 Biostrings_2.64.0 rmarkdown_2.21
[116] leiden_0.4.3 uwot_0.1.14 shiny_1.7.4 modeltools_0.2-23 lifecycle_1.0.3
[121] nlme_3.1-162 jsonlite_1.8.4 BiocNeighbors_1.16.0 viridisLite_0.4.1 askpass_1.1
[126] fansi_1.0.4 pillar_1.9.0 lattice_0.20-45 KEGGREST_1.36.3 fastmap_1.1.1
[131] httr_1.4.5 survival_3.3-1 glue_1.6.2 png_0.1-8 bit_4.0.4
[136] stringi_1.7.12 sass_0.4.5 blob_1.2.4 memoise_2.0.1 irlba_2.3.5.1
[141] future.apply_1.10.0

Thanks

Robust number of dimension adopted in cellstate.predict

Hi the team,

I've noticed the default ndim and k is 10 and 20 separately for cellstate.predict function. My concern is these parameters may not fit large query dataset. What is the recommended way to adjust those parameters, for example, would it be rationale to adopt ndim PCs based on Seurat::ElbowPlot knee point (like Seurat did) on the "projected object" with integrated reference and query dataset:

projected.obj <- make.projection(query = q.obj, ref=r.obj, filter.cells=FALSE)
projected.obj <- projected.obj %>% ScaleData() %>% RunPCA(npcs = 100)
ElbowPlot(projected.obj, ndims = 50)

Interestingly, a large projected object with more than 90k cells over 699 integrating features showed knee point around 10 PCs in Seurat::ElbowPlot, that seems confirm the default parameter, :).

bless~
Xingliang

What normalization has been done to data?

I downloaded the seurat object from https://spica.unil.ch/refs.

I'm wondering for the following RNA data

b <- readRDS('/group/singlecell/mouse/andreata_2021_t_cell_atlas/ref_TILAtlas_mouse_v1.rds')
b@assays$RNA@data

is the counts normalized in the following way: log (1 + 10,000 x / S)? as describe in the paper

Human TILs ATLAS

Hi,
Thank for making this wounderful package. I am currently having Human cancer single-cell data and i wanted to analyse my data by using ProjecTILS. My question is can I use Default Reference Atlas(Mouse) to analyse Human cancer Single-cell RNAseq data sets?
It would be great if you can let me know where can I find the human reference TILs to use with this package.
Thanks a lot for your help.
Have a great day,
Ateeq

predictTilState ERROR

Hi!

Thanks for your package.

I am trying to follow the following case study https://carmonalab.github.io/ProjecTILs_CaseStudies/SadeFeldman_ortho.html using my scRNAseq data (CD3+ T cells).

However, when I run make.projection on my Seurat object I get the following error:

Error in predictTilState(sce, human = human) : Too many genes not found
In addition: Warning message:
In predictTilState(sce, human = human) :
The following genes were not found in the dataset provided CD2,CD3D,CD3E,CD247,LCK,CD8B,CD8A,CD4,...

When I run:
c("CD3D", "CD3E", "CD247", "LCK") %in% row.names(sobj) TRUE TRUE TRUE TRUE

sobj here is my seurat object.

I noticed that in the query_example_seurat the gene name format is with lower cases (eg "Cd3d"). However even if I change the format of my gene names I get the same error.

Could you please help me?

Thanks a lot

Francesco

Cycling score

Dear authors,

congrats on this awesome utility. I'm wondering if you have implemented the calculation of the cycling score on ProjectTILs as with TILPRED. I have not seen ProjectTILs return this value.

Thanks for your time.

Best,

Juan L.

Error even when redoing the sample code

I run:
`> library(ProjecTILs)

ref <- load.reference.map()
[1] "Loading Default Reference Atlas..."
[1] "/home/ubuntu/TIL/ref_TILAtlas_mouse_v1.rds"
[1] "Loaded Reference map ref_TILAtlas_mouse_v1"
querydata <- ProjecTILs::query_example_seurat
query.projected <- make.projection(querydata, ref=ref)
[1] "Using assay RNA for query"
Pre-filtering of T cells (TILPRED classifier)...
Error in value[3L] :
invalid subscript 'e' in 'altExp(, type="character", ...)':
'RNA' not in 'altExpNames()'
But I got the error here. Error in value[3L] :
invalid subscript 'e' in 'altExp(, type="character", ...)':
'RNA' not in 'altExpNames()'
`
What should I do?

Custom Reference Altas

Thanks for creating such a powerful tool, I have been projecting my own human and mouse data onto the supplied reference atlas and found it to be a great addition to my standard workflow.

However, I have been having some trouble generating my own reference atlas. I think this is due to a lot of objects in ref.atlas@misc.

If you could share the code that was used to generate the structure of the atlas it would help me out, thanks!

Error in value[[3L]](cond) : Reference object ../ref_TILAtlas_mouse_v1.rds is invalid

I can see the file sitting in my directory, it's there it just won't load. All packages installed with no issues, so any help would be appreciated.
[1] "Loading Default Reference Atlas..."
[1] "global_path_to_working_directory/ref_TILAtlas_mouse_v1.rds"
Error in value[[3L]](cond) : Reference object global_path_to_working_directory/ref_TILAtlas_mouse_v1.rds is invalid

Enhancement: Status bar

As title says. Would be nice-to-have as a quality-of-life enhancement.

Print length(object$Samples) and then print how many out of total were processed.

T cell genes not found error

Hi:

I run ProjectTILs in human T cells data following the tutorial, but got this error. I ran the mouse data with the same command and it works fine.

What do you think might cause the error?

thanks for your time

query.projected <- make.projection(seurat.obj, ref = ref)

got the error below
[1] "Using assay RNA for query"
Pre-filtering of T cells (TILPRED classifier)...

Error in predictTilState(sce, human = human): T cell genes not found
Traceback:

  1. make.projection(seurat.obj, ref = ref)
  2. filterCells(query, human = human.ortho)
  3. predictTilState(sce, human = human)
  4. stop("T cell genes not found")

session info below

R version 4.0.1 (2020-06-06)
Platform: x86_64-conda_cos6-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.7 (Maipo)

Matrix products: default
BLAS/LAPACK: /data/miniconda3/envs/R_4.0.x/lib/libopenblasp-r0.3.9.so

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

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

other attached packages:
[1] gridExtra_2.3 ProjecTILs_0.5.1

TIL Atlas reference atlas invalid

Hey
Thank you for your tool

I am trying to use the "ref_TILAtlas_mouse_v1.rds", but it keeps saying that the reference object is invalid and is giving me this error "Error in value[3L]". I can not import it as a Seurat object either

Here is my session info. Would appreciate any help

R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

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

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

other attached packages:
[1] dplyr_1.0.7        ProjecTILs_1.0.0   Matrix_1.3-4       TILPRED_1.0.2      umap_0.2.7.0       SeuratObject_4.0.2
[7] Seurat_4.0.4      

loaded via a namespace (and not attached):
  [1] nlme_3.1-153          matrixStats_0.61.0    spatstat.sparse_2.0-0 RcppAnnoy_0.0.19      RColorBrewer_1.1-2   
  [6] httr_1.4.2            sctransform_0.3.2     tools_4.1.1           utf8_1.2.2            R6_2.5.1             
 [11] irlba_2.3.3           rpart_4.1-15          KernSmooth_2.23-20    uwot_0.1.10           mgcv_1.8-37          
 [16] DBI_1.1.1             lazyeval_0.2.2        colorspace_2.0-2      tidyselect_1.1.1      gridExtra_2.3        
 [21] compiler_4.1.1        plotly_4.9.4.1        scales_1.1.1          lmtest_0.9-38         spatstat.data_2.1-0  
 [26] askpass_1.1           ggridges_0.5.3        pbapply_1.5-0         goftest_1.2-2         stringr_1.4.0        
 [31] digest_0.6.28         spatstat.utils_2.2-0  pkgconfig_2.0.3       htmltools_0.5.2       parallelly_1.28.1    
 [36] fastmap_1.1.0         htmlwidgets_1.5.4     rlang_0.4.11          shiny_1.7.1           generics_0.1.0       
 [41] zoo_1.8-9             jsonlite_1.7.2        ica_1.0-2             magrittr_2.0.1        patchwork_1.1.1      
 [46] Rcpp_1.0.7            munsell_0.5.0         fansi_0.5.0           abind_1.4-5           reticulate_1.22      
 [51] lifecycle_1.0.1       stringi_1.7.5         MASS_7.3-54           Rtsne_0.15            plyr_1.8.6           
 [56] grid_4.1.1            parallel_4.1.1        listenv_0.8.0         promises_1.2.0.1      ggrepel_0.9.1        
 [61] crayon_1.4.1          miniUI_0.1.1.1        deldir_1.0-2          lattice_0.20-45       cowplot_1.1.1        
 [66] splines_4.1.1         tensor_1.5            pillar_1.6.3          igraph_1.2.6          spatstat.geom_2.2-2  
 [71] future.apply_1.8.1    reshape2_1.4.4        codetools_0.2-18      leiden_0.3.9          glue_1.4.2           
 [76] data.table_1.14.2     BiocManager_1.30.16   png_0.1-7             vctrs_0.3.8           httpuv_1.6.3         
 [81] openssl_1.4.5         gtable_0.3.0          RANN_2.6.1            purrr_0.3.4           spatstat.core_2.3-0  
 [86] polyclip_1.10-0       tidyr_1.1.4           scattermore_0.7       future_1.22.1         assertthat_0.2.1     
 [91] ggplot2_3.3.5         mime_0.12             xtable_1.8-4          RSpectra_0.16-0       later_1.3.0          
 [96] survival_3.2-13       viridisLite_0.4.0     tibble_3.1.5          cluster_2.1.2         globals_0.14.0       
[101] fitdistrplus_1.1-6    ellipsis_0.3.2        ROCR_1.0-11 

potential issue with merge.Seurat.embeddings

Hi,

if I use the merge.Seurat.embeddings and then try to subset the resulting object, all cell.embeddings (pca, umap) are lost in the subset.

query.projected.merged <- Reduce(ProjecTILs:::merge.Seurat.embeddings, query.projected)
query.projected.merged
An object of class Seurat
29698 features across 43174 samples within 2 assays
Active assay: integrated (702 features, 0 variable features)
1 other assay present: RNA
2 dimensional reductions calculated: pca, umap
subset(query.projected.merged. subset=Group=="Post")
An object of class Seurat
29698 features across 35069 samples within 2 assays
Active assay: integrated (702 features, 0 variable features)
1 other assay present: RNA

If I use the original merge
query.projected.merged <- merge(query.projected[[1]], query.projected[2:length(query.projected)], merge.dr = c('pca','umap'))

query.projected.merged
An object of class Seurat
29698 features across 43174 samples within 2 assays
Active assay: integrated (702 features, 0 variable features)
1 other assay present: RNA
2 dimensional reductions calculated: pca, umap
subset(query.projected.merged. subset=Group=="Post")
An object of class Seurat
29698 features across 35069 samples within 2 assays
Active assay: integrated (702 features, 0 variable features)
1 other assay present: RNA
2 dimensional reductions calculated: pca, umap

Also, the UpdateSeuratObject outputs an error message on the merged object generated by ProjecTILs:::merge.Seurat.embeddings
UpdateSeuratObject(query.projected.merged)
Validating object structure
Updating object slots
Ensuring keys are in the proper structure
Error: All cells in the object being added must match the cells in this object

Subsetting query data

Hi I'm interested in subsetting my query data, based on the cell types I'm interested in. I've tried doing this using the Seurat subset function:
merged.subset <- subset(x = merged.proj, subset = functional.cluster == c('CD8_Tex','CD8_Tpex','CD8_EffectorMemory'))`
However, when I do this I lose a large number of my cells for each group, picture attached. Is there any to edit this code to make sure I get all the cells for each group of interest? Any help would be greatly appreciated.

Thanks,
Rhodes
Screen Shot 2021-09-01 at 2 31 31 PM

where to find the "functional.cluster"

Somehow, ProjectTILs (version 3) doesn't return functional.cluster to the query after make.projection.

query_example_seurat <- make.projection(query_example_seurat, ref=ref)
plot.states.radar(query_example_seurat )
Error: Cannot find 'functional.cluster' in this Seurat object
names([email protected])
[1] "Sample"             "Barcode"            "SampleLab"          "nCount_RNA"         "nFeature_RNA"       "cycling.score"     
[7] "cycling.score.G1_S" "cycling.score.G2_M" "anchor.score"

Has anyone encounter the same issue? Is there any way to fix it? Thank you in advance for any tips.

merge two references?

hi there

I was wondering if it's possible to merge two (or more) references to be used against the query dataset.

thank you

Error: BiocParallel errors

Hi,

Thank you very much for this wonderful package.
I follow the tutorial and use the example file provided to run the "make.projection" function.

But I met this error:

> ref <- load.reference.map()
[1] "Loading Default Reference Atlas..."
[1] "/sbgenomics/workspace/ref_TILAtlas_mouse_v1.rds"
[1] "Loaded Reference map ref_TILAtlas_mouse_v1"

> querydata <- ProjecTILs::query_example_seurat
> query.projected <- make.projection(querydata, ref=ref)

Error: BiocParallel errors
  1 remote errors, element index: 1
  0 unevaluated and other errors
  first remote error: worker evaluation failed:
  option type has NULL value

Here is my session info.

R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS

Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.8.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=C
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] SingleCellExperiment_1.16.0 SummarizedExperiment_1.24.0 GenomicRanges_1.46.1
[4] GenomeInfoDb_1.30.0 IRanges_2.28.0 S4Vectors_0.32.3
[7] MatrixGenerics_1.6.0 matrixStats_0.61.0 GEOquery_2.62.2
[10] Biobase_2.54.0 BiocGenerics_0.40.0 ProjecTILs_2.2.1
[13] pracma_2.3.6 ggplot2_3.3.5 gridExtra_2.3
[16] BiocParallel_1.28.3 Matrix_1.4-0 umap_0.2.7.0
[19] scGate_1.0.2 reshape2_1.4.4 ggridges_0.5.3
[22] patchwork_1.1.1 dplyr_1.0.7 data.table_1.14.2
[25] SeuratObject_4.0.4 Seurat_4.0.6 UCell_1.3.1

loaded via a namespace (and not attached):
[1] plyr_1.8.6 igraph_1.2.10 lazyeval_0.2.2
[4] splines_4.1.2 listenv_0.8.0 scattermore_0.7
[7] digest_0.6.29 htmltools_0.5.2 fansi_1.0.2
[10] magrittr_2.0.1 tensor_1.5 cluster_2.1.2
[13] ROCR_1.0-11 tzdb_0.2.0 limma_3.50.0
[16] remotes_2.4.2 globals_0.14.0 readr_2.1.1
[19] askpass_1.1 spatstat.sparse_2.1-0 prettyunits_1.1.1
[22] colorspace_2.0-2 ggrepel_0.9.1 xfun_0.29
[25] RCurl_1.98-1.5 callr_3.7.0 crayon_1.4.2
[28] jsonlite_1.7.3 spatstat.data_2.1-2 survival_3.2-13
[31] zoo_1.8-9 glue_1.6.0 polyclip_1.10-0
[34] gtable_0.3.0 zlibbioc_1.40.0 XVector_0.34.0
[37] leiden_0.3.9 DelayedArray_0.20.0 pkgbuild_1.3.1
[40] future.apply_1.8.1 abind_1.4-5 scales_1.1.1
[43] DBI_1.1.2 miniUI_0.1.1.1 Rcpp_1.0.8
[46] viridisLite_0.4.0 xtable_1.8-4 reticulate_1.22
[49] spatstat.core_2.3-2 htmlwidgets_1.5.4 httr_1.4.2
[52] RColorBrewer_1.1-2 ellipsis_0.3.2 ica_1.0-2
[55] pkgconfig_2.0.3 farver_2.1.0 uwot_0.1.11
[58] deldir_1.0-6 utf8_1.2.2 tidyselect_1.1.1
[61] labeling_0.4.2 rlang_0.4.12 later_1.3.0
[64] munsell_0.5.0 tools_4.1.2 cli_3.1.1
[67] generics_0.1.1 evaluate_0.14 stringr_1.4.0
[70] fastmap_1.1.0 yaml_2.2.1 goftest_1.2-3
[73] processx_3.5.2 knitr_1.37 fitdistrplus_1.1-6
[76] purrr_0.3.4 RANN_2.6.1 pbapply_1.5-0
[79] future_1.23.0 nlme_3.1-155 mime_0.12
[82] xml2_1.3.3 compiler_4.1.2 rstudioapi_0.13
[85] plotly_4.10.0 curl_4.3.2 png_0.1-7
[88] spatstat.utils_2.3-0 tibble_3.1.6 stringi_1.7.6
[91] ps_1.6.0 RSpectra_0.16-0 lattice_0.20-45
[94] vctrs_0.3.8 pillar_1.6.4 lifecycle_1.0.1
[97] BiocManager_1.30.16 spatstat.geom_2.3-1 lmtest_0.9-39
[100] RcppAnnoy_0.0.19 bitops_1.0-7 cowplot_1.1.1
[103] irlba_2.3.5 httpuv_1.6.4 R6_2.5.1
[106] promises_1.2.0.1 KernSmooth_2.23-20 parallelly_1.30.0
[109] codetools_0.2-18 MASS_7.3-55 assertthat_0.2.1
[112] openssl_1.4.6 rprojroot_2.0.2 withr_2.4.3
[115] sctransform_0.3.2 GenomeInfoDbData_1.2.7 mgcv_1.8-38
[118] parallel_4.1.2 hms_1.1.1 grid_4.1.2
[121] rpart_4.1-15 tidyr_1.1.4 rmarkdown_2.11
[124] Rtsne_0.15 shiny_1.7.1

Any help would be appreciated.

Thank you very much.

Uninformative error if one sample contains no cells to project onto reference map

If there are e.g. zero (or too little?) CD8TILs to project onto the CD8TIL reference map the error it throws is not very obvious:

`object.CD8T.projected <- Run.ProjecTILs(query = object.CD8T, ref = ref, filter.cell = TRUE, skip.normalize = T,
split.by = "Sample", ncores = 4)

[1] "Using assay RNA for SampleXYZ"
Pre-filtering cells with scGate...
Error: BiocParallel errors
1 remote errors, element index: 25
45 unevaluated and other errors
first remote error:
Error in run_scGate_singlemodel(data, model = model[[m]], k.param = k.param, : object 'pure.cells' not found`

-> Skip sample and through informative warning if it has zero (or too little) cells to project onto map

Error: object 'ffi_standalone_check_number_1.0.7' not found

I am trying to execute the Run.ProjecTILs command on a scRNAseq dataset.

I first ran it on it with cell.filter = TRUE using the CD4 reference atlas with no issues.

I then annotated CD4 cells using another tool, subsetted the scRNAseq to contain only CD4 cells and then ran it with cell.filter = FALSE. Other than two messages stating that direct projection was used for two of my patients, the analysis went without a hitch. However, when I do anything with the output data, I get the following error:

Error in .standalone_types_check_dot_call(ffi_standalone_check_number_1.0.7, :
object 'ffi_standalone_check_number_1.0.7' not found

I would appreciate any help.

An error in initial stages

Sorry I have used mine Seurat object for projection but I get this error

> query.projected <- make.projection(cancer, ref=ref,human.ortho = T)
[1] "Using assay RNA for query"
Pre-filtering of T cells (TILPRED classifier)...
Genes in the gene sets NOT available in the dataset: 
  B.cell: 	7 (14% of 50)
CAF: 	2 (4% of 49)
Endo.: 	5 (11% of 46)
Macrophage: 	5 (11% of 46)
Mal: 	1 (2% of 45)
[1] "12566 out of 18338 ( 69 % ) non-pure T cells removed.  Use filter.cells=FALSE to avoid pre-filtering (NOT RECOMMENDED)"
[1] "Transforming expression matrix into space of mouse orthologs"
Performing log-normalization
0%   10   20   30   40   50   60   70   80   90   100%
  [----|----|----|----|----|----|----|----|----|----|
     **************************************************|
     [1] "Aligning query to reference map for batch-correction..."
   |========================================================================================================| 100%
   Computing within dataset neighborhoods
   |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=07s  
   Finding all pairwise anchors
   |                                                  | 0 % ~calculating  Finding neighborhoods
   Finding anchors
   Found 616 anchors
   |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=09s  
   
   Projecting corrected query onto Reference PCA space
   [1] "Projecting corrected query onto Reference UMAP space"
   Warning message:
     In predictTilState(sce, human = human) :
     The following genes were not found in the dataset provided  NAPSB,NCF1C,IGLL5,NCF1B,ELK2AP,CYBASC3,IGJ,WISP2,CTGF,PTRF,CYR61,C10orf10,DARC,FAM26F,GPX1,CTSL1,IL8,SEPP1 . Doesn't look too bad but prediction performance might be affected.
> query.projected
An object of class Seurat 
30365 features across 5772 samples within 2 assays 
Active assay: integrated (707 features, 707 variable features)
 1 other assay present: RNA
 2 dimensional reductions calculated: pca, umap
> cellstate.predict(ref=ref, query=query.projected)
Error: $ operator not defined for this S4 class
> plot.states.radar(ref, query=query.projected, min.cells = 20)
Error in intI(j, n = x@Dim[2], dn[[2]], give.dn = FALSE) : 
  'NA' indices are not (yet?) supported for sparse Matrices
> 
> 

Any help please

Losing KLRC1 signal after running ProjecTILs

Hey

Whenever I run ProjecTILS on a Seurat object with my T cells, the resulting file loses KLRC1 signal. It says there is no expression of it in any assay. I know from feature plots and gene expression data that it is highly expressed in the cluster subset I am projecting on ProjecTILS.

I am assuming this has something to do with how gene names are being converted. Is there a way to fix this ?

Thank you

human reference atlas

How would you suggest going about creating a human reference atlas for an analysis focused on human TILs?

Alignment failed due to: Error in intI(i, n = d[1], dn[[1]], give.dn = FALSE): invalid character indexing

Hello,

I am trying to run ProjecTILs on my Seurat object and I get the following error when running the functionmake.projection.

Alignment failed due to: Error in intI(i, n = d[1], dn[[1]], give.dn = FALSE): invalid character indexing

I tried lowering the seurat.k.filter to 100, thinking the issue is coming from Seurat during the "Finding the integration vector weights" step, however I continue to get the same error.

I would appreciate your help to address this issue.

Thank you,
Jesus

> query.projected <- make.projection(query.object, ref=ref, human.ortho=TRUE)
[1] "Using assay RNA for query"
Pre-filtering of T cells (TILPRED classifier)...
Genes in the gene sets NOT available in the dataset: 
	B.cell: 	10 (20% of 50)
	CAF: 	2 (4% of 49)
	Endo.: 	5 (11% of 46)
	Macrophage: 	5 (11% of 46)
	Mal: 	1 (2% of 45)
[1] "44024 out of 44543 ( 99 % ) non-pure T cells removed.  Use filter.cells=FALSE to avoid pre-filtering (NOT RECOMMENDED)"
[1] "Transforming expression matrix into space of mouse orthologs"
[1] "Aligning query to reference map for batch-correction..."
  |==================================================================================================================================| 100%
Computing within dataset neighborhoods
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=06s  
Finding all pairwise anchors
  |                                                  | 0 % ~calculating  
Alignment failed due to: Error in intI(i, n = d[1], dn[[1]], give.dn = FALSE): invalid character indexing

Warning: alignment of query dataset failed - Trying direct projection...
[1] "DIRECTLY projecting query onto Reference PCA space"
[1] "DIRECTLY projecting query onto Reference UMAP space"

Here is my sessionInfo() as well.

R version 4.1.0 (2021-05-18)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.4

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/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] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] gridExtra_2.3               scales_1.1.1                reshape2_1.4.4              ProjecTILs_1.0.0           
 [5] Matrix_1.3-3                TILPRED_1.0.2               umap_0.2.7.0                remotes_2.4.0              
 [9] pheatmap_1.0.12             viridis_0.6.1               viridisLite_0.4.0           celldex_1.2.0              
[13] scRNAseq_2.7.2              SingleCellExperiment_1.14.1 SingleR_1.6.1               SummarizedExperiment_1.22.0
[17] Biobase_2.52.0              GenomicRanges_1.44.0        GenomeInfoDb_1.28.1         IRanges_2.26.0             
[21] S4Vectors_0.30.0            BiocGenerics_0.38.0         MatrixGenerics_1.4.2        matrixStats_0.60.0         
[25] infercnv_1.8.0              glmGamPoi_1.4.0             cowplot_1.1.1               RCurl_1.98-1.3             
[29] forcats_0.5.1               stringr_1.4.0               purrr_0.3.4                 readr_2.0.1                
[33] tidyr_1.1.3                 tibble_3.1.3                ggplot2_3.3.5               tidyverse_1.3.1            
[37] SeuratObject_4.0.2          Seurat_4.0.3.9015           dplyr_1.0.7                

loaded via a namespace (and not attached):
  [1] rappdirs_0.3.3                rtracklayer_1.52.0            scattermore_0.7               R.methodsS3_1.8.1            
  [5] coda_0.19-4                   bit64_4.0.5                   R.utils_2.10.1                irlba_2.3.3                  
  [9] multcomp_1.4-17               DelayedArray_0.18.0           data.table_1.14.0             rpart_4.1-15                 
 [13] AnnotationFilter_1.16.0       KEGGREST_1.32.0               doParallel_1.0.16             generics_0.1.0               
 [17] GenomicFeatures_1.44.0        ScaledMatrix_1.0.0            lambda.r_1.2.4                TH.data_1.0-10               
 [21] RSQLite_2.2.7                 RANN_2.6.1                    future_1.21.0                 bit_4.0.4                    
 [25] tzdb_0.1.2                    spatstat.data_2.1-0           xml2_1.3.2                    lubridate_1.7.10             
 [29] httpuv_1.6.1                  isoband_0.2.5                 assertthat_0.2.1              hms_1.1.0                    
 [33] promises_1.2.0.1              argparse_2.0.4                restfulr_0.0.13               fansi_0.5.0                  
 [37] progress_1.2.2                caTools_1.18.2                dbplyr_2.1.1                  readxl_1.3.1                 
 [41] igraph_1.2.6                  DBI_1.1.1                     htmlwidgets_1.5.3             futile.logger_1.4.3          
 [45] reshape_0.8.8                 spatstat.geom_2.2-2           ellipsis_0.3.2                RSpectra_0.16-0              
 [49] backports_1.2.1               annotate_1.70.0               libcoin_1.0-8                 biomaRt_2.48.2               
 [53] deldir_0.2-10                 sparseMatrixStats_1.4.2       vctrs_0.3.8                   ensembldb_2.16.4             
 [57] ROCR_1.0-11                   abind_1.4-5                   cachem_1.0.5                  withr_2.4.2                  
 [61] sctransform_0.3.2             GenomicAlignments_1.28.0      prettyunits_1.1.1             goftest_1.2-2                
 [65] cluster_2.1.2                 ExperimentHub_2.0.0           ape_5.5                       lazyeval_0.2.2               
 [69] crayon_1.4.1                  edgeR_3.34.0                  pkgconfig_2.0.3               labeling_0.4.2               
 [73] ProtGenerics_1.24.0           nlme_3.1-152                  rlang_0.4.11                  globals_0.14.0               
 [77] lifecycle_1.0.0               miniUI_0.1.1.1                sandwich_3.0-1                filelock_1.0.2               
 [81] BiocFileCache_2.0.0           modelr_0.1.8                  rsvd_1.0.5                    AnnotationHub_3.0.1          
 [85] cellranger_1.1.0              polyclip_1.10-0               lmtest_0.9-38                 graph_1.70.0                 
 [89] zoo_1.8-9                     reprex_2.0.1                  ggridges_0.5.3                rjson_0.2.20                 
 [93] png_0.1-7                     bitops_1.0-7                  R.oo_1.24.0                   KernSmooth_2.23-20           
 [97] Biostrings_2.60.2             blob_1.2.2                    DelayedMatrixStats_1.14.2     coin_1.4-1                   
[101] parallelly_1.27.0             beachmat_2.8.1                GSEABase_1.54.0               memoise_2.0.0                
[105] magrittr_2.0.1                plyr_1.8.6                    ica_1.0-2                     gplots_3.1.1                 
[109] zlibbioc_1.38.0               compiler_4.1.0                BiocIO_1.2.0                  RColorBrewer_1.1-2           
[113] fitdistrplus_1.1-5            Rsamtools_2.8.0               cli_3.0.1                     XVector_0.32.0               
[117] listenv_0.8.0                 patchwork_1.1.1               pbapply_1.4-3                 formatR_1.11                 
[121] MASS_7.3-54                   mgcv_1.8-35                   tidyselect_1.1.1              stringi_1.7.3                
[125] yaml_2.2.1                    askpass_1.1                   BiocSingular_1.8.1            locfit_1.5-9.4               
[129] ggrepel_0.9.1                 grid_4.1.0                    tools_4.1.0                   future.apply_1.8.1           
[133] rstudioapi_0.13               foreach_1.5.1                 rjags_4-10                    AUCell_1.14.0                
[137] farver_2.1.0                  Rtsne_0.15                    digest_0.6.27                 BiocManager_1.30.16          
[141] shiny_1.6.0                   Rcpp_1.0.7                    broom_0.7.9                   BiocVersion_3.13.1           
[145] later_1.2.0                   RcppAnnoy_0.0.19              httr_1.4.2                    AnnotationDbi_1.54.1         
[149] colorspace_2.0-2              rvest_1.0.1                   XML_3.99-0.6                  fs_1.5.0                     
[153] tensor_1.5                    reticulate_1.20               splines_4.1.0                 uwot_0.1.10                  
[157] spatstat.utils_2.2-0          phyclust_0.1-30               plotly_4.9.4.1                xtable_1.8-4                 
[161] jsonlite_1.7.2                futile.options_1.0.1          modeltools_0.2-23             R6_2.5.0                     
[165] pillar_1.6.2                  htmltools_0.5.1.1             mime_0.11                     glue_1.4.2                   
[169] fastmap_1.1.0                 BiocParallel_1.26.1           BiocNeighbors_1.10.0          interactiveDisplayBase_1.30.0
[173] codetools_0.2-18              mvtnorm_1.1-2                 utf8_1.2.2                    lattice_0.20-44              
[177] spatstat.sparse_2.0-0         curl_4.3.2                    leiden_0.3.9                  gtools_3.9.2                 
[181] openssl_1.4.4                 survival_3.2-11               limma_3.48.3                  munsell_0.5.0                
[185] fastcluster_1.2.3             GenomeInfoDbData_1.2.6        iterators_1.0.13              haven_2.4.3                  
[189] gtable_0.3.0                  spatstat.core_2.3-0          
> 

BiocParallel errors

Hi,

I am testing your package on my mouse data.

I loaded my data in a Seurat object and did some basic filtering

I then loaded the mouse TILs reference and then run the make.projection function
seuratOBJ.proj = make.projection(seuratOBJ, ref = reference, ncores = 20, query.assay = "RNA", scGate_model="mouse")

Below is the output, including errors. what is strange is also that one run worked and a rerun, right after it, with the exact same command and data, fails as below
Can you please help me with this ?
Thanks

[1] "Using assay RNA for WT_INJ"
Pre-filtering cells with scGate...

[1] "Using assay RNA for WT"
Pre-filtering cells with scGate...

[1] "Using assay RNA for TFGA"
Pre-filtering cells with scGate...

[1] "Using assay RNA for E18.5"
Pre-filtering cells with scGate...

Error: BiocParallel errors
4 remote errors, element index: 1, 2, 3, 4
0 unevaluated and other errors
first remote error:
Error in dplyr::distinct(., .data$name, .data$signature, .keep_all = T): Must use existing variables.

struggling to load dependencies UCell and scGate

Hi all, might I get assistance in troubleshooting the recurrent error I'm getting that prevents me from downloading the dependencies for ProjectTILs

I follow the vignette guideif
(!requireNamespace("renv"))
install.packages("renv")
library(renv)
renv::restore()
remotes::install_github("carmonalab/UCell")
remotes::install_github("carmonalab/scGate")
remotes::install_github("carmonalab/ProjecTILs")

remotes::install_github("carmonalab/UCell", ref="v1.3")
remotes::install_github("carmonalab/scGate")

I seem to be able to get 'renv

if (!requireNamespace("renv"))

  • install.packages("renv")

library(renv)
renv::restore()

  • The library is already synchronized with the lockfile.

My errors are as follows

Error in file(filename, "r", encoding = encoding) :
cannot open the connection
Calls: source -> file
In addition: Warning message:
In file(filename, "r", encoding = encoding) :
cannot open file 'renv/activate.R': No such file or directory
Execution halted
ERROR: lazy loading failed for package 'UCell'
arning messages:
1: In .inet_warning(msg) :
package ‘UCell’ is not available for Bioconductor version '3.14'

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
2: In install.packages(update[instlib == l, "Package"], l, repos = repos, :
installation of package ‘commonmark’ had non-zero exit status
3: In install.packages(update[instlib == l, "Package"], l, repos = repos, :
installation of package ‘maptools’ had non-zero exit status

This is my r version

sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.2.1

ProjecTILs::Hs2Mm.convert.table generation

Dear all,

really exciting package to me!
I am now exploring its functionalities. I am checking arbitrary details of the functions and I wonder:
How to generate a conversion table for mouse <----> human gene orthologs elegantly? Did you do it with Biomart, somehow?

I just noticed that ZNF683 (human) is not included in the default table but a mouse ortholog is described: Znf683. I did not conduct a systematic check for a large number of genes, yet. Maybe the table is just outdated. So I wonder how generate my own. I found this one on GitHub: https://github.com/vitkl/orthologsBioMART.

But anyhow: How did you generate your table? Can you tell us?

Thanks, yours, Chris.

namespace error in installation

Hi,
Thanks for developing the package.
I encountered some errors (shown below) in the installation process. Do you have any suggestions? Thank you.
Warning: namespace ‘Seurat’ is not available and has been replaced
by .GlobalEnv when processing object ‘query_example_seurat’
Warning: namespace ‘Seurat’ is not available and has been replaced
by .GlobalEnv when processing object ‘query_example_seurat’
** byte-compile and prepare package for lazy loading
Error: package or namespace load failed for ‘Seurat’:
(converted from warning) replacing previous import ‘spatstat.utils::RelevantNA’ by ‘spatstat.sparse::RelevantNA’ when loading ‘spatstat.geom’
Error: package ‘Seurat’ could not be loaded
Execution halted
ERROR: lazy loading failed for package ‘ProjecTILs’

Should I filter the res based on functional.cluster.conf?

I analyzed my human data based on orthologs and I am wondering whether I should filter the results based on functional.cluster.conf.

summary(tils_meta$functional.cluster.conf)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
0.20    0.55    0.80    0.75    0.95    1.00

Would you suggest a low score means less likely of the predicted functional cluster?

Classes of existing metadata change upon projection

Dear all,

Thank you for developing ProjecTILs!

While I am trying out your package, I noticed that classes of the existing metadata are changed after projection.

ref = ProjecTILs::load.reference.map()
sc_projectils = ProjecTILs::make.projection(sc, ref=ref, skip.normalize=TRUE)

Screenshot 2021-08-17 at 10 40 19

Maybe this is something you can fix?

Best wishes and thanks a lot for your work!
Katrin

Human CD4 and CD8 TILs references

HI,

I could not find a description of how you 'transformed' the original data from the Science paper into a ProjecTILs reference.

I am asking since in Fig 1 (Zhang et al.) the CD8 UMAP has 17 clusters grouped into 8 large categories (Tn, Tem, Temra, Tex, Trm,Tc17, ISG+, KIR+ NK-like). The reference, instead, has 7 categories (Tn, Tem, Temra, Tex, Tcm, Tpex, MAIT) and only the first 4 match.

Could you please clarify ?

Thanks

Enhancement: Comparing reference labels with custom labels

Great tool!
Annotating T cells is really hard and this tool is really helpful especially because it also provides a reference atlas.
However, I am missing a function that allows a comparison between custom labels of the query dataset and the labels of the reference dataset. Although plot.projection shows you where your cells are located, it does not allow a direct comparison between custom labels of the query dataset and the labels of the reference atlas.

A very easy solution would be a heatmap showing reference annotation as columns and your labels as rows.
If your labels are stored in [email protected]$cluster:

table(query.projected$cluster, query.projected$functional.cluster) |>
    pheatmap::pheatmap(scale = "row")

applying regression in the reference map

Awesome tool!

I have an issue about generating my own reference map.
I need to apply regression in the reference map.
In seurat I did
ScaleData(seurat , features = all.genes, vars.to.regress = c("S.Score", "G2M.Score"))

Is there a way to
A) still use the original (seurat-originated and regressed) UMAP coordinates, or
B) to apply the same regression when the re-computing the UMAP?

Or any other suggestions maybe?
Thanks!

'RNA' not in 'altExpNames(<SingleCellExperiment>) when filter.cells= TRUE

If I follow the tutorial:

library(ProjecTILs)
ref <- load.reference.map()
querydata <- ProjecTILs::query_example_seurat
query.projected <- make.projection(querydata, ref = ref, filter.cells = TRUE)

It interrupts with the following error:

Error in value[[3L]](cond) : 
  invalid subscript 'e' in 'altExp(<SingleCellExperiment>, type="character", ...)':
  'RNA' not in 'altExpNames(<SingleCellExperiment>)'

traceback:

17: stop("invalid subscript '", substr, "' in '", funstr, "(<", class(x), 
        ">, type=\"character\", ...)':\n  ", "'", index, "' not in '", 
        namestr, "(<", class(x), ">)'")
16: value[[3L]](cond)
15: tryCatchOne(expr, names, parentenv, handlers[[1L]])
14: tryCatchList(expr, classes, parentenv, handlers)
13: tryCatch({
        internals[, index]
    }, error = function(err) {
        stop("invalid subscript '", substr, "' in '", funstr, "(<", 
            class(x), ">, type=\"character\", ...)':\n  ", "'", index, 
            "' not in '", namestr, "(<", class(x), ">)'")
    })
12: .get_internal_character(x, e, getfun = int_colData, key = .alt_key, 
        funstr = "altExp", substr = "e", namestr = "altExpNames")
11: .local(x, e, ...)
10: altExp(x, name, withColData = withColData)
9: altExp(x, name, withColData = withColData)
8: SingleCellExperiment::swapAltExp(x = sce, name = assayn, saved = orig.exp.name)
7: as.SingleCellExperiment.Seurat(query.object)
6: as.SingleCellExperiment(query.object)
5: filterCells(query, human = human.ortho)
4: projection.helper(query = query.list[[i]], ref = ref, filter.cells = filter.cells, 
       query.assay = query.assay, direct.projection = direct.projection, 
       seurat.k.filter = seurat.k.filter, skip.normalize = skip.normalize, 
       id = names(query.list)[i])
3: FUN(X[[i]], ...)
2: lapply(X = 1:length(query.list), FUN = function(i) {
       res <- projection.helper(query = query.list[[i]], ref = ref, 
           filter.cells = filter.cells, query.assay = query.assay, 
           direct.projection = direct.projection, seurat.k.filter = seurat.k.filter, 
           skip.normalize = skip.normalize, id = names(query.list)[i])
       return(res)
   })
1: make.projection(querydata, ref = ref, filter.cells = TRUE)

If I turn of filter cells by setting filter.cells = FALSE, everything works fine.

ProjecTILs_1.0.0 Matrix_1.3-3 TILPRED_1.0.2 umap_0.2.7.0 SeuratObject_4.0.1 Seurat_4.0.2

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.