[Bioc-devel] ExperimentHub package development - Windows OS specific error

Murphy, Alan E @@murphy @end|ng |rom |mper|@|@@c@uk
Wed Mar 3 12:52:03 CET 2021


Hey Gavin,

You're right that built correctly! Strange I got the error yesterday considering I ran

devtools::check_win_devel()

Perhaps ExperimentHub doesn't update the snapshot automatically for this. Not to worry though, I think that is a headache for another day.

Thanks again,
Alan.
________________________________
From: Gavin Lloyd <G.R.Lloyd using bham.ac.uk>
Sent: 03 March 2021 09:35
To: Murphy, Alan E <a.murphy using imperial.ac.uk>; bioc-devel using r-project.org <bioc-devel using r-project.org>
Subject: Re: ExperimentHub package development - Windows OS specific error


I did not get this error on my Windows machine; ExperimentHub can find the alzzh_gwas_top100 dataset in Bioc 3.13 (devel).


Your snapshot date is older than mine. R reported my snapshot date as "2021-03-02"


Maybe you need to clear the cache?


You can request all available snapshot dates with possibleDates and set a specific one if you want to with snapshotDate. See ?ExperimentHub for info.


I am not sure what best practice would be in terms of Bioc 3.13 (should you fix a snapshot date in your package, or always use the most recent date, or allow the user to specify a snapshot date...?). You could ask your reviewer for advice in this regard, or maybe someone on the mailing list will comment.


Gavin




________________________________
From: Murphy, Alan E <a.murphy using imperial.ac.uk>
Sent: 02 March 2021 20:07
To: Gavin Lloyd (College of Medical and Dental Sciences); bioc-devel using r-project.org
Subject: Re: ExperimentHub package development - Windows OS specific error

Hey Gavin,

This worked perfectly, thanks!

However, this did lead to another error where one of the datasets from the metadata file wasn't found in the ExperimentHub dataset. Again this is Windows specific and the dataset in question (alzh_gwas_top100) does exist:


> ### ** Examples
>
>   alzh_gwas_top100()
using temporary cache D:\temp\RtmpCEujsj/working_dir\RtmpY9HMAa/BiocFileCache
snapshotDate(): 2020-04-27
Error in alzh_gwas_top100() :
  resource alzh_gwas_top100 not found in ExperimentHub

This error is thrown in zzz.R here:

objs <- read.csv(system.file("extdata", "metadata.csv",
                               package="ewceData"),
                   stringsAsFactors=FALSE,fileEncoding = "UTF-8-BOM")$Title
  if (!length(objs))
    stop("no objects found")

  ## Functions to load objects by name:
  ns <- asNamespace(pkgname)
  sapply(objs,
         function(xx) {
           func = function(metadata = FALSE) {
             if (!isNamespaceLoaded("ExperimentHub"))
               attachNamespace("ExperimentHub")
             eh <- query(ExperimentHub(), "ewceData")
             ehid <- names(query(eh, xx))
             if (!length(ehid))
               stop(paste0("resource ", xx,
                           " not found in ExperimentHub"))
             if (metadata)
               eh[ehid]
             else eh[[ehid]]
           }
           assign(xx, func, envir=ns)
           namespaceExport(ns, xx)
         })

I checked and objs does contain the correct list of titles so the issue isn't there. Sorry about the continuation in the question but does anyone know why this could be happening?

Kind regards,
Alan.

________________________________
From: Gavin Lloyd <G.R.Lloyd using bham.ac.uk>
Sent: 02 March 2021 18:10
To: Murphy, Alan E <a.murphy using imperial.ac.uk>; bioc-devel using r-project.org <bioc-devel using r-project.org>
Subject: Re: ExperimentHub package development - Windows OS specific error


This email from G.R.Lloyd using bham.ac.uk originates from outside Imperial. Do not click on links and attachments unless you recognise the sender. If you trust the sender, add them to your safe senders list<https://spam.ic.ac.uk/SpamConsole/Senders.aspx> to disable email stamping for this address.



Your file seems to be encoded as UTF-8-BOM.


When I read it in on my Windows 10 machine the Title column has extra characters at the front ("�..Title"), which is why your function returns "no object found" when checking for the Title column.


If I resave your file with UTF-8 format your function works as expected and I am able to install your package.


Gavin


________________________________
From: Bioc-devel <bioc-devel-bounces using r-project.org> on behalf of Murphy, Alan E <a.murphy using imperial.ac.uk>
Sent: 02 March 2021 17:00
To: bioc-devel using r-project.org
Subject: [Bioc-devel] ExperimentHub package development - Windows OS specific error

Hi all,

My apologies, I have emailed before on a related issue but now think I have found a potential cause of the issue I am having but can't seem to find a fix.

I am working on an ExperimentHub data package; ewceData<https://github.com/neurogenomics/ewceData>, which fails checks on Windows OS but passes on Linux and Mac. On Windows, the package fails to install with the following output:


Error: package or namespace load failed for 'ewceData':
 .onLoad failed in loadNamespace() for 'ewceData', details:
  call: fun(libname, pkgname)
  error: no objects found
Error: loading failed
Execution halted

It seems like this error is caused by my onload function. The onload function I use (zzz.R) should allow easy access to the stored datasets, allowing a user to call the dataset like dataset1(). The error note printed appears because the metadata.csv file did not read properly

.onLoad <- function(libname, pkgname) {
  objs <- read.csv(system.file("extdata", "metadata.csv",
                               package="ewceData"),
                   stringsAsFactors=FALSE)$Title
  if (!length(objs))
    stop("no objects found")

It would seem the issue is with either read.csv or system.file and is specific to Windows OS. Just to note I also do import read.csv from utils.

If anyone has come across an issue like this before or have good guesses for a possible fix it would be greatly appreciated?

Kind regards,
Alan,

Alan Murphy
Bioinformatician
Neurogenomics lab
UK Dementia Research Institute
Imperial College London

        [[alternative HTML version deleted]]

_______________________________________________
Bioc-devel using r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

	[[alternative HTML version deleted]]



More information about the Bioc-devel mailing list