Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glitch importing narrowPeaks file (workaround requires rtracklayer) #2

Open
PeteHaitch opened this issue Apr 22, 2022 · 2 comments
Open

Comments

@PeteHaitch
Copy link
Contributor

Importing a narrowPeaks file only works if rtracklayer is also loaded (or only it is loaded).
I noticed this while reviewing Bioconductor/Contributions#2568

BiocIO-only

suppressPackageStartupMessages(library(BiocIO))
path <- "https://www.encodeproject.org/files/ENCFF044JNJ/@@download/ENCFF044JNJ.bed.gz"
import(path, format = "narrowPeak")
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'con' in selecting a method for function 'import': Format 'narrowPeak' unsupported
Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R Under development (unstable) (2021-10-27 r81107)
#>  os       macOS Big Sur/Monterey 10.16
#>  system   x86_64, darwin17.0
#>  ui       X11
#>  language (EN)
#>  collate  en_AU.UTF-8
#>  ctype    en_AU.UTF-8
#>  tz       Australia/Melbourne
#>  date     2022-04-23
#>  pandoc   2.16.2 @ /Applications/RStudio.app/Contents/MacOS/quarto/bin/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package      * version date (UTC) lib source
#>  BiocGenerics   0.41.2  2021-11-19 [1] Bioconductor
#>  BiocIO       * 1.5.0   2021-11-05 [1] Bioconductor
#>  cli            3.2.0   2022-02-14 [1] CRAN (R 4.2.0)
#>  crayon         1.5.1   2022-03-26 [1] CRAN (R 4.2.0)
#>  digest         0.6.29  2021-12-01 [1] CRAN (R 4.2.0)
#>  ellipsis       0.3.2   2021-04-29 [1] CRAN (R 4.2.0)
#>  evaluate       0.15    2022-02-18 [1] CRAN (R 4.2.0)
#>  fansi          1.0.3   2022-03-24 [1] CRAN (R 4.2.0)
#>  fastmap        1.1.0   2021-01-25 [1] CRAN (R 4.2.0)
#>  fs             1.5.2   2021-12-08 [1] CRAN (R 4.2.0)
#>  glue           1.6.2   2022-02-24 [1] CRAN (R 4.2.0)
#>  highr          0.9     2021-04-16 [1] CRAN (R 4.2.0)
#>  htmltools      0.5.2   2021-08-25 [1] CRAN (R 4.2.0)
#>  knitr          1.38    2022-03-25 [1] CRAN (R 4.2.0)
#>  lifecycle      1.0.1   2021-09-24 [1] CRAN (R 4.2.0)
#>  magrittr       2.0.3   2022-03-30 [1] CRAN (R 4.2.0)
#>  pillar         1.7.0   2022-02-01 [1] CRAN (R 4.2.0)
#>  pkgconfig      2.0.3   2019-09-22 [1] CRAN (R 4.2.0)
#>  purrr          0.3.4   2020-04-17 [1] CRAN (R 4.2.0)
#>  R.cache        0.15.0  2021-04-30 [1] CRAN (R 4.2.0)
#>  R.methodsS3    1.8.1   2020-08-26 [1] CRAN (R 4.2.0)
#>  R.oo           1.24.0  2020-08-26 [1] CRAN (R 4.2.0)
#>  R.utils        2.11.0  2021-09-26 [1] CRAN (R 4.2.0)
#>  reprex         2.0.1   2021-08-05 [1] CRAN (R 4.2.0)
#>  rlang          1.0.2   2022-03-04 [1] CRAN (R 4.2.0)
#>  rmarkdown      2.13    2022-03-10 [1] CRAN (R 4.2.0)
#>  rstudioapi     0.13    2020-11-12 [1] CRAN (R 4.2.0)
#>  S4Vectors      0.33.17 2022-04-06 [1] Bioconductor
#>  sessioninfo    1.2.2   2021-12-06 [1] CRAN (R 4.2.0)
#>  stringi        1.7.6   2021-11-29 [1] CRAN (R 4.2.0)
#>  stringr        1.4.0   2019-02-10 [1] CRAN (R 4.2.0)
#>  styler         1.7.0   2022-03-13 [1] CRAN (R 4.2.0)
#>  tibble         3.1.6   2021-11-07 [1] CRAN (R 4.2.0)
#>  utf8           1.2.2   2021-07-24 [1] CRAN (R 4.2.0)
#>  vctrs          0.4.1   2022-04-13 [1] CRAN (R 4.2.0)
#>  withr          2.5.0   2022-03-03 [1] CRAN (R 4.2.0)
#>  xfun           0.30    2022-03-02 [1] CRAN (R 4.2.0)
#>  yaml           2.3.5   2022-02-21 [1] CRAN (R 4.2.0)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.2/Resources/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

