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

Murphy, Alan E @@murphy @end|ng |rom |mper|@|@@c@uk
Tue Mar 2 21:07:39 CET 2021


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