Skip to content

Commit

Permalink
Debug nimble data issue
Browse files Browse the repository at this point in the history
  • Loading branch information
bbimber committed Jan 28, 2025
1 parent f6e602f commit 17142f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/NimbleAPI.R
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ DownloadAndAppendNimble <- function(seuratObject, targetAssayName, outPath=tempd
}
}

d <- as.integer(nimbleTable$V2)
if (any(is.na(d))){
stop(paste0('Non-integer count values found, were: ', paste0(head(unique(df$nimbleTable[is.na(d)])), collapse = ',')))
}

# strip hyphens
nimbleTable$V3 <- gsub(nimbleTable$V3, pattern = '-[0-9]$', replacement = '')

Expand Down
5 changes: 5 additions & 0 deletions R/NimbleAppend.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ AppendNimbleCounts <- function(seuratObject, nimbleFile, targetAssayName, maxAmb
stop("The nimble data contains features with trailing commas. This should not occur.")
}

d <- as.integer(df$V2)
if (any(is.na(d))){
stop(paste0('Non-integer count values found, were: ', paste0(head(df$V2[is.na(d)]), collapse = ',')))
}

#Remove ambiguous features
totalHitsByRow <- sapply(df$V1, function(y){
return(length(unlist(strsplit(y, split = ','))))
Expand Down

0 comments on commit 17142f7

Please sign in to comment.