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

Import packages in DESCRIPTION #2

Closed
boyiguo1 opened this issue Jan 14, 2024 · 4 comments
Closed

Import packages in DESCRIPTION #2

boyiguo1 opened this issue Jan 14, 2024 · 4 comments

Comments

@boyiguo1
Copy link
Collaborator

There are functions imported from extenernal packages, such as MASS and dbscan. While the functions are correctly imported to the namesspace, it is also mandatory to imports these packages in the DESCRIPTION file to set up correct dependency during installation. Otherwise, it will lead to errors during devtools::check(document = FALSE). See the message below.

E  checking package dependencies (2s)
   Namespace dependencies missing from DESCRIPTION Imports/Depends entries:
     'BiocParallel', 'MASS', 'dbscan', 'spatialLIBD'

To fix it, you can simply adding these packages to the the Imports field in the DESCRIPTION file. See more detail via https://r-pkgs.org/description.html#sec-description-imports-suggests. I think for now, you can simply Imports instead of Depends.

@MicTott MicTott closed this as completed Jan 16, 2024
@MicTott MicTott reopened this Jan 16, 2024
@MicTott
Copy link
Owner

MicTott commented Jan 16, 2024

Fixed. @boyiguo1, please try re-installing again and confirming that it works now. I'll close the issue once I get confirmation on your end.

@boyiguo1
Copy link
Collaborator Author

@MicTott The main problem for installation is an error when running examples. Within example, you'll have to load an spe object. e.g. library(STexampleData) spe <- Visium_xxx()

#' spe <- findArtifacts(spe,

@boyiguo1
Copy link
Collaborator Author

boyiguo1 commented Jan 17, 2024

I highly recommend you to address other warning messages show up when running devtools::check().

devtools::check() will point to you all the problem related to installation, and some warning for namespace specification/function importing.

Here is the partial output of devtools::check()

❯ checking examples ... ERROR
  Running examples in ‘SpotSweeper-Ex.R’ failed
  The error most likely occurred in:
  
  > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
  > ### Name: findArtifacts
  > ### Title: findArtifacts Function
  > ### Aliases: findArtifacts
  > 
  > ### ** Examples
  > 
  > spe <- findArtifacts(spe,
  +                      mito_ratio="expr_chrM_ratio",
  +                      mito_expr="expr_chrM",
  +                      name="artifact"
  +                    )
  Error in h(simpleError(msg, call)) : 
    error in evaluating the argument 'x' in selecting a method for function 'colData': object 'spe' not found
  Calls: findArtifacts -> colData -> .handleSimpleError -> h
  Execution halted

❯ checking Rd \usage sections ... WARNING
  Undocumented arguments in documentation object 'findArtifacts'
    ‘spe’ ‘mito_ratio’ ‘mito_expr’ ‘samples’ ‘n_rings’ ‘n_cores’ ‘log2’
    ‘name’ ‘var_output’
  
  Documented arguments not in \usage in documentation object 'localOutliers':
    ‘threshold’
  
  Undocumented arguments in documentation object 'localVariance'
    ‘n_neighbors’
  Documented arguments not in \usage in documentation object 'localVariance':
    ‘n_neighbor’
  
  Functions with \usage entries need to have the appropriate \alias
  entries, and all their arguments documented.
  The \usage entries must correspond to syntactically valid R code.
  See chapter ‘Writing R documentation files’ in the ‘Writing R
  Extensions’ manual.

❯ checking for unstated dependencies in examples ... WARNING
  'library' or 'require' call not declared from: ‘spatialLIBD’

❯ checking for unstated dependencies in ‘tests’ ... WARNING
  'library' or 'require' call not declared from: ‘testthat’

❯ checking dependencies in R code ... NOTE
  Namespace in Imports field not imported from: ‘SpatialExperiment’
    All declared Imports should be used.

❯ checking R code for possible problems ... [12s/12s] NOTE
  findArtifacts: no visible global function definition for ‘colData<-’
  findArtifacts: no visible global function definition for ‘resid’
  findArtifacts: no visible global function definition for ‘prcomp’
  findArtifacts: no visible global function definition for ‘reducedDim<-’
  findArtifacts: no visible global function definition for ‘kmeans’
  localOutliers: no visible global function definition for ‘colData<-’
  localOutliers: no visible global function definition for
    ‘spatialCoords’
  localVariance: no visible global function definition for ‘colData<-’
  localVariance: no visible global function definition for
    ‘spatialCoords’
  localVariance: no visible global function definition for ‘var’
  Undefined global functions or variables:
    colData<- kmeans prcomp reducedDim<- resid spatialCoords var
  Consider adding
    importFrom("stats", "kmeans", "prcomp", "resid", "var")
  to your NAMESPACE file.

1 error ✖ | 3 warnings ✖ | 2 notes ✖
Error: R CMD check found ERRORs
Execution halted

Exited with status 1.

You'll have to address both errors and warnings minimally.

@MicTott
Copy link
Owner

MicTott commented Feb 19, 2024

Done

@MicTott MicTott closed this as completed Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants