Giter VIP home page Giter VIP logo

screpertoire's Introduction

scRepertoire

BioC status R-CMD-check Codecov test coverage Documentation

A toolkit for single-cell immune profiling

Introduction

Single-cell sequencing is an emerging technology in the field of immunology and oncology that allows researchers to couple RNA quantification and other modalities, like immune cell receptor profiling at the level of an individual cell. A number of workflows and software packages have been created to process and analyze single-cell transcriptomic data. These packages allow users to take the vast dimensionality of the data generated in single-cell-based experiments and distill the data into novel insights. Unlike the transcriptomic field, there is a lack of options for software that allow for single-cell immune receptor profiling. Enabling users to easily combine RNA and immune profiling, the scRepertoire framework supports use of 10x, AIRR, BD, MiXCR, Omniscope, TRUST4, and WAT3R single-cell clonal formats and interaction with popular R-based single-cell data pipelines.

Applying Deep Learning to VDJ data

scRepertoire is compatible and integrated with the R packages Trex for deep-learning-based autoencoding of the T cell receptor and Ibex for the B cell receptor.

Working with scRepertoire

scRepertoire has a comprehensive website for detailed tutorials and function information.

Installation

Installation of Master Branch

devtools::install_github("ncborcherding/scRepertoire")

Installing from Bioconductor

The current version of scRepertoire is also available on Bioconductor.

