I successfully ran this command several days ago, but am now having problems that sound like the same thing reported in this issue: possible Rtracklayer issue: TxDb errors in GenomicFeatures package-- cannot load TxDb with standard params from UCSC (issue began last night)
> library(RiboProfiling)
> library(Rsamtools)
> listInputBam <- c(BamFile(args[1]))
> c covData <- riboSeqFromBAM(listInputBam, genomeName="hg19")
Get UCSC ensGene annotations.
Error in names(trackIds) <- sub("^ ", "", nms[nms != "new"]) :
'names' attribute [210] must be the same length as the vector [209]
In addition: Warning message:
In riboSeqFromBAM(listInputBam, genomeName = "hg19") :
paramScanBAM parameter is not a ScanBamParam object. Set to default NULL value!
> traceback()
12: .local(object, ...)
11: ucscTracks(object)
10: ucscTracks(object)
9: .local(object, ...)
8: trackNames(session)
7: trackNames(session)
6: supportedUCSCtables(session)
5: .tablename2track(tablename, session)
4: GenomicFeatures::makeTxDbFromUCSC(genome = genomeName, tablename = "ensGene",
url = "http://genome-euro.ucsc.edu/cgi-bin/")
3: withCallingHandlers(expr, warning = function(w) invokeRestart("muffleWarning"))
2: suppressWarnings(GenomicFeatures::makeTxDbFromUCSC(genome = genomeName,
tablename = "ensGene", url = "http://genome-euro.ucsc.edu/cgi-bin/"))
1: riboSeqFromBAM(listInputBam, genomeName = "hg19")
The code described in that previous post also results in the error:
> library(rtracklayer)
> session <- browserSession()
> genome(session) <- "hg38"
> track_names <- trackNames(session)
Error in names(trackIds) <- sub("^ ", "", nms[nms != "new"]) :
'names' attribute [116] must be the same length as the vector [115]
> genome(session) <- "hg19"
> track_names <- trackNames(session)
Error in names(trackIds) <- sub("^ ", "", nms[nms != "new"]) :
'names' attribute [210] must be the same length as the vector [209]
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.4 LTS
Matrix products: default
BLAS/LAPACK: /usr/lib/libopenblasp-r0.2.18.so
locale:
[1] C
attached base packages:
[1] stats4 parallel stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] rtracklayer_1.38.3 Rsamtools_1.30.0 GenomicRanges_1.30.3
[4] GenomeInfoDb_1.14.0 RiboProfiling_1.7.2 Biostrings_2.46.0
[7] XVector_0.18.0 IRanges_2.12.0 S4Vectors_0.16.0
[10] BiocGenerics_0.24.0
loaded via a namespace (and not attached):
[1] ProtGenerics_1.10.0 bitops_1.0-6
[3] matrixStats_0.53.1 bit64_0.9-7
[5] RColorBrewer_1.1-2 progress_1.1.2
[7] httr_1.3.1 tools_3.4.0
[9] backports_1.1.2 R6_2.2.2
[11] rpart_4.1-13 Hmisc_4.1-1
[13] DBI_1.0.0 lazyeval_0.2.1
[15] colorspace_1.3-2 nnet_7.3-12
[17] gridExtra_2.3 prettyunits_1.0.2
[19] GGally_1.3.2 RMySQL_0.10.14
[21] curl_3.2 bit_1.1-12
[23] compiler_3.4.0 chron_2.3-52
[25] graph_1.56.0 Biobase_2.38.0
[27] htmlTable_1.11.2 DelayedArray_0.4.1
[29] ggbio_1.26.1 scales_0.5.0
[31] checkmate_1.8.5 RBGL_1.54.0
[33] stringr_1.2.0 digest_0.6.15
[35] foreign_0.8-69 base64enc_0.1-3
[37] dichromat_2.0-0 htmltools_0.3.6
[39] ensembldb_2.2.2 BSgenome_1.46.0
[41] htmlwidgets_1.0 rlang_0.2.0
[43] rstudioapi_0.7 RSQLite_2.1.1
[45] BiocInstaller_1.28.0 shiny_1.0.5
[47] BiocParallel_1.12.0 acepack_1.4.1
[49] VariantAnnotation_1.24.5 RCurl_1.95-4.10
[51] magrittr_1.5 GenomeInfoDbData_1.0.0
[53] Formula_1.2-2 Matrix_1.2-13
[55] Rcpp_0.12.16 munsell_0.4.3
[57] proto_1.0.0 sqldf_0.4-11
[59] stringi_1.1.5 yaml_2.1.18
[61] SummarizedExperiment_1.8.1 zlibbioc_1.24.0
[63] plyr_1.8.4 AnnotationHub_2.10.1
[65] grid_3.4.0 blob_1.1.1
[67] promises_1.0.1 lattice_0.20-35
[69] splines_3.4.0 GenomicFeatures_1.30.3
[71] knitr_1.20 pillar_1.2.1
[73] reshape2_1.4.3 biomaRt_2.34.2
[75] XML_3.98-1.10 biovizBase_1.26.0
[77] latticeExtra_0.6-28 data.table_1.10.4-3
[79] httpuv_1.4.2 gtable_0.2.0
[81] reshape_0.8.7 assertthat_0.2.0
[83] gsubfn_0.7 ggplot2_2.2.1
[85] mime_0.5 xtable_1.8-2
[87] AnnotationFilter_1.2.0 later_0.7.2
[89] survival_2.41-3 OrganismDbi_1.20.0
[91] tibble_1.4.2 GenomicAlignments_1.14.2
[93] AnnotationDbi_1.40.0 memoise_1.1.0
[95] cluster_2.0.7 interactiveDisplayBase_1.16.0
Oh and I'm from UCSC, not Bioconductor, so if this is a Bioconductor problem, I cannot comment on that, I know nothing about Bioconductor
The basic problem is that rtracklayer was originally designed as an interface to the genome browser, not the database. It interacts with the web site directly, relying on a myriad of heuristics. People have come to use it almost exclusively as an interface to the database, so really it should just be making SQL queries.