rtracklayer-only

suppressPackageStartupMessages(library(rtracklayer))
path <- "https://www.encodeproject.org/files/ENCFF044JNJ/@@download/ENCFF044JNJ.bed.gz"
import(path, format = "narrowPeak")
#> GRanges object with 51176 ranges and 6 metadata columns:
#>           seqnames              ranges strand |        name     score
#>              <Rle>           <IRanges>  <Rle> | <character> <numeric>
#>       [1]    chr10 100120820-100121527      * |  Peak_17683        36
#>       [2]    chr10 100204840-100205093      * |  Peak_55123        13
#>       [3]    chr10 100205451-100207334      * |   Peak_3178       155
#>       [4]    chr10 100218690-100219261      * |  Peak_17684        36
#>       [5]    chr10 100219390-100220406      * |  Peak_19403        32
#>       ...      ...                 ...    ... .         ...       ...
#>   [51172]     chrX       950933-951431      * |  Peak_14012        47
#>   [51173]     chrX       951487-952037      * |  Peak_19964        32
#>   [51174]     chrX   97828833-97829748      * |  Peak_19510        32
#>   [51175]     chrX   99998086-99998334      * |  Peak_33145        19
#>   [51176]     chrY     9989029-9989319      * |  Peak_52125        14
#>           signalValue    pValue    qValue      peak
#>             <numeric> <numeric> <numeric> <integer>
#>       [1]    12.59446  26.34571  23.81650       297
#>       [2]     4.30475   5.46569   3.43493       152
#>       [3]    44.75533 133.83092 130.23181      1493
#>       [4]    12.59446  26.34571  23.81650       377
#>       [5]     9.84834  22.82066  20.34716       199
#>       ...         ...       ...       ...       ...
#>   [51172]    16.68090   36.3314  33.65495       156
#>   [51173]    11.44904   22.2138  19.75487       317
#>   [51174]     9.84834   22.8207  20.34716       164
#>   [51175]     6.76534   10.6263   8.41839       164
#>   [51176]     4.49197    5.9362   3.88656       158
#>   -------
#>   seqinfo: 24 sequences from an unspecified genome; no seqlengths
Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R Under development (unstable) (2021-10-27 r81107)
#>  os       macOS Big Sur/Monterey 10.16
#>  system   x86_64, darwin17.0
#>  ui       X11
#>  language (EN)
#>  collate  en_AU.UTF-8
#>  ctype    en_AU.UTF-8
#>  tz       Australia/Melbourne
#>  date     2022-04-23
#>  pandoc   2.16.2 @ /Applications/RStudio.app/Contents/MacOS/quarto/bin/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package              * version  date (UTC) lib source
#>  Biobase                2.55.2   2022-04-07 [1] Bioconductor
#>  BiocGenerics         * 0.41.2   2021-11-19 [1] Bioconductor
#>  BiocIO                 1.5.0    2021-11-05 [1] Bioconductor
#>  BiocParallel           1.29.21  2022-04-19 [1] Bioconductor
#>  Biostrings             2.63.3   2022-03-29 [1] Bioconductor
#>  bitops                 1.0-7    2021-04-24 [1] CRAN (R 4.2.0)
#>  cli                    3.2.0    2022-02-14 [1] CRAN (R 4.2.0)
#>  crayon                 1.5.1    2022-03-26 [1] CRAN (R 4.2.0)
#>  DelayedArray           0.21.2   2021-11-19 [1] Bioconductor
#>  digest                 0.6.29   2021-12-01 [1] CRAN (R 4.2.0)
#>  ellipsis               0.3.2    2021-04-29 [1] CRAN (R 4.2.0)
#>  evaluate               0.15     2022-02-18 [1] CRAN (R 4.2.0)
#>  fansi                  1.0.3    2022-03-24 [1] CRAN (R 4.2.0)
#>  fastmap                1.1.0    2021-01-25 [1] CRAN (R 4.2.0)
#>  fs                     1.5.2    2021-12-08 [1] CRAN (R 4.2.0)
#>  GenomeInfoDb         * 1.31.10  2022-04-21 [1] Bioconductor
#>  GenomeInfoDbData       1.2.8    2022-04-13 [1] Bioconductor
#>  GenomicAlignments      1.31.2   2021-11-19 [1] Bioconductor
#>  GenomicRanges        * 1.47.6   2022-01-12 [1] Bioconductor
#>  glue                   1.6.2    2022-02-24 [1] CRAN (R 4.2.0)
#>  highr                  0.9      2021-04-16 [1] CRAN (R 4.2.0)
#>  htmltools              0.5.2    2021-08-25 [1] CRAN (R 4.2.0)
#>  IRanges              * 2.29.1   2021-11-19 [1] Bioconductor
#>  knitr                  1.38     2022-03-25 [1] CRAN (R 4.2.0)
#>  lattice                0.20-45  2021-09-22 [1] CRAN (R 4.2.0)
#>  lifecycle              1.0.1    2021-09-24 [1] CRAN (R 4.2.0)
#>  magrittr               2.0.3    2022-03-30 [1] CRAN (R 4.2.0)
#>  Matrix                 1.4-1    2022-03-23 [1] CRAN (R 4.2.0)
#>  MatrixGenerics         1.7.0    2021-10-26 [1] Bioconductor
#>  matrixStats            0.62.0   2022-04-19 [1] CRAN (R 4.2.0)
#>  pillar                 1.7.0    2022-02-01 [1] CRAN (R 4.2.0)
#>  pkgconfig              2.0.3    2019-09-22 [1] CRAN (R 4.2.0)
#>  purrr                  0.3.4    2020-04-17 [1] CRAN (R 4.2.0)
#>  R.cache                0.15.0   2021-04-30 [1] CRAN (R 4.2.0)
#>  R.methodsS3            1.8.1    2020-08-26 [1] CRAN (R 4.2.0)
#>  R.oo                   1.24.0   2020-08-26 [1] CRAN (R 4.2.0)
#>  R.utils                2.11.0   2021-09-26 [1] CRAN (R 4.2.0)
#>  RCurl                  1.98-1.6 2022-02-08 [1] CRAN (R 4.2.0)
#>  reprex                 2.0.1    2021-08-05 [1] CRAN (R 4.2.0)
#>  restfulr               0.0.13   2017-08-06 [1] CRAN (R 4.2.0)
#>  rjson                  0.2.21   2022-01-09 [1] CRAN (R 4.2.0)
#>  rlang                  1.0.2    2022-03-04 [1] CRAN (R 4.2.0)
#>  rmarkdown              2.13     2022-03-10 [1] CRAN (R 4.2.0)
#>  Rsamtools              2.11.0   2021-11-19 [1] Bioconductor
#>  rstudioapi             0.13     2020-11-12 [1] CRAN (R 4.2.0)
#>  rtracklayer          * 1.55.4   2022-03-23 [1] Bioconductor
#>  S4Vectors            * 0.33.17  2022-04-06 [1] Bioconductor
#>  sessioninfo            1.2.2    2021-12-06 [1] CRAN (R 4.2.0)
#>  stringi                1.7.6    2021-11-29 [1] CRAN (R 4.2.0)
#>  stringr                1.4.0    2019-02-10 [1] CRAN (R 4.2.0)
#>  styler                 1.7.0    2022-03-13 [1] CRAN (R 4.2.0)
#>  SummarizedExperiment   1.25.3   2021-12-08 [1] Bioconductor
#>  tibble                 3.1.6    2021-11-07 [1] CRAN (R 4.2.0)
#>  utf8                   1.2.2    2021-07-24 [1] CRAN (R 4.2.0)
#>  vctrs                  0.4.1    2022-04-13 [1] CRAN (R 4.2.0)
#>  withr                  2.5.0    2022-03-03 [1] CRAN (R 4.2.0)
#>  xfun                   0.30     2022-03-02 [1] CRAN (R 4.2.0)
#>  XML                    3.99-0.9 2022-02-24 [1] CRAN (R 4.2.0)
#>  XVector                0.35.0   2021-10-26 [1] Bioconductor
#>  yaml                   2.3.5    2022-02-21 [1] CRAN (R 4.2.0)
#>  zlibbioc               1.41.0   2021-10-26 [1] Bioconductor
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.2/Resources/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

