Skip to content

Commit

Permalink
Update combineExpression.R
Browse files Browse the repository at this point in the history
  • Loading branch information
noranekonobokkusu authored Feb 9, 2024
1 parent 1ae908c commit 1459890
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions R/combineExpression.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,14 @@ combineExpression <- function(input.data,
clonalFrequency = n())
colnames(data2)[1] <- cloneCall
data <- merge(data, data2, by = cloneCall, all = TRUE)
data <- data[,c("barcode", "CTgene", "CTnt",
"CTaa", "CTstrict", "clonalProportion",
"clonalFrequency")]
if ( cloneCall %!in% c("CTgene", "CTnt", "CTaa", "CTstrict") ) {
data <- data[,c("barcode", "CTgene", "CTnt",
"CTaa", "CTstrict", cloneCall,
"clonalProportion", "clonalFrequency")]

Check warning on line 97 in R/combineExpression.R

View check run for this annotation

Codecov / codecov/patch

R/combineExpression.R#L95-L97

Added lines #L95 - L97 were not covered by tests
} else {
data <- data[,c("barcode", "CTgene", "CTnt",
"CTaa", "CTstrict",
"clonalProportion", "clonalFrequency")] }
Con.df <- rbind.data.frame(Con.df, data)
}
} else if (group.by != "none" || !is.null(group.by)) {
Expand All @@ -108,9 +113,14 @@ combineExpression <- function(input.data,

colnames(data2)[c(1,2)] <- c(cloneCall, group.by)
data <- merge(data, data2, by = c(cloneCall, group.by), all = TRUE)
Con.df <- data[,c("barcode", "CTgene", "CTnt",
"CTaa", "CTstrict", "clonalProportion",
"clonalFrequency")]
if ( cloneCall %!in% c("CTgene", "CTnt", "CTaa", "CTstrict") ) {
Con.df <- data[,c("barcode", "CTgene", "CTnt",
"CTaa", "CTstrict", cloneCall,
"clonalProportion", "clonalFrequency")]

Check warning on line 119 in R/combineExpression.R

View check run for this annotation

Codecov / codecov/patch

R/combineExpression.R#L117-L119

Added lines #L117 - L119 were not covered by tests
} else {
Con.df <- data[,c("barcode", "CTgene", "CTnt",
"CTaa", "CTstrict",
"clonalProportion", "clonalFrequency")] }
}
#Detect if largest cloneSize category is too small for experiment and amend
#this prevents a ton of NA values in the data
Expand Down Expand Up @@ -140,9 +150,16 @@ combineExpression <- function(input.data,
}

#Formating the meta data to add
PreMeta <- unique(Con.df[,c("barcode", "CTgene", "CTnt",
"CTaa", "CTstrict", "clonalProportion",
"clonalFrequency", "cloneSize")])
if ( cloneCall %!in% c("CTgene", "CTnt",
"CTaa", "CTstrict") ) {
PreMeta <- unique(Con.df[,c("barcode", "CTgene", "CTnt",
"CTaa", "CTstrict", cloneCall,
"clonalProportion", "clonalFrequency", "cloneSize")])

Check warning on line 157 in R/combineExpression.R

View check run for this annotation

Codecov / codecov/patch

R/combineExpression.R#L155-L157

Added lines #L155 - L157 were not covered by tests
} else {
PreMeta <- unique(Con.df[,c("barcode", "CTgene", "CTnt",
"CTaa", "CTstrict", "clonalProportion",
"clonalFrequency", "cloneSize")])
}
dup <- PreMeta$barcode[which(duplicated(PreMeta$barcode))]
PreMeta <- PreMeta[PreMeta$barcode %!in% dup,]
barcodes <- PreMeta$barcode
Expand Down

0 comments on commit 1459890

Please sign in to comment.