Skip to content

[Bioc-devel] TabixFileList() constructor broken in devel

4 messages · Robert Castelo, Shepherd, Lori, Vincent Carey

#
hi,

the 'TabixFileList()' constructor in Rsamtools seems to be broken in devel:

library(Rsamtools)
example(TabixFileList) ## which actually does not construct any 
'TabixFileList'
TabixFileList(tbx)
Error in as.vector(x, "character") :
   cannot coerce type 'environment' to vector of type 'character'

while in release this works fine:

library(Rsamtools)
example(TabixFileList) ## which actually does not construct any 
'TabixFileList'
TabixFileList(tbx)
TabixFileList of length 1
names(1): example.gtf.gz

the man page has not changed between devel and release and the current 
description of the argument 'file' supports the use of a 'TabixFile' 
instance as input:

     file: For TabixFile(), A character(1) vector to the tabix file
           path; can be remote (http://, ftp://). For ?countTabix?, a
           character(1) or ?TabixFile? instance. For others, a
           ?TabixFile? instance.

please find below my session information for the devel run.

thanks!

robert.

sessionInfo()
R Under development (unstable) (2016-11-17 r71661)
Platform: x86_64-apple-darwin16.1.0 (64-bit)
Running under: macOS Sierra 10.12.2

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats4    parallel  stats     graphics  grDevices utils     datasets
[8] methods   base

other attached packages:
  [1] Rsamtools_1.27.9      Biostrings_2.43.1 XVector_0.15.0
  [4] GenomicRanges_1.27.17 GenomeInfoDb_1.11.6 IRanges_2.9.14
  [7] S4Vectors_0.13.5      BiocGenerics_0.21.1 setwidth_1.0-4
[10] colorout_1.1-0

loaded via a namespace (and not attached):
[1] zlibbioc_1.21.0    compiler_3.4.0 tools_3.4.0        BiocParallel_1.9.3
[5] bitops_1.0-6
#
Thank you for bringing this to our attention. There were some updates made a few weeks ago to the behavior and input of 'TabixFileList()' .  Its current implementation will work with a character vector as input.  I will investigate further into why this change was made and if it needs to be addressed.


In the meantime:

TabixFileList(tbx)
will throw an ERROR, but you can still use the same file that was used to create the TabixFile
tbx <- open(TabixFile(fl, yieldSize=100))
TabixFileList(fl)




Lori Shepherd

Bioconductor Core Team

Roswell Park Cancer Institute

Department of Biostatistics & Bioinformatics

Elm & Carlton Streets

Buffalo, New York 14263
#
hi Lori,

thanks for the clarification. if this is an intended change then i'd say 
the documentation needs to be updated since, as i showed in my email 
below, it currently says that for functions such as 'TabixFileList()' 
the input 'file' argument should be a 'TabixFile' instance and not a 
character vector.

this change also means the input is switching from a 'TabixFile' 
instance to a 'character' vector, so pipelines or packages doing calls 
to 'TabixFileList()' that have been passing 'TabixFile' instances as 
arguments will have to update those calls to pass a character vector.

  i'd suggest that if there's no good reason to switch, it would be 
safer to add the character vector as an additional possibility in the 
input argument 'file', just as with 'countTabix()', and minimize 
possible breaks of pipelines/packages using 'TabixFileList()'. i've 
encountered this problem because my own package VariantFiltering calls 
'TabixFileList()' although is not a big deal to fix it.

cheers,

robert.
On 28/12/2016 19:44, Shepherd, Lori wrote:

  
  
#
A while ago Martin and I discussed the possibility of idempotence for
TabixFile ... this seemed
to make sense and so
function (file, index = paste(file, "tbi", sep = "."), ..., yieldSize =
NA_integer_)

{

    if (is(file, "TabixFile"))

        return(file)

    tryCatch({

        .io_check_exists(c(file, index))

    }, error = function(err) {

        stop(sprintf("TabixFile: %s", conditionMessage(err)),

            call. = FALSE)

    })

    .RsamtoolsFile(.TabixFile, file, index, yieldSize = yieldSize,

        ...)

}

<environment: namespace:Rsamtools>


TabixFileList could behave similarly, working either from character paths,
or from

a list of TabixFile instances, or from a TabixFileList ... might be a
design practice to

promote for S4 programming
function (file, index = paste(file, "tbi", sep = "."), ..., yieldSize =
NA_integer_)

{

    index <- as.character(index)

    .RsamtoolsFileList(file, index, ..., yieldSize = yieldSize,

        class = "TabixFile")

}

<environment: namespace:Rsamtools>

On Thu, Dec 29, 2016 at 11:55 AM, Robert Castelo <robert.castelo at upf.edu>
wrote: