Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update clonalLength() #414

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading