-
Notifications
You must be signed in to change notification settings - Fork 20
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
cbind
: unique/duplicated colnames
are left asis/made unique; read10xVisium
: keep barcodes as colData
; spatialCoords/<-
: withDimnames
argument
#128
Open
HelenaLC
wants to merge
12
commits into
devel
Choose a base branch
from
cbind_unique_colnms
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
cc93497
assure cbind gives unique colnames & barcodes are kept as colData
CATALYST-project 8d81990
Update R-cmd-check.yaml
drighelli 3ddd2c3
+withDimnames arg in spatialCoords getter&setter
CATALYST-project d8aabf6
add doc for param 'withDimnames'
CATALYST-project ac4bd0f
Merge branch 'cbind_unique_colnms' into spatialCoords
CATALYST-project 1b4fad4
version bump to v1.9.4
CATALYST-project fe40c8f
fix bug in unit tests (uninitialized variable)
CATALYST-project 2831903
resolve merge conflicts
CATALYST-project 8842c22
update NEWS file v1.9.4
CATALYST-project fc2e6af
fix generic/method defintiions
CATALYST-project 253e5e4
add doc for ... param
CATALYST-project 0db2ad7
Merge branch 'devel' into cbind_unique_colnms
drighelli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,4 +49,4 @@ Suggests: | |
BiocStyle, | ||
BumpyMatrix | ||
VignetteBuilder: knitr | ||
RoxygenNote: 7.2.1 | ||
RoxygenNote: 7.2.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
|
||
# spatialCoords ---------------------------------------------------------------- | ||
|
||
#' @rdname SpatialExperiment-methods | ||
#' @importFrom SingleCellExperiment int_colData<- | ||
#' @export | ||
setMethod("spatialCoords", | ||
"SpatialExperiment", | ||
function(x, withDimnames=TRUE) { | ||
out <- int_colData(x)$spatialCoords | ||
if (withDimnames) | ||
rownames(out) <- colnames(x) | ||
return(out) | ||
}) | ||
|
||
#' @rdname SpatialExperiment-methods | ||
#' @importFrom SingleCellExperiment int_colData<- | ||
#' @export | ||
setReplaceMethod("spatialCoords", | ||
c("SpatialExperiment", "matrix"), | ||
function(x, value, withDimnames=TRUE) { | ||
stopifnot( | ||
is.numeric(value), | ||
nrow(value) == ncol(x)) | ||
new <- rownames(value) | ||
if (!is.null(new) && withDimnames) { | ||
if (!identical(new, colnames(x))) { | ||
stop("Non-NULL 'rownames(value)' should be the", | ||
" same as 'colnames(x)' for 'spatialCoords<-'.", | ||
" Use 'withDimnames=FALSE' to force replacement.") | ||
} | ||
} | ||
int_colData(x)$spatialCoords <- value | ||
return(x) | ||
} | ||
) | ||
|
||
#' @rdname SpatialExperiment-methods | ||
#' @export | ||
setReplaceMethod("spatialCoords", | ||
c("SpatialExperiment", "NULL"), | ||
function(x, value, withDimnames=TRUE) { | ||
value <- matrix(numeric(), ncol(x), 0) | ||
`spatialCoords<-`(x, value) | ||
} | ||
) | ||
|
||
# spatialCoordsNames ----------------------------------------------------------- | ||
|
||
#' @rdname SpatialExperiment-methods | ||
#' @importFrom SingleCellExperiment int_colData | ||
#' @export | ||
setMethod("spatialCoordsNames", | ||
"SpatialExperiment", | ||
function(x) colnames(int_colData(x)$spatialCoords)) | ||
|
||
#' @rdname SpatialExperiment-methods | ||
#' @importFrom SingleCellExperiment int_colData<- | ||
#' @export | ||
setReplaceMethod("spatialCoordsNames", | ||
c("SpatialExperiment", "character"), | ||
function(x, value) { | ||
colnames(int_colData(x)$spatialCoords) <- value | ||
return(x) | ||
} | ||
) | ||
|
||
#' @rdname SpatialExperiment-methods | ||
#' @export | ||
setReplaceMethod("spatialCoordsNames", | ||
c("SpatialExperiment", "NULL"), | ||
function(x, value) { | ||
value <- character() | ||
`spatialCoordsNames<-`(x, value) | ||
} | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a warning that I suppose is coming from the "matrix" instead of a "value"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I saw. But I don’t understand because it’s good locally. I’m on it…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed I don't get why, but have you tried something like:
c("SpatialExperiment", "value")
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's because the generic is defined as
setGeneric("spatialCoords<-", function(x, value, withDimnames=TRUE) standardGeneric("spatialCoords<-"))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…the signature has to be classes, so “NULL” and “matrix” (not “value”) is correct. It’s saying the generic and methods don’t match. But I don’t see why not as they both have “value” in the function definition in the same order…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I saw that, I'm looking over the internet, but still I'm not able to understand the motivation for this warning.