Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete merging of vdj data and seurat with combineExpression function #375

Closed
cnwokolo24 opened this issue Jun 4, 2024 · 1 comment

Comments

@cnwokolo24
Copy link

Hi Nick,

Thank you for this very helpful tool.
I am trying to combine tcr & bcr data to my seurat object which has multiple samples integrated.
But after adding the list(tcr, bcr) of all the samples, I have to format the barcode to match my seurat object and when I do this only the first sample merges with the seurat obj.
Please see my code below to see what I am doing wrong.

##VDJ data
tcr_list = list(AIG1_TCR, AIG2_TCR, AIG3_TCR, AIG4_TCR, AIG5_TCR, HC1_TCR, HC2_TCR, HC3_TCR)
bcr_list = list(AIG1_BCR, AIG2_BCR, AIG3_BCR, AIG4_BCR, AIG5_BCR, HC1_BCR, HC2_BCR, HC3_BCR)

#combine
combined_tcr = combineTCR(tcr_list, samples = c("AIG1", "AIG2", "AIG3", "AIG4", "AIG5", "HC1", "HC2", "HC3"),
removeNA = T)
combined_bcr <- combineBCR(bcr_list, samples = c("AIG1", "AIG2", "AIG3", "AIG4", "AIG5", "HC1", "HC2", "HC3"),
removeNA = T, threshold = 0.85)

##add variable
combined_tcr <- addVariable(combined_tcr,
name = "condition",
variables = c("AIG", "AIG", "AIG", "AIG", "AIG", "HC", "HC", "HC"))
combined_bcr <- addVariable(combined_bcr,
name = "condition",
variables = c("AIG", "AIG", "AIG", "AIG", "AIG", "HC", "HC", "HC"))
list.receptors <- c(combined_tcr, combined_bcr)

#format list.receptors to match seurat object
list.receptors[["AIG1"]][["barcode"]] <- paste0(sub("^AIG1_", "", list.receptors[["AIG1"]][["barcode"]]), "1")
list.receptors[["AIG2"]][["barcode"]] <- paste0(sub("^AIG2
", "", list.receptors[["AIG2"]][["barcode"]]), "1")
list.receptors[["AIG3"]][["barcode"]] <- paste0(sub("^AIG3
", "", list.receptors[["AIG3"]][["barcode"]]), "1")
list.receptors[["AIG4"]][["barcode"]] <- paste0(sub("^AIG4
", "", list.receptors[["AIG4"]][["barcode"]]), "1")
list.receptors[["AIG5"]][["barcode"]] <- paste0(sub("^AIG5
", "", list.receptors[["AIG5"]][["barcode"]]), "_1")

list.receptors[["HC1"]][["barcode"]] <- paste0(sub("^HC1_", "", list.receptors[["HC1"]][["barcode"]]), "1")
list.receptors[["HC2"]][["barcode"]] <- paste0(sub("^HC2
", "", list.receptors[["HC2"]][["barcode"]]), "1")
list.receptors[["HC3"]][["barcode"]] <- paste0(sub("^HC3
", "", list.receptors[["HC3"]][["barcode"]]), "_1")

##add vdj to seurat to subsetted tcells with raw values
data.combined.vdj <- combineExpression(list.receptors,
data.combined,
cloneCall="gene",
group.by = "sample",
addLabel = T, proportion = F)

And when I run I see only one AIG
clonalProportion(tcells.vdj,

  •              split = c(10, 100, 1000, 10000, 30000, 1e+05),
    
  •              split.by = "condition", 
    
  •              cloneCall = "nt",
    
  •              chain = "both",
    
  •              exportTable = T)
    
    [1:10] [11:100] [101:1000] [1001:10000] [10001:30000] [30001:1e+05]
    AIG 10 71 0 0 0 0

When I run it combineExpression without formating the list.receptors, I get this: ""Error in [[<-:
! Cannot add more or less meta data without cell names
Run rlang::last_trace() to see where the error occurred.
Warning message:
In combineExpression(list.receptors, tcells, cloneCall = "gene", :
< 1% of barcodes match: Ensure the barcodes in
the Seurat object match the
barcodes in the combined immune receptor list from
scRepertoire - most common issue is the addition of the
prefixes corresponding to samples and 'ID' in the combineTCR/BCR()
functions"""
Please advise.

@ertingtang
Copy link

Hi! I wonder how you resolved this issue eventually? I encountered the same issue. Thanks for your reply in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants