On 05/01/2017 01:37, Martin Morgan wrote:
On 12/29/2016 12:25 PM, Vincent Carey wrote:
A while ago Martin and I discussed the possibility of idempotence for
TabixFile ... this seemed
to make sense and so

TabixFile

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


TabixFileList

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.cast...@upf.edu>
wrote:

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:

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)

The original behavior has been restored; both TabixFile() and TabixFileList() are idempotent. Sorry for introducing the bug.

Martin

great! thanks Martin!!

robert.



Lori Shepherd

Bioconductor Core Team

Roswell Park Cancer Institute

Department of Biostatistics & Bioinformatics

Elm & Carlton Streets

Buffalo, New York 14263

------------------------------------------------------------------------
*From:* Bioc-devel <bioc-devel-boun...@r-project.org> on behalf of
Robert Castelo <robert.cast...@upf.edu>
*Sent:* Wednesday, December 28, 2016 11:50:58 AM
*To:* bioc-devel@r-project.org
*Subject:* [Bioc-devel] TabixFileList() constructor broken in devel
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

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

This email message may contain legally privileged and/or confidential
information. If you are not the intended recipient(s), or the employee
or agent responsible for the delivery of this message to the intended
recipient(s), you are hereby notified that any disclosure, copying,
distribution, or use of this email message is prohibited. If you have
received this message in error, please notify the sender immediately
by e-mail and delete this email message from your computer. Thank you.



        [[alternative HTML version deleted]]


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


    [[alternative HTML version deleted]]

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



This email message may contain legally privileged and/or confidential information. If you are not the intended recipient(s), or the employee or agent responsible for the delivery of this message to the intended recipient(s), you are hereby notified that any disclosure, copying, distribution, or use of this email message is prohibited. If you have received this message in error, please notify the sender immediately by e-mail and delete this email message from your computer. Thank you.

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

Reply via email to