Hello,
I cannot find any good information online. Is Seurat compatible with cellrnager vdj calculations? More generally speaking is there any documentation out there on how to integrate gene transcription with TCR (T cell receptor) data?
Read10X(data.dir = "cell_ranger_input/PRJ190277-VCL-tc/outs")
Error in Read10X(data.dir = "cell_ranger_input/PRJ190277-VCL-tc/outs") :
Barcode file missing
Thanks a lot
> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Matrix products: default
BLAS/LAPACK: /stornext/System/data/tools/intel-mkl/intel-mkl-2019.3.199/compilers_and_libraries_2019.3.199/linux/mkl/lib/intel64_lin/libmkl_gf_lp64.so
Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] forcats_0.4.0 stringr_1.4.0 dplyr_0.8.0.1 purrr_0.3.2 readr_1.3.1 tidyr_0.8.3 tibble_2.1.1 tidyverse_1.2.1
[9] viridis_0.5.1 viridisLite_0.3.0 circlize_0.4.6 ComplexHeatmap_2.0.0 cowplot_0.9.4 ggplot2_3.1.1 Seurat_3.0.0
loaded via a namespace (and not attached):
[1] nlme_3.1-139 tsne_0.1-3 bitops_1.0-6 lubridate_1.7.4 RColorBrewer_1.1-2 httr_1.4.0 backports_1.1.4 sctransform_0.2.0 tools_3.6.0
[10] R6_2.4.0 irlba_2.3.3 KernSmooth_2.23-15 lazyeval_0.2.2 colorspace_1.4-1 GetoptLong_0.1.7 npsurv_0.4-0 withr_2.1.2 tidyselect_0.2.5
[19] gridExtra_2.3 compiler_3.6.0 cli_1.1.0 rvest_0.3.3 xml2_1.2.0 plotly_4.9.0 caTools_1.17.1.2 scales_1.0.0 lmtest_0.9-37
[28] ggridges_0.5.1 pbapply_1.4-0 digest_0.6.18 R.utils_2.8.0 pkgconfig_2.0.2 htmltools_0.3.6 bibtex_0.4.2 readxl_1.3.1 GlobalOptions_0.1.0
[37] htmlwidgets_1.3 rlang_0.3.4 rstudioapi_0.10 generics_0.0.2 shape_1.4.4 zoo_1.8-5 jsonlite_1.6 ica_1.0-2 gtools_3.8.1
[46] R.oo_1.22.0 magrittr_1.5 Matrix_1.2-17 Rcpp_1.0.1 munsell_0.5.0 ape_5.3 reticulate_1.12 R.methodsS3_1.7.1 stringi_1.4.3
[55] gbRd_0.4-11 MASS_7.3-51.4 gplots_3.0.1.1 Rtsne_0.15 plyr_1.8.4 parallel_3.6.0 gdata_2.18.0 listenv_0.7.0 ggrepel_0.8.1
[64] crayon_1.3.4 lattice_0.20-38 haven_2.1.0 splines_3.6.0 hms_0.4.2 SDMTools_1.1-221.1 pillar_1.3.1 igraph_1.2.4.1 rjson_0.2.20
[73] future.apply_1.2.0 reshape2_1.4.3 codetools_0.2-16 glue_1.3.1 lsei_1.2-0 metap_1.1 modelr_0.1.4 data.table_1.12.2 png_0.1-7
[82] Rdpack_0.11-0 cellranger_1.1.0 gtable_0.3.0 RANN_2.6.1 clue_0.3-57 future_1.13.0 assertthat_0.2.1 rsvd_1.0.0 broom_0.5.2
[91] survival_2.44-1.1 cluster_2.0.9 globals_0.12.4 fitdistrplus_1.0-14 ROCR_1.0-7
See #1435. In short, yes.
@stemangiola
In longer, still yes (see function below):
add_clonotype <- function(tcr_location, seurat_obj){
tcr <- read.csv(paste(tcr_folder,"filtered_contig_annotations.csv", sep=""))
# Remove the -1 at the end of each barcode.
# Subsets so only the first line of each barcode is kept,
# as each entry for given barcode will have same clonotype.
tcr$barcode <- gsub("-1", "", tcr$barcode)
tcr <- tcr[!duplicated(tcr$barcode), ]
# Only keep the barcode and clonotype columns.
# We'll get additional clonotype info from the clonotype table.
tcr <- tcr[,c("barcode", "raw_clonotype_id")]
names(tcr)[names(tcr) == "raw_clonotype_id"] <- "clonotype_id"
# Clonotype-centric info.
clono <- read.csv(paste(tcr_folder,"clonotypes.csv", sep=""))
# Slap the AA sequences onto our original table by clonotype_id.
tcr <- merge(tcr, clono[, c("clonotype_id", "cdr3s_aa")])
# Reorder so barcodes are first column and set them as rownames.
tcr <- tcr[, c(2,1,3)]
rownames(tcr) <- tcr[,1]
tcr[,1] <- NULL
# Add to the Seurat object's metadata.
clono_seurat <- AddMetaData(object=seurat_obj, metadata=tcr)
return(clono_seurat)
}
Thanks!
If you published this in some README I think would be helpful to someone.
I have stuck it in a gist and also made a biostars post detailing it. Hopefully that helps people find it more easily through google. I'm not much of an R dev or I'd try to make a pull request to add a more robust version to Seurat itself. Maybe if I have some free time some weekend.
@j-andrews7 thanks for this vignette. I expanded it further to work with my own data.
The detailed tutorial can be found at my Biostars post.
Most helpful comment
@stemangiola
In longer, still yes (see function below):