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

Quick fix in normalised scoring for cases where nrns/dps unnamed #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions R/scoremats.r
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ sub_score_mat <- function(query, target, scoremat=NULL, distance=FALSE, normalis
if(!identical(length(dim(scoremat)),2L)) stop("scoremat must be a matrix!")

# Check for missing query and target neurons
if (is.null(rownames(scoremat)))
rownames(scoremat) <- as.character(1:nrow(scoremat))
rnames <- rownames(scoremat)
if(missing(target)) target <- rnames
else {
Expand All @@ -35,6 +37,8 @@ sub_score_mat <- function(query, target, scoremat=NULL, distance=FALSE, normalis
target <- intersect(target, rnames)
}
}
if (is.null(colnames(scoremat)))
colnames(scoremat) <- as.character(1:ncol(scoremat))
cnames=colnames(scoremat)
if(missing(query)) query <- cnames
else {
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-NBLAST2.r
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ test_that("we can calculate normalised nblast v2 scores", {
expect_equal(nblast(testneurons[1], testneurons[3:5], version = 2, normalised = T),
baseline)

names(testneurons) <- NULL
scoresaba <- nblast_allbyall(testneurons, version=2,
normalisation = 'normalised')
expect_equal(dim(scoresaba), c(5, 5))
})

test_that("we can calculate scores for regular neurons",{
Expand Down