rtracklayer accessing UCSC data table not working
1
0
Entering edit mode
@68a21322
Last seen 4 hours ago
Germany

Hi,

I am following the "Example 1: the RepeatMasker Track" given by Michael Lawrence in chapter 5.1 of the documentation for the package 'rtracklayer':

library (rtracklayer)
mySession = browserSession("UCSC")
genome(mySession) <- "hg19"
e2f3.tss.grange <- GRanges("chr6", IRanges(20400587, 20403336))
tbl.rmsk <- getTable(
  ucscTableQuery(mySession, track="rmsk",
                  range=e2f3.tss.grange, table="rmsk"))

Running this code, I get the error message: "error in evaluating the argument 'object' in selecting a method for function 'getTable': error in evaluating the argument 'table' in selecting a method for function '%in%': Unknown track: rmsk"

Listing all available tracks reveals that the name for the track might be: "RepeatMasker".

# List all available tracks in the session
available_tracks <- trackNames(mySession)
print("Available Tracks:")
print(sort(available_tracks))

However, when I replace the track name "rmsk" with "RepeatMasker (see below), I still get an error message:

library (rtracklayer)
mySession = browserSession("UCSC")
genome(mySession) <- "hg19"
e2f3.tss.grange <- GRanges("chr6", IRanges(20400587, 20403336))
tbl.rmsk <- getTable(
  ucscTableQuery(mySession, track="RepeatMasker",
                  range=e2f3.tss.grange, table="rmsk"))

command: tbl.rmsk <- getTable(...) error message: "Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'as.data.frame': second argument must be a list"

How can I get the example to work?

Kind regards, Andreas

sessioninfo()

R version 4.4.1 (2024-06-14)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.7

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

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

time zone: Europe/Berlin
tzcode source: internal

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

other attached packages:
[1] rtracklayer_1.64.0   GenomicRanges_1.56.1 GenomeInfoDb_1.40.1  IRanges_2.38.1       S4Vectors_0.42.1     BiocGenerics_0.50.0 

loaded via a namespace (and not attached):
 [1] utf8_1.2.4                  generics_0.1.3              SparseArray_1.4.8           bitops_1.0-8                lattice_0.22-6              digest_0.6.37               magrittr_2.0.3             
 [8] grid_4.4.1                  evaluate_1.0.0              fastmap_1.2.0               Matrix_1.7-0                jsonlite_1.8.8              restfulr_0.0.15             httr_1.4.7                 
[15] fansi_1.0.6                 UCSC.utils_1.0.0            XML_3.99-0.17               Biostrings_2.72.1           codetools_0.2-20            abind_1.4-8                 cli_3.6.3                  
[22] rlang_1.1.4                 crayon_1.5.3                XVector_0.44.0              Biobase_2.64.0              DelayedArray_0.30.1         yaml_2.3.10                 S4Arrays_1.4.1             
[29] tools_4.4.1                 parallel_4.4.1              BiocParallel_1.38.0         dplyr_1.1.4                 GenomeInfoDbData_1.2.12     Rsamtools_2.20.0            SummarizedExperiment_1.34.0
[36] curl_5.2.2                  vctrs_0.6.5                 R6_2.5.1                    matrixStats_1.4.1           BiocIO_1.14.0               lifecycle_1.0.4             zlibbioc_1.50.0            
[43] pkgconfig_2.0.3             pillar_1.9.0                glue_1.7.0                  xfun_0.47                   tibble_3.2.1                GenomicAlignments_1.40.0    tidyselect_1.2.1           
[50] MatrixGenerics_1.16.0       rstudioapi_0.16.0           knitr_1.48                  rjson_0.2.23                htmltools_0.5.8.1           rmarkdown_2.28              compiler_4.4.1             
[57] RCurl_1.98-1.16
UCSC rtracklayer getTable • 23 views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 2 hours ago
United States

The track argument is deprecated now, so you can omit it.

> tbl.rmsk <- getTable(ucscTableQuery(mySession, table = "rmsk", range = e2f3.tss.grange))

> head(tbl.rmsk)
  bin swScore milliDiv milliDel milliIns genoName genoStart  genoEnd   genoLeft strand repName       repClass
1 740      25        0        0        0     chr6  20401747 20401772 -150713295      + GC_rich Low_complexity
2 740     231       36        0        0     chr6  20402594 20402622 -150712445      +  (CCG)n  Simple_repeat
3 740     213       39        0        0     chr6  20402824 20402850 -150712217      +  (CGG)n  Simple_repeat
       repFamily repStart repEnd repLeft id
1 Low_complexity        1     25       0  3
2  Simple_repeat        2     29       0  3
3  Simple_repeat        3     28       0  3

Login before adding your answer.

Traffic: 937 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6