TrackViewer Vignette Err: attr must be a slot name of xscale object
0
0
Entering edit mode
@liruiradiant-8906
Last seen 2.9 years ago
United States

Hello,

When I add the following command to my trackViewer Vignette:

setTrackXscaleParam(trackList[[1]], attr="position", 
                    value=list(x=122929700, y=3, label=200))

R gives me the following error:

Error in setTrackXscaleParam(trackList[[1]], attr = "position", value = list(x = 122929700, : attr must be a slot name of xscale object
3.
stop("attr must be a slot name of xscale object")
2.
setTrackXscaleParam(trackList[[1]], attr = "position", value = list(x = 122929700, y = 3, label = 200))
1.
setTrackXscaleParam(trackList[[1]], attr = "position", value = list(x = 122929700, y = 3, label = 200))

Is there something that I did wrong? Thanks!

I'll post sessionInfo() and my code below.

trackViewer • 961 views
ADD COMMENT
0
Entering edit mode
> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

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] grid      parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] org.Hs.eg.db_3.10.0                     TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2
 [3] GenomicFeatures_1.38.0                  AnnotationDbi_1.48.0                   
 [5] Biobase_2.46.0                          rtracklayer_1.46.0                     
 [7] Gviz_1.30.0                             trackViewer_1.22.0                     
 [9] GenomicRanges_1.38.0                    GenomeInfoDb_1.22.0                    
[11] IRanges_2.20.1                          S4Vectors_0.24.1                       
[13] BiocGenerics_0.32.0                    

loaded via a namespace (and not attached):
 [1] ProtGenerics_1.18.0         bitops_1.0-6                matrixStats_0.55.0          bit64_0.9-7                
 [5] RColorBrewer_1.1-2          progress_1.2.2              httr_1.4.1                  InteractionSet_1.14.0      
 [9] Rgraphviz_2.30.0            tools_3.6.1                 backports_1.1.5             R6_2.4.1                   
[13] rpart_4.1-15                Hmisc_4.3-0                 DBI_1.1.0                   lazyeval_0.2.2             
[17] colorspace_1.4-1            nnet_7.3-12                 tidyselect_0.2.5            gridExtra_2.3              
[21] prettyunits_1.0.2           bit_1.1-14                  curl_4.3                    compiler_3.6.1             
[25] graph_1.64.0                htmlTable_1.13.3            grImport_0.9-3              DelayedArray_0.12.0        
[29] scales_1.1.0                checkmate_1.9.4             stringr_1.4.0               digest_0.6.23              
[33] Rsamtools_2.2.1             foreign_0.8-72              rmarkdown_2.0               XVector_0.26.0             
[37] base64enc_0.1-3             dichromat_2.0-0             pkgconfig_2.0.3             htmltools_0.4.0            
[41] plotrix_3.7-7               ensembldb_2.10.2            BSgenome_1.54.0             htmlwidgets_1.5.1          
[45] rlang_0.4.2                 rstudioapi_0.10             RSQLite_2.1.4               BiocParallel_1.20.0        
[49] acepack_1.4.1               dplyr_0.8.3                 VariantAnnotation_1.32.0    RCurl_1.95-4.12            
[53] magrittr_1.5                GenomeInfoDbData_1.2.2      Formula_1.2-3               Matrix_1.2-18              
[57] Rcpp_1.0.3                  munsell_0.5.0               lifecycle_0.1.0             yaml_2.2.0                 
[61] stringi_1.4.3               SummarizedExperiment_1.16.0 zlibbioc_1.32.0             blob_1.2.0                 
[65] crayon_1.3.4                lattice_0.20-38             Biostrings_2.54.0           splines_3.6.1              
[69] hms_0.5.2                   zeallot_0.1.0               knitr_1.26                  pillar_1.4.2               
[73] biomaRt_2.42.0              XML_3.98-1.20               glue_1.3.1                  evaluate_0.14              
[77] biovizBase_1.34.1           latticeExtra_0.6-28         BiocManager_1.30.10         data.table_1.12.8          
[81] vctrs_0.2.0                 gtable_0.3.0                purrr_0.3.3                 assertthat_0.2.1           
[85] ggplot2_3.2.1               xfun_0.11                   AnnotationFilter_1.10.0     survival_3.1-8             
[89] tibble_2.1.3                GenomicAlignments_1.22.1    memoise_1.1.0               cluster_2.1.0
  
ADD REPLY
0
Entering edit mode
---
title: "test"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```



```{r }
library(trackViewer)
extdata <- system.file("extdata", package="trackViewer",
                       mustWork=TRUE)
repA <- importScore(file.path(extdata, "cpsf160.repA_-.wig"),
                    file.path(extdata, "cpsf160.repA_+.wig"),
                    format="WIG")
## Because the wig file does not contain any strand info, 
## we need to set it manually.
strand(repA$dat) <- "-"
strand(repA$dat2) <- "+"


fox2 <- importScore(file.path(extdata, "fox2.bed"), format="BED",
                    ranges=GRanges("chr11", IRanges(122929000, 122931000)))
dat <- coverageGR(fox2$dat)
## We can split the data by strand into two different track channels
## Here, we set the dat2 slot to save the negative strand info. 

fox2$dat <- dat[strand(dat)=="+"]
fox2$dat2 <- dat[strand(dat)=="-"]


library(TxDb.Hsapiens.UCSC.hg19.knownGene)
library(org.Hs.eg.db)
gr <- GRanges("chr11", IRanges(122929275, 122930122), strand="-")
trs <- geneModelFromTxdb(TxDb.Hsapiens.UCSC.hg19.knownGene,
                         org.Hs.eg.db,
                         gr=gr)

```


```{r}
optSty <- optimizeStyle(trackList(repA, fox2, trs))
trackList <- optSty$tracks
viewerStyle <- optSty$style

setTrackViewerStyleParam(viewerStyle, "xaxis", FALSE)
setTrackViewerStyleParam(viewerStyle, "margin", c(.01, .05, .01, .01))
setTrackXscaleParam(trackList[[1]], "draw", TRUE)
setTrackXscaleParam(trackList[[1]], "gp", list(cex=0.8))

setTrackXscaleParam(trackList[[1]], attr="position", 
                    value=list(x=122929700, y=3, label=200))
viewTracks(trackList, gr=gr, viewerStyle=viewerStyle)
```
ADD REPLY
0
Entering edit mode

Hi Iiruiradiant,

Thank you for reporting this. Could you try following code to see if there is any issue with your installation:

showMethods("setTrackXscaleParam", includeDefs = TRUE)

And also try


---
title: "test"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)

```{r }
library(trackViewer)
sessionInfo()

To see if there is any difference when you compile the Rmd file.

Jianhong.

ADD REPLY

Login before adding your answer.

Traffic: 1017 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