Both, loading BiocIO first

suppressPackageStartupMessages(library(BiocIO))
suppressPackageStartupMessages(library(rtracklayer))
path <- "https://www.encodeproject.org/files/ENCFF044JNJ/@@download/ENCFF044JNJ.bed.gz"
import(path, format = "narrowPeak")
#> GRanges object with 51176 ranges and 6 metadata columns:
#>           seqnames              ranges strand |        name     score
#>              <Rle>           <IRanges>  <Rle> | <character> <numeric>
#>       [1]    chr10 100120820-100121527      * |  Peak_17683        36
#>       [2]    chr10 100204840-100205093      * |  Peak_55123        13
#>       [3]    chr10 100205451-100207334      * |   Peak_3178       155
#>       [4]    chr10 100218690-100219261      * |  Peak_17684        36
#>       [5]    chr10 100219390-100220406      * |  Peak_19403        32
#>       ...      ...                 ...    ... .         ...       ...
#>   [51172]     chrX       950933-951431      * |  Peak_14012        47
#>   [51173]     chrX       951487-952037      * |  Peak_19964        32
#>   [51174]     chrX   97828833-97829748      * |  Peak_19510        32
#>   [51175]     chrX   99998086-99998334      * |  Peak_33145        19
#>   [51176]     chrY     9989029-9989319      * |  Peak_52125        14
#>           signalValue    pValue    qValue      peak
#>             <numeric> <numeric> <numeric> <integer>
#>       [1]    12.59446  26.34571  23.81650       297
#>       [2]     4.30475   5.46569   3.43493       152
#>       [3]    44.75533 133.83092 130.23181      1493
#>       [4]    12.59446  26.34571  23.81650       377
#>       [5]     9.84834  22.82066  20.34716       199
#>       ...         ...       ...       ...       ...
#>   [51172]    16.68090   36.3314  33.65495       156
#>   [51173]    11.44904   22.2138  19.75487       317
#>   [51174]     9.84834   22.8207  20.34716       164
#>   [51175]     6.76534   10.6263   8.41839       164
#>   [51176]     4.49197    5.9362   3.88656       158
#>   -------
#>   seqinfo: 24 sequences from an unspecified genome; no seqlengths
Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R Under development (unstable) (2021-10-27 r81107)
#>  os       macOS Big Sur/Monterey 10.16
#>  system   x86_64, darwin17.0
#>  ui       X11
#>  language (EN)
#>  collate  en_AU.UTF-8
#>  ctype    en_AU.UTF-8
#>  tz       Australia/Melbourne
#>  date     2022-04-23
#>  pandoc   2.16.2 @ /Applications/RStudio.app/Contents/MacOS/quarto/bin/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package              * version  date (UTC) lib source
#>  Biobase                2.55.2   2022-04-07 [1] Bioconductor
#>  BiocGenerics         * 0.41.2   2021-11-19 [1] Bioconductor
#>  BiocIO               * 1.5.0    2021-11-05 [1] Bioconductor
#>  BiocParallel           1.29.21  2022-04-19 [1] Bioconductor
#>  Biostrings             2.63.3   2022-03-29 [1] Bioconductor
#>  bitops                 1.0-7    2021-04-24 [1] CRAN (R 4.2.0)
#>  cli                    3.2.0    2022-02-14 [1] CRAN (R 4.2.0)
#>  crayon                 1.5.1    2022-03-26 [1] CRAN (R 4.2.0)
#>  DelayedArray           0.21.2   2021-11-19 [1] Bioconductor
#>  digest                 0.6.29   2021-12-01 [1] CRAN (R 4.2.0)
#>  ellipsis               0.3.2    2021-04-29 [1] CRAN (R 4.2.0)
#>  evaluate               0.15     2022-02-18 [1] CRAN (R 4.2.0)
#>  fansi                  1.0.3    2022-03-24 [1] CRAN (R 4.2.0)
#>  fastmap                1.1.0    2021-01-25 [1] CRAN (R 4.2.0)
#>  fs                     1.5.2    2021-12-08 [1] CRAN (R 4.2.0)
#>  GenomeInfoDb         * 1.31.10  2022-04-21 [1] Bioconductor
#>  GenomeInfoDbData       1.2.8    2022-04-13 [1] Bioconductor
#>  GenomicAlignments      1.31.2   2021-11-19 [1] Bioconductor
#>  GenomicRanges        * 1.47.6   2022-01-12 [1] Bioconductor
#>  glue                   1.6.2    2022-02-24 [1] CRAN (R 4.2.0)
#>  highr                  0.9      2021-04-16 [1] CRAN (R 4.2.0)
#>  htmltools              0.5.2    2021-08-25 [1] CRAN (R 4.2.0)
#>  IRanges              * 2.29.1   2021-11-19 [1] Bioconductor
#>  knitr                  1.38     2022-03-25 [1] CRAN (R 4.2.0)
#>  lattice                0.20-45  2021-09-22 [1] CRAN (R 4.2.0)
#>  lifecycle              1.0.1    2021-09-24 [1] CRAN (R 4.2.0)
#>  magrittr               2.0.3    2022-03-30 [1] CRAN (R 4.2.0)
#>  Matrix                 1.4-1    2022-03-23 [1] CRAN (R 4.2.0)
#>  MatrixGenerics         1.7.0    2021-10-26 [1] Bioconductor
#>  matrixStats            0.62.0   2022-04-19 [1] CRAN (R 4.2.0)
#>  pillar                 1.7.0    2022-02-01 [1] CRAN (R 4.2.0)
#>  pkgconfig              2.0.3    2019-09-22 [1] CRAN (R 4.2.0)
#>  purrr                  0.3.4    2020-04-17 [1] CRAN (R 4.2.0)
#>  R.cache                0.15.0   2021-04-30 [1] CRAN (R 4.2.0)
#>  R.methodsS3            1.8.1    2020-08-26 [1] CRAN (R 4.2.0)
#>  R.oo                   1.24.0   2020-08-26 [1] CRAN (R 4.2.0)
#>  R.utils                2.11.0   2021-09-26 [1] CRAN (R 4.2.0)
#>  RCurl                  1.98-1.6 2022-02-08 [1] CRAN (R 4.2.0)
#>  reprex                 2.0.1    2021-08-05 [1] CRAN (R 4.2.0)
#>  restfulr               0.0.13   2017-08-06 [1] CRAN (R 4.2.0)
#>  rjson                  0.2.21   2022-01-09 [1] CRAN (R 4.2.0)
#>  rlang                  1.0.2    2022-03-04 [1] CRAN (R 4.2.0)
#>  rmarkdown              2.13     2022-03-10 [1] CRAN (R 4.2.0)
#>  Rsamtools              2.11.0   2021-11-19 [1] Bioconductor
#>  rstudioapi             0.13     2020-11-12 [1] CRAN (R 4.2.0)
#>  rtracklayer          * 1.55.4   2022-03-23 [1] Bioconductor
#>  S4Vectors            * 0.33.17  2022-04-06 [1] Bioconductor
#>  sessioninfo            1.2.2    2021-12-06 [1] CRAN (R 4.2.0)
#>  stringi                1.7.6    2021-11-29 [1] CRAN (R 4.2.0)
#>  stringr                1.4.0    2019-02-10 [1] CRAN (R 4.2.0)
#>  styler                 1.7.0    2022-03-13 [1] CRAN (R 4.2.0)
#>  SummarizedExperiment   1.25.3   2021-12-08 [1] Bioconductor
#>  tibble                 3.1.6    2021-11-07 [1] CRAN (R 4.2.0)
#>  utf8                   1.2.2    2021-07-24 [1] CRAN (R 4.2.0)
#>  vctrs                  0.4.1    2022-04-13 [1] CRAN (R 4.2.0)
#>  withr                  2.5.0    2022-03-03 [1] CRAN (R 4.2.0)
#>  xfun                   0.30     2022-03-02 [1] CRAN (R 4.2.0)
#>  XML                    3.99-0.9 2022-02-24 [1] CRAN (R 4.2.0)
#>  XVector                0.35.0   2021-10-26 [1] Bioconductor
#>  yaml                   2.3.5    2022-02-21 [1] CRAN (R 4.2.0)
#>  zlibbioc               1.41.0   2021-10-26 [1] Bioconductor
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.2/Resources/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

