ncborcherding / scRepertoire

A toolkit for single-cell immune profiling
https://www.borch.dev/uploads/screpertoire/
MIT License
311 stars 54 forks source link

how to check whether there is TCR alpha alpha in the scTCRseq. #404

Closed synatkeamsk closed 2 months ago

synatkeamsk commented 2 months ago

Hi Nick and team,

Hope you are well. I have a quick question. I recently had a quick discussion with one of our collaborators and she asked whether there is TCR alpha alpha**** in our sequencing data. I looked at my data frame of each sample (kindly review attach file), I saw only TRA and TRB. I am not sure is there is a quick way to check whether there is TCR alpha alpha in my dataset or they are only TCR alpha and beta using scRepertoire package.

TCR sequencing data

Kind Regards,

synat

ncborcherding commented 2 months ago

Hey Synat,

If you are using the output of combineTCR() you can use the following code to isolate possible dual A T cells:

lapply(combined, function(x) {
  x$TRA.chains <- stringr::str_split(x$CTaa, "_", simplify = TRUE)[,1]
  dual.pos <- grep(";", x$TRA.chains)
  x[dual.pos,]

}) -> filtered.combined

Nick

synatkeamsk commented 2 months ago

Thanks, Nick for your code to filter out possible CTaa. Do you know which column (chain column?) that may possibly contains CTaa? I would like to manually check individual sample a bit to make sure whether I can see CTaa by eyes. So I can use code sth like df[df$chain == "CTaa", ] to check. Now I could not find CTaa somewhere in my dataframe. Sorry if the question is a bit naive and thank for your help.

Kind Regards,

Synat

ncborcherding commented 2 months ago

Hey Synat,

That code is for after you use combineTCR(). If you are looking at the filtered_contig_annotations file, you could use a dplyr approach to summarise the cells with more than 1 alpha chain:

df %>%
  filter(chain == "TRA") %>%
  group_by(barcode) %>%
  n()