Skip to content

Commit

Permalink
Merge pull request #536 from drieslab/suite_dev
Browse files Browse the repository at this point in the history
3.2 patches
  • Loading branch information
jiajic authored Feb 2, 2023
2 parents 172c38b + 03d9d9a commit 069eded
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 15 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ export(trendSceek)
export(updateGiottoImage)
export(updateGiottoImageMG)
export(updateGiottoLargeImage)
export(updateGiottoObject)
export(validObject)
export(viewHMRFresults)
export(viewHMRFresults2D)
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- New `createSpatialWeightMatrix()` function to generate spatial weight matrix from spatial networks for autocorrelation
- Add spatial_interaction_spot.R with functions adapted from master branch for working with the Giotto suite object.
- New exported accessors for slots (experimental)
- New `multiomics` slot in `giotto`
- Add `coord_fix_ratio` param to `spatFeatPlot2D()` and `spatFeatPlot2D_single()`
- Add `order` parameter to `dimFeatPlot2D` and `spatDimFeatPlot2d` to plot and order cells according to the levels of the selected feature ([#477](https://github.com/drieslab/Giotto/issues/477))
- Add `plot()` method for `spatialNetworkObj`
Expand Down
42 changes: 33 additions & 9 deletions R/classes.R
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,39 @@ setClass('spatFeatData',
# .Object
# })

# TODO
# updateGiottoObject = function(gobject) {
# if(is.null(attr(gobject, 'multiomics'))) {
# attr(gobject, 'multiomics') = NA
# gobject@multiomics = NULL
# }
#
# return(gobject)
# }




#' @title Update giotto object
#' @name updateGiottoObject
#' @description Updates the giotto object for changes in structure for backwards
#' compatibility with earlier versions
#' @param gobject giotto object to update
#' @details
#' Supported updates:
#' \itemize{
#' \item{3.2.0 update adding multiomics slot}
#' \item{master branch to suite - TODO}
#' }
#' @usage gobject = updateGiottoObject(gobject)
#' @export
updateGiottoObject = function(gobject) {

if(!inherits(gobject, 'giotto')) {
stop(wrap_txt('This function is intended for updating giotto objects'))
}

# 3.2.0 release adds multiomics slot
if(is.null(attr(gobject, 'multiomics'))) {
attr(gobject, 'multiomics') = NA
gobject@multiomics = NULL
}

return(gobject)
}



##### * Definition ####
# Giotto class
Expand Down
15 changes: 9 additions & 6 deletions R/general_help.R
Original file line number Diff line number Diff line change
Expand Up @@ -696,12 +696,15 @@ sort_combine_two_DT_columns = function(DT,
check_github_suite_ver = function() {
current_ver = utils::packageVersion('Giotto')
url = paste0('https://raw.githubusercontent.com/drieslab/Giotto/suite/DESCRIPTION')
x = readLines(url)
gh_ver = x[grep(pattern = 'Version:', x)]
gh_ver = gsub(pattern = 'Version: ', replacement = '', gh_ver)
ver_compare = utils::compareVersion(gh_ver, as.character(current_ver))

if(ver_compare == 1) wrap_msg('Newer devel version of Giotto on GitHub:', gh_ver)
# suppress warnings and errors if inaccessible
x = suppressWarnings(try(readLines(url), silent = TRUE))
if(!inherits(x, 'try-error')) {
gh_ver = x[grep(pattern = 'Version:', x)]
gh_ver = gsub(pattern = 'Version: ', replacement = '', gh_ver)
ver_compare = utils::compareVersion(gh_ver, as.character(current_ver))

if(ver_compare == 1) wrap_msg('Newer devel version of Giotto on GitHub:', gh_ver)
}
}


Expand Down
22 changes: 22 additions & 0 deletions man/updateGiottoObject.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 069eded

Please sign in to comment.