Skip to content

Commit

Permalink
Update getIR.R
Browse files Browse the repository at this point in the history
change nomenclature for light and heavy BCR chains
  • Loading branch information
ncborcherding committed Aug 9, 2024
1 parent 683d38c commit 32f5e09
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions R/getIR.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ getIR <- function(input.data,
rownames(meta) <- meta[,"barcode"]
}
if(chains %!in% c("TRA", "TRB", "TRG", "TRD", "Heavy", "Light")) {
stop("Please select one of the following chains: 'TRA', 'TRB', 'Heavy', 'Light'")
stop("Please select one of the following chains: 'TRA', 'TRB', 'TRG', 'TRD' 'Heavy', 'Light'")
}
tmp <- data.frame(barcode = rownames(meta),
str_split(meta[,"CTaa"], "_", simplify = TRUE),
str_split(meta[,"CTgene"], "_", simplify = TRUE))
if (length(chains) == 1 && chains != "both") {
if (chains %in% c("TRA", "TRG", "IGH")) { #here
if (chains %in% c("TRA", "TRG", "Heavy")) { #here
pos <- list(c(2,4))
} else if (chains %in% c("TRB", "TRD", "IGL", "IGK")) { #here
} else if (chains %in% c("TRB", "TRD", "Light")) { #here
pos <- list(c(3,5))
}
}
Expand All @@ -54,12 +54,12 @@ getIR <- function(input.data,
sub <- as.data.frame(tmp[,c(1,pos[[i]])])

colnames(sub) <- c("barcode", "cdr3_aa", "genes")
if(chains %in% c("TRA", "TRG", "Light")) {
if(chains %in% c("TRA", "TRG", "Heavy")) {
sub$v <- str_split(sub$genes, "[.]", simplify = TRUE)[,1]
sub$d <- NA
sub$j <- str_split(sub$genes, "[.]", simplify = TRUE)[,2]
sub$c <- str_split(sub$genes, "[.]", simplify = TRUE)[,3]
} else if (chains %in% c("TRB", "TRD", "Heavy")) {
} else if (chains %in% c("TRB", "TRD", "Light")) {
sub$v <- str_split(sub$genes, "[.]", simplify = TRUE)[,1]
sub$d <- str_split(sub$genes, "[.]", simplify = TRUE)[,2]
sub$j <- str_split(sub$genes, "[.]", simplify = TRUE)[,3]
Expand Down

0 comments on commit 32f5e09

Please sign in to comment.