ncborcherding / scRepertoire

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

[BUG] `clonalLength()` exports NULL when `group.by` and a single chain are provided #412

Closed pwwang closed 1 month ago

pwwang commented 1 month ago
library(scRepertoire)

data(contig_list)
data <- combineTCR(contig_list)
data <- addVariable(data, variable.name = "Type",
     variables = rep(c("B", "L"), each = 4))

df <- clonalLength(data, group.by = "Type", chain = "TRB", exportTable = TRUE)
df  # NULL
df <- clonalLength(data, group.by = "Type", chain = "both", exportTable = TRUE)
head(df)
#   length                               CT Type values
# 1     25       CGCSNDYKLSF_CASSLTDRTYEQYF    B     S1
# 2     31 CAYRSAQAGGTSYGKLTF_CAISEQGKGELFF    B     S1
# 3     31 CVVSDNTGGFKTIF_CASSVRRERANTGELFF    B     S1
# 4     31 CVVSDNTGGFKTIF_CASSVRRERANTGELFF    B     S1
# 5     13                 CAVRGEGFQKLVF_NA    B     S1
# 6     31 CVVSDNTGGFKTIF_CASSVRRERANTGELFF    B     S1
ncborcherding commented 1 month ago

Did not see this PR, already pushed something into the dev branch. Added a little more expanded fix/cleaning so I will decline your PR, but I really appreciate it!

pwwang commented 1 month ago

No worries. Thanks for the prompt fix.