Both, loading rtracklayer first

suppressPackageStartupMessages(library(rtracklayer))
suppressPackageStartupMessages(library(BiocIO))
path <- "https://www.encodeproject.org/files/ENCFF044JNJ/@@download/ENCFF044JNJ.bed.gz"
import(path, format = "narrowPeak")
#> GRanges object with 51176 ranges and 6 metadata columns:
#>           seqnames              ranges strand |        name     score
#>              <Rle>           <IRanges>  <Rle> | <character> <numeric>
#>       [1]    chr10 100120820-100121527      * |  Peak_17683        36
#>       [2]    chr10 100204840-100205093      * |  Peak_55123        13
#>       [3]    chr10 100205451-100207334      * |   Peak_3178       155
#>       [4]    chr10 100218690-100219261      * |  Peak_17684        36
#>       [5]    chr10 100219390-100220406      * |  Peak_19403        32
#>       ...      ...                 ...    ... .         ...       ...
#>   [51172]     chrX       950933-951431      * |  Peak_14012        47
#>   [51173]     chrX       951487-952037      * |  Peak_19964        32
#>   [51174]     chrX   97828833-97829748      * |  Peak_19510        32
#>   [51175]     chrX   99998086-99998334      * |  Peak_33145        19
#>   [51176]     chrY     9989029-9989319      * |  Peak_52125        14
#>           signalValue    pValue    qValue      peak
#>             <numeric> <numeric> <numeric> <integer>
#>       [1]    12.59446  26.34571  23.81650       297
#>       [2]     4.30475   5.46569   3.43493       152
#>       [3]    44.75533 133.83092 130.23181      1493
#>       [4]    12.59446  26.34571  23.81650       377
#>       [5]     9.84834  22.82066  20.34716       199
#>       ...         ...       ...       ...       ...
#>   [51172]    16.68090   36.3314  33.65495       156
#>   [51173]    11.44904   22.2138  19.75487       317
#>   [51174]     9.84834   22.8207  20.34716       164
#>   [51175]     6.76534   10.6263   8.41839       164
#>   [51176]     4.49197    5.9362   3.88656       158
#>   -------
#>   seqinfo: 24 sequences from an unspecified genome; no seqlengths
Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R Under development (unstable) (2021-10-27 r81107)
#>  os       macOS Big Sur/Monterey 10.16
#>  system   x86_64, darwin17.0
#>  ui       X11
#>  language (EN)
#>  collate  en_AU.UTF-8
#>  ctype    en_AU.UTF-8
#>  tz       Australia/Melbourne
#>  date     2022-04-23
#>  pandoc   2.16.2 @ /Applications/RStudio.app/Contents/MacOS/quarto/bin/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package              * version  date (UTC) lib source
#>  Biobase                2.55.2   2022-04-07 [1] Bioconductor
#>  BiocGenerics         * 0.41.2   2021-11-19 [1] Bioconductor
#>  BiocIO               * 1.5.0    2021-11-05 [1] Bioconductor
#>  BiocParallel           1.29.21  2022-04-19 [1] Bioconductor
#>  Biostrings             2.63.3   2022-03-29 [1] Bioconductor
#>  bitops                 1.0-7    2021-04-24 [1] CRAN (R 4.2.0)
#>  cli                    3.2.0    2022-02-14 [1] CRAN (R 4.2.0)
#>  crayon                 1.5.1    2022-03-26 [1] CRAN (R 4.2.0)
#>  DelayedArray           0.21.2   2021-11-19 [1] Bioconductor
#>  digest                 0.6.29   2021-12-01 [1] CRAN (R 4.2.0)
#>  ellipsis               0.3.2    2021-04-29 [1] CRAN (R 4.2.0)
#>  evaluate               0.15     2022-02-18 [1] CRAN (R 4.2.0)
#>  fansi                  1.0.3    2022-03-24 [1] CRAN (R 4.2.0)
#>  fastmap                1.1.0    2021-01-25 [1] CRAN (R 4.2.0)
#>  fs                     1.5.2    2021-12-08 [1] CRAN (R 4.2.0)
#>  GenomeInfoDb         * 1.31.10  2022-04-21 [1] Bioconductor
#>  GenomeInfoDbData       1.2.8    2022-04-13 [1] Bioconductor
#>  GenomicAlignments      1.31.2   2021-11-19 [1] Bioconductor
#>  GenomicRanges        * 1.47.6   2022-01-12 [1] Bioconductor
#>  glue                   1.6.2    2022-02-24 [1] CRAN (R 4.2.0)
#>  highr                  0.9      2021-04-16 [1] CRAN (R 4.2.0)
#>  htmltools              0.5.2    2021-08-25 [1] CRAN (R 4.2.0)
#>  IRanges              * 2.29.1   2021-11-19 [1] Bioconductor
#>  knitr                  1.38     2022-03-25 [1] CRAN (R 4.2.0)
#>  lattice                0.20-45  2021-09-22 [1] CRAN (R 4.2.0)
#>  lifecycle              1.0.1    2021-09-24 [1] CRAN (R 4.2.0)
#>  magrittr               2.0.3    2022-03-30 [1] CRAN (R 4.2.0)
#>  Matrix                 1.4-1    2022-03-23 [1] CRAN (R 4.2.0)
#>  MatrixGenerics         1.7.0    2021-10-26 [1] Bioconductor
#>  matrixStats            0.62.0   2022-04-19 [1] CRAN (R 4.2.0)
#>  pillar                 1.7.0    2022-02-01 [1] CRAN (R 4.2.0)
#>  pkgconfig              2.0.3    2019-09-22 [1] CRAN (R 4.2.0)
#>  purrr                  0.3.4    2020-04-17 [1] CRAN (R 4.2.0)
#>  R.cache                0.15.0   2021-04-30 [1] CRAN (R 4.2.0)
#>  R.methodsS3            1.8.1    2020-08-26 [1] CRAN (R 4.2.0)
#>  R.oo                   1.24.0   2020-08-26 [1] CRAN (R 4.2.0)
#>  R.utils                2.11.0   2021-09-26 [1] CRAN (R 4.2.0)
#>  RCurl                  1.98-1.6 2022-02-08 [1] CRAN (R 4.2.0)
#>  reprex                 2.0.1    2021-08-05 [1] CRAN (R 4.2.0)
#>  restfulr               0.0.13   2017-08-06 [1] CRAN (R 4.2.0)
#>  rjson                  0.2.21   2022-01-09 [1] CRAN (R 4.2.0)
#>  rlang                  1.0.2    2022-03-04 [1] CRAN (R 4.2.0)
#>  rmarkdown              2.13     2022-03-10 [1] CRAN (R 4.2.0)
#>  Rsamtools              2.11.0   2021-11-19 [1] Bioconductor
#>  rstudioapi             0.13     2020-11-12 [1] CRAN (R 4.2.0)
#>  rtracklayer          * 1.55.4   2022-03-23 [1] Bioconductor
#>  S4Vectors            * 0.33.17  2022-04-06 [1] Bioconductor
#>  sessioninfo            1.2.2    2021-12-06 [1] CRAN (R 4.2.0)
#>  stringi                1.7.6    2021-11-29 [1] CRAN (R 4.2.0)
#>  stringr                1.4.0    2019-02-10 [1] CRAN (R 4.2.0)
#>  styler                 1.7.0    2022-03-13 [1] CRAN (R 4.2.0)
#>  SummarizedExperiment   1.25.3   2021-12-08 [1] Bioconductor
#>  tibble                 3.1.6    2021-11-07 [1] CRAN (R 4.2.0)
#>  utf8                   1.2.2    2021-07-24 [1] CRAN (R 4.2.0)
#>  vctrs                  0.4.1    2022-04-13 [1] CRAN (R 4.2.0)
#>  withr                  2.5.0    2022-03-03 [1] CRAN (R 4.2.0)
#>  xfun                   0.30     2022-03-02 [1] CRAN (R 4.2.0)
#>  XML                    3.99-0.9 2022-02-24 [1] CRAN (R 4.2.0)
#>  XVector                0.35.0   2021-10-26 [1] Bioconductor
#>  yaml                   2.3.5    2022-02-21 [1] CRAN (R 4.2.0)
#>  zlibbioc               1.41.0   2021-10-26 [1] Bioconductor
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.2/Resources/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────
@mtmorgan
Copy link
Contributor

