Skip to content

Commit

Permalink
Merge pull request #414 from ncborcherding/dev
Browse files Browse the repository at this point in the history
update clonalLength()
  • Loading branch information
ncborcherding authored Oct 8, 2024
2 parents a6d169f + 21e3b54 commit e9d8f6d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: scRepertoire
Title: A toolkit for single-cell immune receptor profiling
Version: 2.0.7
Version: 2.0.8
Authors@R: c(
person(given = "Nick", family = "Borcherding", role = c("aut", "cre"), email = "[email protected]"),
person(given = "Qile", family = "Yang", role = c("aut"), email = "[email protected]"),
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# scRepertoire VERSION 2.0.8

## UNDERLYING CHANGES
* Fixed issue with single chain output for ```clonalLength()```
* Removed unnecessary code remnant in ```clonalLength()```

# scRepertoire VERSION 2.0.7

## UNDERLYING CHANGES
Expand Down
13 changes: 1 addition & 12 deletions R/clonalLength.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,9 @@ clonalLength <- function(input.data,
CDR3 sequence to analyze by using `cloneCall`")
}

#Identifying and assigning chains
chain.pos <- which(colnames(input.data[[1]]) == "cdr3_aa1")-1
c1 <- na.omit(unique(substr(input.data[[1]][seq_len(10),chain.pos], 1,3)))
c1 <- c1[c1 != "NA."]
c1 <- c1[c1 != "NA"]

c2 <- switch(c1,
"TRA" = "TRB",
"IGH" = "IGL",
"TRG" = "TRD")

#Calculating Length
Con.df <- NULL
Con.df <- .lengthDF(input.data, cloneCall, chain, group.by, c1, c2)
Con.df <- .lengthDF(input.data, cloneCall, chain, group.by)

names <- names(input.data)

Expand Down
11 changes: 7 additions & 4 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@
#Producing a data frame to visualize for lengthContig()
#' @keywords internal
#' @importFrom stringr str_remove_all
.lengthDF <- function(df, cloneCall, chain, group, c1, c2){
.lengthDF <- function(df, cloneCall, chain, group){
Con.df <- NULL
names <- names(df)
if (identical(chain, "both")) {
Expand Down Expand Up @@ -456,14 +456,17 @@
chain1 <- nchar(val1)
if (!is.null(group)) {
cols1 <- df[[x]][,group]
data1 <- data.frame(chain1, val1, names[x], c1, cols1)
data1 <- data.frame(chain1, val1, names[x], chain, cols1)
colnames(data1)<-c("length","CT","values","chain",group)
}else if (is.null(group)){
data1 <- data.frame(chain1, val1, names[x], c1)
data1 <- data.frame(chain1, val1, names[x], chain)
colnames(data1) <- c("length", "CT", "values", "chain")
}
data <- na.omit(data1)
data <- subset(data, CT != "NA" & CT != "")
Con.df<- rbind.data.frame(Con.df, data) }}
Con.df<- rbind.data.frame(Con.df, data)

}
}
return(Con.df)
}
Expand Down

0 comments on commit e9d8f6d

Please sign in to comment.