sbg / sevenbridges-r

Seven Bridges API Client, CWL Schema, Meta Schema, and SDK Helper in R
https://sbg.github.io/sevenbridges-r/
Apache License 2.0
35 stars 14 forks source link

Conflict with the BaseSpaceR package #82

Open francestong opened 3 years ago

francestong commented 3 years ago

There's a conflict if both BaseSpaceR and sevenbridges packages are loaded at the same time (doesn't matter the order), and I haven't been able to figure out which functions are causing the issue or use a workaround. This issue keeps crashing my Shiny app that automates the transfer of files from BaseSpace to SevenBridges.

If BaseSpaceR is not loaded, then sevenbridges works fine:

> library(sevenbridges)
> a <- sevenbridges::Auth(
+     token = [mytoken],
+     platform = "aws-us"
+ )
Using platform: aws-us
> a$project()
[[1]]
== Project ==
id : frances/frances-s-demo-project
name : frances's Demo Project
[[2]]
== Project ==
id : internal/fastqs
name : FASTQs

If BaseSpaceR is loaded as well, then sevenbridges is unable to find its own methods:

> library(BaseSpaceR)
BaseSpaceR version 1.37.0, ?BaseSpaceR for help

Attaching package: ‘BaseSpaceR’

The following object is masked from ‘package:sevenbridges’:

    Files
> library(sevenbridges)
> a <- sevenbridges::Auth(
+     token = [mytoken],
+     platform = "aws-us"
+ )
Using platform: aws-us
> a$project()
Error in .Object$initialize(...) : attempt to apply non-function

Unloading BaseSpaceR and its namespace will allow the sevenbridges methods to work again. Note that unload needs to be set to TRUE.

detach("package:BaseSpaceR", unload = TRUE)

Also, using the conflicted package when loading both packages returns no conflicts between each other.

Here are the versions that I'm using:

> packageVersion("BaseSpaceR")
[1] ‘1.37.0’
> packageVersion("sevenbridges")
[1] ‘1.23.0’
> R.version
               _                           
platform       x86_64-apple-darwin17.0     
arch           x86_64                      
os             darwin17.0                  
system         x86_64, darwin17.0          
status                                     
major          4                           
minor          1.1                         
year           2021                        
month          08                          
day            10                          
svn rev        80725                       
language       R                           
version.string R version 4.1.1 (2021-08-10)
nickname       Kick Things