if (!require("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("scRepertoire")

Legacy Version 1

If you are looking for version 1 of scRepertoire - there is a static version available below:

devtools::install_github("ncborcherding/scRepertoire@v1")

Getting Data

Unfortunately, Github limits the size of individual files. In order to access the seurat object paired with scRepertoire please download the .rda from here.

Bug Reports/New Features

If you run into any issues or bugs please submit a GitHub issue with details of the issue.

  • If possible please include a reproducible example. Alternatively, an example with the internal scRep_example and contig_list would be extremely helpful.

Any requests for new features or enhancements can also be submitted as GitHub issues.

Pull Requests are welcome for bug fixes, new features, or enhancements.

Please Cite

Feel free to use, edit, modify scRepertoire, but if you do, please cite the manuscript. If you are building your own tool based on scRepertoire, reach out, I am happy to help and make things compatible.

screpertoire's People

Contributors

gloriabk avatar jhysiu avatar jwokaty avatar lshep avatar mass-a avatar ncborcherding avatar noranekonobokkusu avatar nturaga avatar qile0317 avatar scfurl avatar simon-leonard avatar ycl6 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  avatar  avatar  avatar  avatar

screpertoire's Issues

Mutate_ Error on List with filterMulti For combineTCR

Hi Nick,

I am getting an error using the filterMulti function.

Error in UseMethod("mutate_") : no applicable method for 'mutate_' applied to an object of class "list"

I am running 3.6.0 and perhaps this issue only exists with the dev version or this version of R/dplyr. Any insight would be appreciated, will follow-up with a workaround if I find one.

Thanks!

Combine contig_list

Thanks to this helpful tool!
I want to analyze cells with combined data of TCR Clonotype and gene expression.
I am a new user of R, so I want to ask some basic questions.
I loaded 6 filtered_contig_annotation.csv files and listed with
contig_list <- list(csv3, csv4, csv5, csv6, csv7, csv8)
In my files, the barcode is just like AAACCTGAGAGTGACC-1.
So, I didn't strip barcodes. And, I wanted to combine contigs with following code.
combined <- combineContigs(contig_list, samples = c("P2", "P2", "P3", "P3", "P4","P4"), ID = c("Pre", "Post", "Pre", "Post", "Pre", "Post"), cells ="T-AB")
6 files are divided into 3 patients and 2 status in each patient.
However, there was an error message.

Error in strsplit(df[[1]]$barcode[1], "[-]") : non-character argument

I would like to ask what code is wrong to combine contigs.
Many thanks.

Multiple comparison using compareClonotypes

Hi Nick,

I am wondering if there is an easier way to plot an alluvial-type of graph that can compare the proportion/number of overlapping clonotypes between multiple samples? For example, if I want to compare the number of clonotypes that are shared between PX_P, PX_T AND PY_P. The current example performs a linear comparison of the samples (ie. PX_P to PX_T).

A circular chord diagram like that the Circlize package seems to be what I wanted (to visualize the amount of shared clonotypes between multiple clusters). I exported data frame from compareClonotypes and clonoaloverlap (melt the data frame and removed the NAs), but it didn't look quite right. Do you have any suggestions?

Thanks!

Following clonotypes between SEURAT clusters

Hi All,

Thank you so much for developing this convenient package, it's great that we can use it with SEURAT.
I have T cells that I clustered, I think they are differentiating from naive-->Effector-->Memory and during this differentiation process, a unique T cell will keep the same TCR. I was wondering how can I see if different clusters share any clonotype? I'm not sure I found something like that in the vignette.

Thank you again!

suggestion of new 'occupied repertoire space' plot

Hi Nick

We had a great experience with your package

A minor suggestion: we believe that a function to make a barplot like this (i.e. clonotypes classified by absolute number of cells):

image

would be a useful additional feature.

Default clone type classification by frequency can be problematic for small datasets, where singletons might account for a significant proportion of the total cells; as in:

clonalHomeostasis(..., cloneCall = "gene", cloneTypes = c(Rare=rareFreq, Small = 0.5, Medium = 0.1, Large = 1))

Please see https://carmonalab.github.io/ProjecTILs_CaseStudies/Xiong19_TCR.html#clonality-analysis for a reproducible example

Running scRepertoire

Hi,

Thank you for sharing scRepertoire. I think this will be great for my analysis. I have a couple of questions. I finished mapping and started analysis but got stuck pretty early with the following error:

for (i in seq_along(contig_list))

  • {
  • contig_list[[i]] <- stripBarcode(contig_list[[i]], column = 1, connector = "_", num_connects = 3)
  • }
    Error in [.data.frame(as.data.frame(t(data.frame(strsplit(contigs[, :
    undefined columns selected

combined <- combineTCR(contig_list,

  •                    samples = c("Sample1", "Sample2", "Sample3"), 
    
  •                    ID = c("Pos", "Neg", "Healthy"), cells ="T-AB")
    

Error: Make sure the sample and ID labels match the length of the
list of data frames (df).

example <- addVariable(combined, name = "Patient_batch",

  •                    variables = c("b1", "b2", "b3"))
    

Error in addVariable(combined, name = "Patient_batch", variables = c("b1", :
object 'combined' not found

example[[1]][1:5,ncol(example[[1]])] # This is showing the first 5 values of the new column added
Error in example[[1]] : object of type 'closure' is not subsettable

Any advice will be greatly appreciated. Thanks!

ERROR:CombineBCR

When I run combineBCR,something run

combined <- combineBCR(contig_list,samples = "PBMC_1",ID = "Normal")

Error in match.names(clabs, names(xi)) :
names do not match previous names

But I seem to have found the reason, and I change the code as follow :
hammingCompare <- function(Con.df, gene, chain, length)

from
out <- as.data.frame(t(out), stringsAsFactors = F)

to
out <- as.data.frame(out, stringsAsFactors = F)

But I don’t know whether I am correct

Plot failure with empty clusters

It so happens that I have a Seurat object with "empty" clusters. They weren't empty to begin with, but they are empty with regard to TCR. Essentially all the cells in those clusters are NOT clonotypes.

Some of the plots seem to be handling this well. occupiedsRepertoire, clonalHomeostasis, clonalDiversity are among these.

However, I'm unable to run clonalProportion and clonalOverlap on this object (also compareClonotypes). Removing the culprits from the output of expression2List resolves the problem.

circlize chordDiagram for compareClonotypes? and control color in Alluvial plot?

Hi, Nick:

I wonder if there's a way to instead of Alluvial plot in compareClonotypes, but use circlize chordDiagram? For example, I have 4 different tissues and clones may overlap. Alluvial can only do tissue 1 through 4 sequentially. Maybe circlize can show overlap from 1 to 4 to 1?

Also, is there a way to set color in Alluvial plot from compareClonotypes? I have a top clone(by proportion) in patient 1 tumor tissue, when I use compareClonotypes to compare 4 different tissues. Then, I compared 4 different T cell clusters, the top clone showed a different color. Is there a way to set the color for top clones?
How the order of the clones in Alluvial plot was set? top clone is not always on the top.

thanks for your time

Unable to install package

running

devtools::install_github("ncborcherding/scRepertoire")

I get the following output

✓ checking for file ‘/private/var/folders/bc/npspjlyx025bzz77sn2qb38c0000gn/T/RtmpDpR0mA/remotes76b07e658473/ncborcherding-scRepertoire-5b4506e/DESCRIPTION’ ...
─ preparing ‘scRepertoire’:
✓ checking DESCRIPTION meta-information ...
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘scRepertoire_0.99.4.tar.gz’

  • installing source package ‘scRepertoire’ ...
    ** using staged installation
    ** R
    ** data
    *** moving datasets to lazyload DB
    ** byte-compile and prepare package for lazy loading
    sh: line 1: 34803 Killed: 9 R_TESTS= '/Library/Frameworks/R.framework/Resources/bin/R' --no-save --no-restore --no-echo 2>&1 < '/var/folders/bc/npspjlyx025bzz77sn2qb38c0000gn/T//Rtmp1ALZPE/file87ec153b2769'
    ERROR: lazy loading failed for package ‘scRepertoire’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/scRepertoire’
    Error: Failed to install 'scRepertoire' from GitHub:
    (converted from warning) installation of package ‘/var/folders/bc/npspjlyx025bzz77sn2qb38c0000gn/T//RtmpDpR0mA/file76b03adadad9/scRepertoire_0.99.4.tar.gz’ had non-zero exit status

This is not an error unique to this package. I have encountered this error with a number of packages ever since upgrading to R > 4

using MacOS with R 4.0.2

any advice would be amazing.

Error while plotting Seurat objects after running "combineExpression"

Hi,
I have been following your vignette for scRepertoire and while trying to apply it to my own data I've encounter a problem. After running combineExpression I get and error when trying to plot the data: This is my code:

gd1 <-read.csv("all_contig_annotations.csv", header=T)
 combined.gd1 <- combineTCR(gd1, 
                            paste0(1, "_gammadelta" ),
                            ID= paste0("sample_",1 ),
                            cells ="T-GD")
 
 
 sample1.singlet <-readRDS("sample1.singlet.RDS")
 

 rownames([email protected]) <- paste0( "1_gammadelta_sample_1_", rownames([email protected]), "-1")
 
 seurat <- combineExpression(combined.gd1 , sample1.singlet, cloneCall="gene")
 
 DimPlot(seurat)
Error: Must request at least one colour from a hue palette.

I've noticed that the problem is that after combining the TCR data with gene expression data, I get barcodes with NAs. And if I remove cells that have 'NA's on meta.data, then the problem is solved. But why does it happen when I try to just plot and highlight clusters. Also, my data is supposed to have cells with no TCR but I still want to visualize them on my TSNE, so removing isn't a solution for me.

Diversity - export table

Hi Nick,

Thank you for creating and sharing this package, it helps a lot!

I'd like to ask you about the function clonalDiversity. It works fine when setted exportTable=F, however I got an error when tried the option exportTable=T:

Error in clonalDiversity(tcd8, cloneCall = "gene", colorBy = "seurat_clusters", :
object 'coef_matrix' not found

Thank you so much!

Mayra

A problemwith plotting the clonetype in seurat with umap

HI
Thank you for this great tool! It is very helpful for my analysis.
I faced a problem at the plotting clonetype in seurat with umap:
I do the plotting like this:
image
There are so many clusters are grey. However, I plot the frist two clonetype by highlightClonotypes(). It shows:
image
Is the plotting based on clonetypes` levels wrong? How can I fix this?
Thank you very much.

question on parseBCR function

Dear Dr. Borcherding,
In the parseBCR function the code when only having one entry is as follows:
else if (length(location.i) == 1) {
if (chain.i == "IGH") {
Con.df[y, heavy_lines] <- data2[location.i[1], h_lines]
}
else if (chain.i == "IGL") {
Con.df[y, light_lines] <- data2[location.i[2], l_lines]
}
else {
Con.df[y, light_lines] <- data2[location.i[1], k_lines]
}
}
But should the code in case chain.i == "IGL" not be identical to the code when chain.i would be not "IGH" or "IGL"? So, data2[location.i[1], l_lines] ... because you the location.i variable only has length 1 already?

with kind regards and thanks for your R-package!
Aldo

compareClonotypes output

Hi, Nick:

Thanks for developing this nice package.
I was trying my own data with scRepertoire. I can get it working with all the plots before integrating seurat, except the compareClonotypes output. It displays an empty plot with only Y axis label. What might be the issue here?

Killed: 9 issue during install

Had users contact me for a killed: 9 issue while trying to install both the master and the dev branches. Base on a github query seems to happen with seurat and wrapper packages in R.

Issue was resolved by re-installing miniconda.

If having the same issue, suggest reinstall miniconda, restart R session and then retry the devtools::install() command.

combineTCR function gave error

Hi,

I ran the command below on my samples and it gave error as shown below:

contig_tcr_tgd <- combineTCR(samples,
samples = tcr_list,
ID = tcr_list,
cells = "T-GD")

Error in $<-.data.frame(*tmp*, "sample", value = "Sample1") :
replacement has 1 row, data has 0

Each data.frame in the list samples have "TRA","TRAB" and "TRD" chains.

image

Please assist me, thank you!

Best,
eudoraleer

"None" in CTgene calls

Hello,

Firstly, thank you for the great package, it really is awesome.

I am trying to analyse a B cell dataset by comparing the different B cell clones (as defined by the clonecall "aa") that share the same V(D)J CTgenes. However, the vast majority of my CTgene calls for the heavy chain have "None" where the diverse gene segment should be. For example: "IGHV1-18.IGHJ3.None.IGHM_IGKV1-117.IGKJ2.IGKC"

I was wondering if this is simply an artefact from the sequencing, and therefore, there is nothing I can do about it in the R analysis or rather this is something I can rectify.

Thanks!
Rob

Error with filterMulti parameter

Hi,
I've started to analyze my filtered_contig files using scRepertoire. When I try to combine contigs and apply filters, I get the an error with the 'filterMulti' parameter. 'removeNA' and 'removeMulti' seem to work.

This is my code:

combined_clono_test3 <- combineTCR(contig_list_ex, samples = c("t1", "t2"), ID = c('1', '2'), cells ="T-AB", filterMulti = TRUE)
Error in UseMethod("mutate_") :
no applicable method for 'mutate_' applied to an object of class "list"

Thanks!

Feature Request: proportional cloneTypes definitions in combineExpression

Hey!

Great package! One suggestion I have (unless there is an approach to achieve the same thing within the package that I'm not seeing), is to give the option to use clonal proportion cutoffs, as can be done with clonalHomeostasis, to define expansion levels within the combineExpression command (instead of the raw number cutoffs).

I've worked with several scTCR datasets, and the common issue is that cell numbers vary greatly between samples, so a pipeline that has the option of using proportions throughout would be very useful!

Problem loading scRepertoire: there is no package called ‘tcR’

It was just brought to my attention that there is an error installing scRepertoire due to the loss of tcR in the CRAN archives. I am working on a better solution (scRepertoire doesn't actually use any of the tcR functions, it is imported by powerTCR), but for now I wanted to include 2 workarounds:

  1. devtools::install_github("https://github.com/cran/tcR")
  2. install_version("tcR", version = "2.3.2", repos = "http://cran.us.r-project.org”)

Thanks,
Nick

my issue in combined function

Hi Nicholas,
Thank you for the wonderful package. It is really nice and convenient for TCR and RNA analysis.
But, I found some problem when I used combined TCR function. The barcode would be different from the same input. my codes as following
`
options( stringsAsFactors = F)
join.cs<-colnames(pbmc)
group.info<[email protected]$hash.ID

DGE.group<-data.frame(barcode=as.character(join.cs),group=as.character(group.info))

csv1 <- read.csv("../filtered_contig_annotations.csv")

csv1$barcode<-gsub('-1','',csv1$barcode)

tmp<-(intersect(csv1$barcode,join.cs)) ##1076 cell barcodes are shared in VDJ and DGE
table(duplicated(tmp))
csv1<-subset(csv1,csv1$barcode%in%tmp)

csv1<-left_join(csv1,DGE.group)

contig_list <- split(csv1,csv1$group)

combined <- combineTCR(contig_list, cells ="T-AB",samples = names(contig_list), ID = rep("VDJ",9))

############
csv2 <- read.csv("../filtered_contig_annotations.csv") ##CSV2 is the same as CSV1

csv2$barcode<-gsub('-1','',csv2$barcode)

tmp<-(intersect(csv2$barcode,join.cs)) ##1076 cell barcodes are shared in VDJ and DGE
table(duplicated(tmp))
csv2<-subset(csv2,csv2$barcode%in%tmp)

contig_list2 <- list(csv2)
combined2 <- combineTCR(contig_list2, cells ="T-AB",samples = 'SP1_3', ID = 'VDJ') ##the number of barcode in combined 2 is the same as combined 1, which is 950, but detailed sequence is different.

##########
VDJ.list2<-list()

for (i in 1:1) {VDJ.list2[[i]]=substr(combined2[[i]]$barcode,11,26)}

VDJ.list2<-unlist(VDJ.list2)

VDJ.list<-list()

for (i in 1:9) {VDJ.list[[i]]=substr(combined[[i]]$barcode,15,30)}

VDJ.list<-unlist(VDJ.list)

length(intersect(VDJ.list,VDJ.list2)) ##### the length here is only 24, rather than 950
`
I checked the barcode in contig_list. I guess ,for some reason,the barcode changed after 'combined <- combineTCR(contig_list, cells ="T-AB",samples = names(contig_list), ID = rep("VDJ",9))
' But, interesting thing is the barcode remains same after 'combined2 <- combineTCR(contig_list2, cells ="T-AB",samples = 'SP1_3', ID = 'VDJ') '.

As you may saw, I preferred using 'ombined <- combineTCR(contig_list, cells ="T-AB",samples = names(contig_list), ID = rep("VDJ",9))' when my TCR file already combined with samples. Would you like to help me to solve this problem?

And, my second issue happended in

`
seurat <- get(load("../pbmc.Robj"))
seurat<-seurat[,VDJ.list2]
DimPlot(seurat, label = T) + NoLegend()

seurat <- combineSeurat(combined2, seurat, cloneCall="gene", groupBy = "sample")`

it showed an error: i must have one dimension, not 2.

Sorry for the long questions.
Best wishes and Stay safe.

Cannot add clonotype to metadata

Hi Nick,

Thanks again for developing scRepertoire. I have a couple more questions.

Question 1. I am working through the pipeline and it works wonderfully. I am now in the step where I need to add the clonotype information in the Seurat object metadata but it doesn't seem to be working with my data. I can generate the graph showing the composition of each cluster prior adding clonoType as factor and projecting on UMAP/TSNE. I have 4 samples - each sample has a modified columns name to include a prefix to be recognizable and make different from all other barcodes (i.e. barcodes from other samples). At first I thought this would be the problem, so I added the same prefix for the CSV file and re-run the pipeline again but with no luck. Do you have any suggestions as to what could be happening here?

Question 2. What is the best way to readjust the cutpoints for clonoTypes on my data (i.e. Single, Small, Medium, Large, and Hyperexpanded)?

Question 3. I can generate the alluvial plots, but I do not see "connections" between clonotypes in my data set. Does this also have to do with the same problem I encountered in question 1 above?

Thanks for your help!

Morisita index

Hi Nick

I have been evaluating clonal overlap between cell subsets using the Morisita index implemented in the function clonalOverlap

However, I have noticed that it returns values >1, while by definition they should be between 0 and 1.

Are you using some different definition for this index, or is there a bug in the implementation?

The function seems to do something odd with the denominator:

coef.i.j <- 2 * sum(merged[, 2] * merged[, 3]/sum.df.j)/sum.df.j/((sum((df.i[, 
                  2]/sum.df.i)^2) + sum((df.j[, 2]/sum.df.j)^2)))

Thanks for clearing this up!
-mass

Error in combineTCR without ID

Hi Nick,

I am having an error to combine TCR when I did not provide the ID parameter.

I have 17 samples and compiled the contig list as per vignette.
When preparing the contig list, I also filtered for only a specific subset of cells of my interest.
However, when combining TCR, I fail to combine it if I only provide the samples parameter. I need to provide both the samples and ID parameter to be able to combine it. My code is as below:

# Prepare objects
metadata <- read.table(paste0(input, "/metadata.txt"), header = TRUE, sep = "\t")
sampleNames <- as.character(metadata$Sample)
sampleDX <- as.character(metadata$DX)

Output of sampleNames and sampleDX:

> sampleNames
 [1] "AC1"  "AC2"  "SML1" "ATL1" "AC3"  "AC4"  "ATL2" "ATL3" "ATL4" "SML2"
[11] "SML3" "ATL5" "ATL6" "ATL7" "HD1"  "HD2"  "HD3" 
> sampleDX
 [1] "AC"  "AC"  "SML" "ATL" "AC"  "AC"  "ATL" "ATL" "ATL" "SML" "SML" "ATL"
[13] "ATL" "ATL" "HD"  "HD"  "HD" 
# Load and filter contig data for T-cells only
contigList <- list()

for (n in 1:length(sampleNames)){
  id <- sampleNames[[n]]
  
  cells <- as.data.frame([email protected]) %>% 
    dplyr::filter(clinID == id) %>% 
    rownames(.) %>% 
    as.data.frame()
  
  # Strip sample ID from cell barcode to filter cells
  cells <- as.data.frame(str_split_fixed(cells$., "_", 2))
  cells <- as.character(cells$V2)
  
  csv <- read.csv(file = paste0(input, "/", id, ".csv"))
  csv <- dplyr::filter(csv, barcode %in% cells)
  
  contigList[[id]] <- csv
}

Combining contigs which failed

# Combine contigs
combined <- combineTCR(contigList, cells = "T-AB", samples = sampleNames)
Error: Make sure the sample and ID labels match the length of the list of data frames (df).

However, combineTCR works with this command:

combined <- combineTCR(contigList, cells = "T-AB", samples = sampleNames, ID = sampleDX)

Is there any way that I can bypass this issue? I don't actually need the additional information as my sample name is already indicative of my samples.

My session info is below:

> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS:   /usr/local/lib64/R/lib/libRblas.so
LAPACK: /usr/local/lib64/R/lib/libRlapack.so

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

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

other attached packages:
 [1] scRepertoire_0.99.9 reshape2_1.4.4      ggalluvial_0.12.2  
 [4] immunarch_0.6.5     patchwork_1.0.1     data.table_1.13.0  
 [7] dtplyr_1.0.1        AUCell_1.10.0       RColorBrewer_1.1-2 
[10] Seurat_3.2.1        stringi_1.5.3       cowplot_1.1.0      
[13] forcats_0.5.0       stringr_1.4.0       dplyr_1.0.2        
[16] purrr_0.3.4         readr_1.3.1         tidyr_1.1.2        
[19] tibble_3.0.3        ggplot2_3.3.2       tidyverse_1.3.0    

loaded via a namespace (and not attached):
  [1] reticulate_1.16             R.utils_2.10.1             
  [3] tidyselect_1.1.0            RSQLite_2.2.0              
  [5] AnnotationDbi_1.50.3        htmlwidgets_1.5.1          
  [7] grid_4.0.2                  Rtsne_0.15                 
  [9] munsell_0.5.0               codetools_0.2-16           
 [11] ica_1.0-2                   future_1.19.1              
 [13] miniUI_0.1.1.1              withr_2.3.0                
 [15] colorspace_1.4-1            Biobase_2.48.0             
 [17] knitr_1.30                  rstudioapi_0.11            
 [19] SingleCellExperiment_1.10.1 stats4_4.0.2               
 [21] ROCR_1.0-11                 robustbase_0.93-6          
 [23] ggsignif_0.6.0              tensor_1.5                 
 [25] listenv_0.8.0               GenomeInfoDbData_1.2.3     
 [27] polyclip_1.10-0             pheatmap_1.0.12            
 [29] bit64_4.0.5                 vctrs_0.3.4                
 [31] generics_0.0.2              xfun_0.17                  
 [33] ggseqlogo_0.1               doParallel_1.0.15          
 [35] diptest_0.75-7              R6_2.4.1                   
 [37] GenomeInfoDb_1.24.2         rsvd_1.0.3                 
 [39] VGAM_1.1-3                  flexmix_2.3-15             
 [41] bitops_1.0-6                spatstat.utils_1.17-0      
 [43] DelayedArray_0.14.1         assertthat_0.2.1           
 [45] promises_1.1.1              scales_1.1.1               
 [47] nnet_7.3-14                 gtable_0.3.0               
 [49] globals_0.13.0              goftest_1.2-2              
 [51] rlang_0.4.7                 GlobalOptions_0.1.2        
 [53] splines_4.0.2               rstatix_0.6.0              
 [55] lazyeval_0.2.2              broom_0.7.0                
 [57] abind_1.4-5                 modelr_0.1.8               
 [59] backports_1.1.10            httpuv_1.5.4               
 [61] tools_4.0.2                 cubature_2.0.4.1           
 [63] ellipsis_0.3.1              ggdendro_0.1.22            
 [65] BiocGenerics_0.34.0         ggridges_0.5.2             
 [67] Rcpp_1.0.5                  plyr_1.8.6                 
 [69] zlibbioc_1.34.0             RCurl_1.98-1.2             
 [71] ggpubr_0.4.0                rpart_4.1-15               
 [73] deldir_0.1-29               pbapply_1.4-3              
 [75] S4Vectors_0.26.1            zoo_1.8-8                  
 [77] SummarizedExperiment_1.18.2 haven_2.3.1                
 [79] ggrepel_0.8.2               cluster_2.1.0              
 [81] colorRamps_2.3              fs_1.5.0                   
 [83] factoextra_1.0.7            magrittr_1.5               
 [85] openxlsx_4.2.2              SparseM_1.78               
 [87] circlize_0.4.10             lmtest_0.9-38              
 [89] reprex_0.3.0                RANN_2.6.1                 
 [91] truncdist_1.0-2             fitdistrplus_1.1-1         
 [93] matrixStats_0.56.0          gsl_2.1-6                  
 [95] hms_0.5.3                   mime_0.9                   
 [97] xtable_1.8-4                XML_3.99-0.5               
 [99] rio_0.5.16                  mclust_5.4.6               
[101] readxl_1.3.1                IRanges_2.22.2             
[103] gridExtra_2.3               shape_1.4.5                
[105] compiler_4.0.2              KernSmooth_2.23-17         
[107] crayon_1.3.4                R.oo_1.24.0                
[109] htmltools_0.5.0             mgcv_1.8-33                
[111] later_1.1.0.1               powerTCR_1.8.0             
[113] lubridate_1.7.9             DBI_1.1.0                  
[115] dbplyr_1.4.4                MASS_7.3-53                
[117] fpc_2.2-8                   rappdirs_0.3.1             
[119] Matrix_1.2-18               car_3.0-9                  
[121] permute_0.9-5               cli_2.0.2                  
[123] R.methodsS3_1.8.1           evd_2.3-3                  
[125] parallel_4.0.2              igraph_1.2.5               
[127] GenomicRanges_1.40.0        pkgconfig_2.0.3            
[129] foreign_0.8-80              plotly_4.9.2.1             
[131] foreach_1.5.0               xml2_1.3.2                 
[133] annotate_1.66.0             stringdist_0.9.6           
[135] XVector_0.28.0              rvest_0.3.6                
[137] digest_0.6.25               sctransform_0.3            
[139] RcppAnnoy_0.0.16            vegan_2.5-6                
[141] graph_1.66.0                Biostrings_2.56.0          
[143] spatstat.data_1.4-3         cellranger_1.1.0           
[145] leiden_0.3.3                uwot_0.1.8                 
[147] GSEABase_1.50.1             evmix_2.12                 
[149] curl_4.3                    kernlab_0.9-29             
[151] shiny_1.5.0                 modeltools_0.2-23          
[153] lifecycle_0.2.0             nlme_3.1-149               
[155] jsonlite_1.7.1              carData_3.0-4              
[157] viridisLite_0.3.0           fansi_0.4.1                
[159] pillar_1.4.6                lattice_0.20-41            
[161] tcR_2.3.2                   fastmap_1.0.1              
[163] httr_1.4.2                  DEoptimR_1.0-8             
[165] survival_3.2-3              glue_1.4.2                 
[167] zip_2.1.1                   UpSetR_1.4.0               
[169] spatstat_1.64-1             iterators_1.0.12           
[171] shinythemes_1.1.2           png_0.1-7                  
[173] prabclus_2.3-2              bit_4.0.4                  
[175] class_7.3-17                ggfittext_0.9.0            
[177] blob_1.2.1                  memoise_1.1.0              
[179] irlba_2.3.3                 future.apply_1.6.0    

combineTCR using filterMulti = TRUE fails

Running combineTCR function with parameter filterMulti = TRUE fails with
Error in grepl(";", sampleID) : object 'sampleID' not found

Checking source what I find is this:

if (filterMulti == T) {
      for (i in seq_along(final)) {
        final[[i]] <- filter(final[[i]], !grepl(";", 
                                                sampleID))
      }
    }

but column sampleID is defined nowhere. this should probably point to somethig else?

Column "Type" not created when using combineExpression()

Hello,

For some reason when I try to combine my Seurat object with my combined TCR dataframe it is not working. I am not able to get the 'Type' column to be created when I run the function. I have made sure that the cell names are the same between both data sets as seen below.

head(combined$Peak_SPL$barcode)
[1] "Peak_SPL_AAACCTGAGAGGGATA-1" "Peak_SPL_AAACCTGAGCGAAGGG-1" "Peak_SPL_AAACCTGAGGGTCTCC-1" "Peak_SPL_AAACCTGAGTGGTAAT-1" "Peak_SPL_AAACCTGCACCAGATT-1"
[6] "Peak_SPL_AAACCTGCACCTTGTC-1"
head(combined$Peak_CNS$barcode)
[1] "Peak_CNS_AAACCTGAGACATAAC-1" "Peak_CNS_AAACCTGAGGCCCTCA-1" "Peak_CNS_AAACCTGAGGGTTCCC-1" "Peak_CNS_AAACCTGCACGGTAAG-1" "Peak_CNS_AAACCTGCACTGAAGG-1"
[6] "Peak_CNS_AAACCTGCAGCGTTCG-1"
head(combined$Chronic1_CNS$barcode)
[1] "Chronic1_CNS_AAACCTGAGAAGGACA-1" "Chronic1_CNS_AAACCTGAGCTCCTTC-1" "Chronic1_CNS_AAACCTGAGCTTATCG-1" "Chronic1_CNS_AAACCTGAGGCGTACA-1"
[5] "Chronic1_CNS_AAACCTGAGTACGCGA-1" "Chronic1_CNS_AAACCTGAGTTGTAGA-1"
head(combined$Chronic2_CNS$barcode)
[1] "Chronic2_CNS_AAACCTGCACTAGTAC-1" "Chronic2_CNS_AAACCTGGTGAGTATA-1" "Chronic2_CNS_AAACCTGGTTACCAGT-1" "Chronic2_CNS_AAACCTGTCCAGGGCT-1"
[5] "Chronic2_CNS_AAACCTGTCCCAACGG-1" "Chronic2_CNS_AAACGGGAGCCTCGTG-1"
head(combined$Chronic2_SPL$barcode)
[1] "Chronic2_SPL_AAACCTGAGATGTGTA-1" "Chronic2_SPL_AAACCTGAGCCTTGAT-1" "Chronic2_SPL_AAACCTGAGCTGAACG-1" "Chronic2_SPL_AAACCTGAGGGATACC-1"
[5] "Chronic2_SPL_AAACCTGCAATAAGCA-1" "Chronic2_SPL_AAACCTGCACAGGTTT-1"
head(combined$Chronic1_SPL$barcode)
[1] "Chronic1_SPL_AAACCTGAGCTGCCCA-1" "Chronic1_SPL_AAACCTGAGGCGCTCT-1" "Chronic1_SPL_AAACCTGAGTGCCAGA-1" "Chronic1_SPL_AAACCTGCAAACGTGG-1"
[5] "Chronic1_SPL_AAACCTGCAACGCACC-1" "Chronic1_SPL_AAACCTGCAACTTGAC-1"

head([email protected])
orig.ident nCount_RNA nFeature_RNA percent.mt integrated_snn_res.0.5 seurat_clusters
Peak_CNS_AAACCTGAGGCCCTCA-1 EAE_peak 8835 2945 1.833616 17 17
Peak_CNS_AAACCTGAGGGTTCCC-1 EAE_peak 5283 1635 2.763581 1 1
Peak_CNS_AAACCTGCACGGTAAG-1 EAE_peak 3321 1545 2.077687 2 2
Peak_CNS_AAACCTGCACTGAAGG-1 EAE_peak 9184 2415 2.776568 4 4
Peak_CNS_AAACCTGGTTCACGGC-1 EAE_peak 7632 2565 3.314990 3 3
Peak_CNS_AAACCTGTCTGGCGTG-1 EAE_peak 5586 1687 2.201933 1 1

This is just one of the samples, but I have checked all of the other names as well and they all match. I am not sure where to go from here, as the combineExpression() function runs, it just doesnt give me the 'Type' column. This is causing the downstream vignette to be problematic, as I am sure you can see.

code I am using to combine the TCR and seurat object

ExpTCR <- combineExpression(combined, eae.combined, cloneCall = 'gene+nt', groupBy = 'sample')

colnames([email protected])
[1] "orig.ident" "nCount_RNA" "nFeature_RNA" "percent.mt" "integrated_snn_res.0.5" "seurat_clusters"
[7] "barcode" "CTgene" "CTnt" "CTaa" "CTstrict" "Frequency"
[13] "cloneType"

Am I doing something wrong? I am quite a novice with all of this so any insights would be appreciated.

Also, in case my session info would be helpful here it is.

sessionInfo()
R version 4.0.4 (2021-02-15)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/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] cowplot_1.1.1 SeuratObject_4.0.0 Seurat_4.0.0 scRepertoire_1.1.4 ggplot2_3.3.3

loaded via a namespace (and not attached):
[1] cubature_2.0.4.1 Rtsne_0.15 VGAM_1.1-5 colorspace_2.0-0 deldir_0.2-10
[6] ellipsis_0.3.1 ggridges_0.5.3 evd_2.3-3 XVector_0.30.0 GenomicRanges_1.42.0
[11] rstudioapi_0.13 spatstat.data_2.0-0 farver_2.0.3 leiden_0.3.7 listenv_0.8.0
[16] gsl_2.1-6 ggrepel_0.9.1 RSpectra_0.16-0 fansi_0.4.2 codetools_0.2-18
[21] splines_4.0.4 doParallel_1.0.16 polyclip_1.10-0 jsonlite_1.7.2 evmix_2.12
[26] ica_1.0-2 cluster_2.1.1 png_0.1-7 uwot_0.1.10 shiny_1.6.0
[31] sctransform_0.3.2 compiler_4.0.4 httr_1.4.2 lazyeval_0.2.2 Matrix_1.3-2
[36] fastmap_1.1.0 later_1.1.0.1 htmltools_0.5.1.1 tools_4.0.4 igraph_1.2.6
[41] gtable_0.3.0 glue_1.4.2 GenomeInfoDbData_1.2.4 RANN_2.6.1 reshape2_1.4.4
[46] dplyr_1.0.4 spatstat_1.64-1 Rcpp_1.0.6 scattermore_0.7 Biobase_2.50.0
[51] tcR_2.3.2 vctrs_0.3.6 nlme_3.1-152 iterators_1.0.13 ggalluvial_0.12.3
[56] lmtest_0.9-38 stringr_1.4.0 globals_0.14.0 mime_0.10 miniUI_0.1.1.1
[61] lifecycle_1.0.0 irlba_2.3.3 goftest_1.2-2 stringdist_0.9.6.3 future_1.21.0
[66] zlibbioc_1.36.0 MASS_7.3-53.1 zoo_1.8-8 scales_1.1.1 spatstat.utils_2.0-0
[71] promises_1.2.0.1 MatrixGenerics_1.2.1 parallel_4.0.4 SummarizedExperiment_1.20.0 SparseM_1.81
[76] RColorBrewer_1.1-2 pbapply_1.4-3 reticulate_1.18 gridExtra_2.3 rpart_4.1-15
[81] truncdist_1.0-2 stringi_1.5.3 S4Vectors_0.28.1 foreach_1.5.1 permute_0.9-5
[86] BiocGenerics_0.36.0 GenomeInfoDb_1.26.2 rlang_0.4.10 pkgconfig_2.0.3 matrixStats_0.58.0
[91] bitops_1.0-6 lattice_0.20-41 tensor_1.5 ROCR_1.0-11 purrr_0.3.4
[96] labeling_0.4.2 htmlwidgets_1.5.3 patchwork_1.1.1 tidyselect_1.1.0 parallelly_1.23.0
[101] RcppAnnoy_0.0.18 plyr_1.8.6 magrittr_2.0.1 R6_2.5.0 IRanges_2.24.1
[106] generics_0.1.0 DelayedArray_0.16.1 DBI_1.1.1 powerTCR_1.10.0 pillar_1.5.0
[111] withr_2.4.1 mgcv_1.8-34 fitdistrplus_1.1-3 abind_1.4-5 survival_3.2-7
[116] RCurl_1.98-1.2 tibble_3.0.6 future.apply_1.7.0 crayon_1.4.1 KernSmooth_2.23-18
[121] utf8_1.1.4 plotly_4.9.3 grid_4.0.4 data.table_1.14.0 vegan_2.5-7
[126] digest_0.6.27 xtable_1.8-4 tidyr_1.1.2 httpuv_1.5.5 stats4_4.0.4
[131] munsell_0.5.0 viridisLite_0.3.0

Can this package be used on the BCR also?

HI Thank you for your great package for the TCR analysis.
I wonder if this package also can work on the BCR analysis also ,because the codes seems can also work on the BCR.
If not do you have any advises to use for the BCR analysis?
Thank you very much.

Help linking vdj to seurat object

Hi,

Thanks so much for this tool - it is exactly what I was after for my analysis!

I'm hoping to get some help with linking clonotype data to seurat objects (I am very new to R - apologies!).

I have paired gene expression and vdj data from 3 patients / 2 tissues. I have created 6 merged seurat objects and associated clonotypes as illustrated below:

Patient TIssue Object 1 Object 2 Object 3 Object 4 Object 5 Object 6
1 A X     X   X
  B X       X X
2 A   X   X   X
  B   X     X X
3 A     X X   X
  B     X   X X

I'm using the code (for example):

object6.combined = combineExpression(object6_vdj, object6.combined, cloneCall = "gene", groupBy = "sample")

Which works great for Objects 4, 5 and 6, however I'm getting the error:

Error in $<-.data.frame(*tmp*, "cloneType", value = NA):
replacement has 1 row, data has 0

When trying link clonotype and seurat data for objects 1, 2 and 3.

I'm assuming this is due to the groupBy argument as 'sample' is one value for these objects (e.g. for Object 1, sample = Patient 1), however changing to another value (e.g. ID, which in this case is Tissue (A or B)) gives the same error. Removing the groupBy argument completely transfers NA values across the board (barcode, CTgene, CTnt, CTaa, CTstrict, Frequency, cloneType).

Any help would be greatly appreciated and again, thank you so much for this package!

clonalDiversity legend text when grouping

I know that legend text can be modified via ggplot, but apart from the specific problem, I'd like to know if I'm doing this correctly. I'll give you a bit of context so that you can tell me how wrong I'm using the package, and point me in the right direction :)

Put simply, I have a set of Seurat objects, one per patient. The patients are tagged with one of several conditions.
I combine their TCR information via combineTCR(tcr_list, samples = samples, ID = condition, cells ="T-AB"), I add the gene expression information so that I have a single sce object, and then convert to several lists:

by_celltype <- expression2List(sce, group = "celltype")
by_condition <- expression2List(sce, group = "condition")
by_patient <- expression2List(sce, group = "patient")

For most of the plots, I simply use one of the above lists. But with clonalDiversity, I wanted to see each patient's diversity coloured by condition. So I ran:

clonalDiversity(by_patient, cloneCall = "gene+nt", group = 'condition')

All seems good but the legend text is numeric, from 1 to 5, rather than using the condition levels.

Of note, I've also tried to produce the plot via clonalDiversity(combined, cloneCall="gene+nt", group = "ID") and the legend shows the conditions' names, but the output is quite different. So one of the two must be wrong.

Error: could not find function “StartracDiversity"

I'm using scRepertoire (version 1.0.0) with R version 4.0.2.
When I try to use the 'StartracDiversity' function, I get the error below.

Error: could not find function “StartracDiversity”

Is the "StartracDiversity" function available now?

Missing functions

2 functions - StartracDiversity() and changeNames() - mentioned in the vignette of this package are missing.

Failed to install 'scRepertoire'

Hello Nick,

I was trying to install the package on my desktop, for some reason, it kept failing to install, here is the error message I got:

Error in system(paste("mv -f", shQuote(instdir), shQuote(dirname(final_instdir)))) :
(converted from warning) error in running command
sh: rm: command not found
Error: Failed to install 'scRepertoire' from GitHub:
(converted from warning) installation of package ‘GenomeInfoDbData’ had non-zero exit status

I have a imac system with macOS Big Sur, and R version 4.0.3, the code I used to install is the following:

devtools::install_github("ncborcherding/scRepertoire")

I was able to install the package on my laptop without running into any issues.

Can you help me with this?

Thanks,
Hous

error with exportTable option in compareClonotypes

Hi, Nick:

When I just do
compareClonotypes(combined, numbers = 10, cloneCall="aa", graph = "alluvial")
it works fine with the plot.
but when I added exportTable option
compareClonotypes_output<-compareClonotypes(combined, numbers = 10, cloneCall="aa", graph = "alluvial", exportTable = TRUE)
compareClonotypes_output

I got the following error:
Error in compareClonotypes(combined, numbers = 10, cloneCall = "aa", exportTable = TRUE): unused argument (exportTable = TRUE)
Traceback:

compareClonotypes for specific clones

Thanks for the nice package!

I have been trying to plot the frequencies of some specific clones across a few samples using the compareClonotypes function. I found the 'clonotypes' option, which should allow me to select my clones of interest, however the functions fails to do the filtering. A quick look at the code suggest a possible reason:

 if (!is.null(clonotypes)) {
        Con.df <- Con.df[Con.df$Sample %in% clonotypes, ]
 }

The Con.df$Clonotypes column should be used for the selection instead of Con.df$Sample, or am I missing something?

Thanks,
-m

combining expression: Metadata NA

Thank you very much for the nice tools.
We have a scRNA seq+Citeseq and TCR seq data. The data contains 3 runs which we are merging and each run contains different disease samples. So we would like to extrapolate clonotype information for the disease samples rather than runs? Is it possible to perform this analysis using scRepertoire?

Apart from this, we are also encountering an error in
Combining expression function is adding NA values to CTgene, ctstrict, ctgene+nt and the UMAP plot therefore only contains NA values.
What could be the potential problem and how can this be rectified?

Hers is how I´m combining the expression

Seurat <- combineExpression(
          combined, 
          cd4t_integrated, 
          cloneCall="gene+nt", 
          groupBy = "none",
          cloneTypes = c(Rare = 1e-4, Small = 0.001, Medium = 0.01, Large = 0.1, Hyperexpanded = 1),
          )

DimPlot(Seurat, label = T) + NoLegend()
Seurat <-cd4t_integrated

slot(Seurat, "meta.data")$cloneType <- factor(slot(Seurat, "meta.data")$cloneType, 
                levels = c("Hyperexpanded (0.1 < X <= 1)", "Large (0.01 < X <= 0.1)", 
                            "Medium ( 0.001 < X <=  0.01)", "Small (0.00001 < X <= 0.001)","Rare (0.00004 < X <= 0.0)", NA))
DimPlot(sce, group.by = "cloneType") +
    scale_color_manual(values = colorblind_vector(5), na.value="grey")

Screen shot of clonotype group
Screenshot 2021-01-14 at 21 43 35

Thanks in advance

Error when calling combineTCR

Hello,

Thank you for making this useful package available.

I have 6 filtered_contig_annotation.csv files from 10x Genomics Cell Ranger that I put into a contig_list as per the vignette. I am trying to called CombineTCR on this list but get the following error:

combined <- combineTCR(contig_list, samples = NAMES, ID = NAMES, cells ="T-AB")
Error in $<-.data.frame(*tmp*, "sample", value = "CD123456-1") :
replacement has 1 row, data has 0

I was wondering what is wrong and how to I can properly run combineTCR.

Thank you
shui

using combineExpression multiple times (TCR/BCR)

Hi,

Thanks for an excellent package.

My background is in compsci not so much bio/immunology so forgive me if this comes off as naive!

I wanted to know the best practice for adding tcr (both t-ab and t-gd)/bcr data to my Seurat object.

Following the vignette provided, can I just call combineExpression for each?

For example,
seurat_obj <- combineExpression(tcr_contig_combined_t_ab,seurat_obj,...)
seurat_obj <-combineExpression(tcr_contig_combined_t_gd,seurat_obj,...)
seurat_obj <-combineExpression(bcr_contig_combined,seurat_obj,...)

Thanks!

help with combineExpression: Error: Cannot find 'Type' in this Seurat object

Hi!
Thank you for this great package.

I think I am doing something wrong but I haven't understood what.
Briefly, I have two samples labeled as "06" and "07", it's the sample patient 06 = pre-chemotherapy, 07 = post-chemotherapy.
The following is my combined file:
combined <- combineTCR(contig_data,
samples = c("06", "07"),
ID = c("pre", "post"), cells ="T-AB")
Then I've modified the metadata rownames in my seurat object to make them the same of the barcodes in combined:

head(rownames([email protected])[ind_1])
[1] "06_pre_AAACCTGAGACGCACA-1" "06_pre_AAACCTGTCCCTAATT-1" "06_pre_AAACCTGTCTTGCATT-1" "06_pre_AAACGGGTCCAGAAGG-1" "06_pre_AAAGATGAGGCGCTCT-1"
[6] "06_pre_AAAGATGCAAAGTGCG-1"
head(rownames([email protected])[ind_2])
[1] "07_post_AAACCTGCAAAGTGCG-1" "07_post_AAACCTGGTCAATACC-1" "07_post_AAACCTGTCCAAATGC-1" "07_post_AAACCTGTCGACCAGC-1" "07_post_AAACCTGTCTGAGGGA-1"
[6] "07_post_AAACGGGAGCGTTCCG-1"
head(combined$06_pre$barcode)
[1] "06_pre_AAACCTGAGACGCACA-1" "06_pre_AAACCTGCACCGAAAG-1" "06_pre_AAACCTGGTCTACCTC-1" "06_pre_AAACCTGGTGGTAACG-1" "06_pre_AAACCTGTCAGCAACT-1"
[6] "06_pre_AAACCTGTCCCTAATT-1"
head(combined$07_post$barcode)
[1] "07_post_AAACCTGCAAAGTGCG-1" "07_post_AAACCTGGTCAATACC-1" "07_post_AAACCTGGTGCGATAG-1" "07_post_AAACCTGTCCAAATGC-1" "07_post_AAACCTGTCCACGTTC-1"
[6] "07_post_AAACCTGTCTGAGGGA-1"

Then i run successfully
sobj_CD8 <- combineExpression(combined, sobj_CD8, cloneCall = "gene", groupBy = "sample")

but when I try to plot the UMAP as in the vignette
colorblind_vector <- colorRampPalette(c("#FF4B20", "#FFB433", "#C6FDEC", "#7AC5FF", "#0348A6"))
DimPlot(seurat, group.by = "Type") + NoLegend() +
scale_color_manual(values=colorblind_vector(2))

It gives me the following error: Error: Cannot find 'Type' in this Seurat object (Indeed I can't find "Type" in the object metadata)

I've even tried to skip this and go to the following
slot(seurat, "meta.data")$cloneType <- factor(slot(seurat, "meta.data")$cloneType,
levels = c("Hyperexpanded (100 < X <= 500)", "Large (20 < X <= 100)",
"Medium (5 < X <= 20)", "Small (1 < X <= 5)",
"Single (0 < X <= 1)", NA))
DimPlot(seurat, group.by = "cloneType") +
scale_color_manual(values = colorblind_vector(5), na.value="grey")

And I obtain a grey UMAP as there would be only missing values.

Would you help me?

Thanks

Francesco

Using an already 'merged' Seurat object

I have a weird use case and I wonder if there's quick solution to be able to use it with this package.

So far I've worked with separate seurat objects, one per sample - and successfully used combineTCR and expression2List to produce all the plots.

Now however I have a sort of normalised Seurat object, with all the samples together and the TCR data already added. But it seems I can't use it with scRepertoire because it expects a .

But is there some trick I can use to make it work? clonoType for example I would have to add manually, I guess. And so all the columns that combineTCR adds.

ERROR: lazy loading failed for package ‘scRepertoire’

Had a user email me with the following:

devtools::install_github("ncborcherding/scRepertoire")
Downloading GitHub repo ncborcherding/scRepertoire@master
Skipping 2 packages not available: Biostrings, powerTCR
checking for file ‘/private/var/folders/y5/8f_d9m3x1mxdz8_f4wydlpwh0000gn/T/Rtmp4Ztt6s/remotes1f36415e38b6/ncborcherding-scRepertoire-eab0e39/DESCRIPTION’ ...✓ checking for file ‘/private/var/folders/y5/8f_d9m3x1mxdz8_f4wydlpwh0000gn/T/Rtmp4Ztt6s/remotes1f36415e38b6/ncborcherding-scRepertoire-eab0e39/DESCRIPTION’
─ preparing ‘scRepertoire’:
✓ checking DESCRIPTION meta-information ...
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ looking to see if a ‘data/datalist’ file should be added
─ building ‘scRepertoire_1.0.0.tar.gz’

  • installing source package ‘scRepertoire’ ...
    ** using staged installation
    ** R
    ** data
    *** moving datasets to lazyload DB
    ** byte-compile and prepare package for lazy loading
    Error: (converted from warning) package ‘ggalluvial’ was built under R version 3.6.2
    Execution halted
    ERROR: lazy loading failed for package ‘scRepertoire’
  • removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/scRepertoire’
    Error: Failed to install 'scRepertoire' from GitHub:
    (converted from warning) installation of package ‘/var/folders/y5/8f_d9m3x1mxdz8_f4wydlpwh0000gn/T//Rtmp4Ztt6s/file1f3610dd5641/scRepertoire_1.0.0.tar.gz’ had non-zero exit status

The problem seems to stem from a warning-to-error conversion and the issue was solved by changing the environmental variables:
– R_REMOTES_NO_ERRORS_FROM_WARNINGS="true" (see this link).

How to use combineTCR and combineExpression with multiple samples?

Hello,

Thanks for the wonderful package!

I have two questions regarding combining more than 6 samples,

  1. Can I use combineTCR() for more than 6 samples? Is there any way to merge multiple contig_lists into one combined contig?
  2. When attaching VDJ information using combineExpression(), can I attach multiple combined contigs?

Thank you!
Hous

expression2List() not taking alphanumeric values

Hello,

Thanks for the package it's being very useful for my analyzes. I'm using scRepertoire v1.2.1. All functions work as expected following the vignette. But I have one question regarding expression2List(). It works when I use metadata with numeric values (e.g. 'seurat_clusters') but it doesn't work when using alphanumeric values (see example below). The list resulting from expression2List() has the correct names() for both 'seurat_clusters' and 'sample_type' metadata categories, but there are no values in the list when I use 'sample_type', even though I can see values in the Seurat object metadata. Note both metadata properties are passed as 'factor'.

>   [email protected][c(1:3,4013:4016),c("seurat_clusters","sample_type")]
                               seurat_clusters sample_type
SMTR02_pretx_CGTAGCGCAACGCACC               20       pretx
SMTR02_pretx_AGGGATGAGAGGTTGC               20       pretx
SMTR02_pretx_TCGGGACGTCGATTGT               20       pretx
SMTR07_t2_Rad_TCCACACTCCATGAAC              13         Rad
SMTR07_t2_Rad_TGAGGGACATGAGCGA              13         Rad
SMTR07_t2_Rad_TAGACCACAAGGTTCT              13         Rad
SMTR07_t2_Rad_CCGGTAGCAGGTTTCA              20         Rad

>   class([email protected]$seurat_clusters)
[1] "factor"
>   combined.seurat <- expression2List(seurat.object.each_clone_call, group = "seurat_clusters")
>   names(combined.seurat)
[1] "0"  "5"  "11" "13" "15" "20"
>   head(combined.seurat$`0`$seurat_clusters)
[1] 0 0 0 0 0 0
Levels: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

>   class([email protected]$sample_type)
[1] "factor"
>   combined.seurat <- expression2List(seurat.object.each_clone_call, group = "sample_type")
>   names(combined.seurat)
[1] "NonRad" "pretx"  "Rad"   
>   head(combined.seurat$Rad$sample_type)
factor(0)
Levels: NonRad pretx Rad

Is this behaviour expected? Can expression2List() be extended to take alphanumeric values?

Thanks.

change the default sample order in compareClonotypes

Hi, Nick:

I did compareClonotypes like the below, without specifying sample names.
compareClonotypes(combined, numbers = 10, cloneCall="aa", graph = "alluvial")

I have 5 samples. Is there a way to specify the order of samples in the Alluvial plot output?

thanks for your time

clonalOverlap() counting issue with method = "overlap"

hi, it's been very convenient to quickly explore the sc-TCR data with scRepertoire.
I found that 'overlap' ratio might be calculated using 'number of overlapped clonotypes / cell number of smaller sample' but not '/ clonotype number of smaller sample', just report this.

in utils.R line 163: " df.j_unique <- df.j[!duplicated(df.j$barcode),] " .

if this is combined df, then no need to uniq barcode, right ? CTaa ?

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.