mtmorgan commented Apr 23, 2022

The purpose of BiocIO is like BiocGenerics -- it provides the generics import() / export(), but not the methods implemented on the generics. It's a little more complicated (hence separate from) BiocGenetics, because it also implements infrastructure that maps a file name extension -- .bed, .bed.gz, etc -- to an appropriate method, without actually knowing about the implementation details of importing a bed file.

End users should be doing things like rtracklayer::import("foo.bed.gz").

Package authors wishing to use an existing importer should be doing something similar, e.g., importing the rtracklayer import method, and invoking that. For the problem in EpiCompare, it looks like the correct use is as above, rtracklayer::import(path, format = "narrowPeak"); the error about scan() expected 'an integer', got '12.59446' results from not specifying format =....

Package authors wishing to implement their own import should be (a) importing BiocIO including the generics, (b) implementing a class derived from BiocFile and (c) implementing import() and export() methods for that class. This is done in, for instance LoomExperiment where the class is implemented at https://github.com/Bioconductor/LoomExperiment/blob/master/R/LoomFile-class.R and the import method at https://github.com/Bioconductor/LoomExperiment/blob/edb0ecfb553abcd4f3353f547918786cf3a22476/R/import-method.R#L135-L308 (obviously where a lot of package-specific information is captured). This allows the user to say LoomExperiment::import("foo.loom"). Hopefully the package vignette https://bioconductor.org/packages/devel/bioc/vignettes/BiocIO/inst/doc/BiocIO.html is relatively clear on this; if not suggestions / pull requests welcome.

@PeteHaitch
Copy link
Contributor Author

Thanks for the explanation, Martin.
I'd not understood that the split was generics+classes (BiocIO) and methods (rtracklayer + others), although I now see it was staring me in the face in the first line of the README(!).
I might suggest adding that same sentence to the DESCRIPTION would be helpful, because the package landing page perhaps lacks such a succinct explanation of the separation of duties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants