ncborcherding / scRepertoire

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

Question : compareClonotypes output >number of top clones #380

Closed paulrbuckley-kcl closed 5 months ago

paulrbuckley-kcl commented 5 months ago

Hi

Thanks for making a great package.

I have a question re compareClonotypes function - i am using an older version AFAIK.

I am using the following code to loop through a load of patients and plot clones across timepoints. You will note I am asking for the top 10, I am wondering how this works as at TP1 (left side) i have more than ten clones? An example plot is attached. I am wondering if you could help explain please

Thank you


foreach(i=1:length(unique(uncorrected$patient_id)))%do% {

patient = (unique(uncorrected$patient_id))[i]
subset <- subsetContig(combined_TCR, name = "patient_id", 
                       variables = patient)

response = colData(uncorrected) %>% as.data.table() %>% dplyr::filter(patient_id == patient) %>% pull(response) %>% unique()
SAMPLES = colData(uncorrected) %>% as.data.table() %>% dplyr::filter(patient_id == patient)%>% select(ID_SAMPLE)%>% pull() %>% unique()%>% sort()       
options(repr.plot.height=7,repr.plot.width=15,repr.plot.res=300)

plot = compareClonotypes(subset,  
                  samples = SAMPLES, 
                  cloneCall="aa", 
                  numbers=10,
                  graph = "alluvial")+ggtitle(paste0("Patient ID: ",patient," Response: ",response))

}
Screenshot 2024-06-07 at 17 37 45
ncborcherding commented 5 months ago

Hey Paul,

Not knowing which version you are using exactly - there can be 2 things causing this.

Hope that helps - let me know if you have any other questions. Nick