Error in value[[3L]](cond) : 'end' must be <= 536870912 with Gviz::plotTracks
1
0
Entering edit mode
syliang • 0
@syliang-9485
Last seen 4.7 years ago

Dear all,

I encountered a problem when I plotted some genes with plotTracks using Gviz. It happened only to those genes with very large coordinates (end > 536870912) on the chromosome.
Listed here are a subset of my code, the error message, and sessionInfo(). Thank you for your help.

Suh-Yuen

S24<- AlignmentsTrack("SR19AA2418Aligned.sortedByCoord.out.bam", isPaired = TRUE, name="S24", col="sandybrown", fill="sandybrown", cex=0.8)

for (i in 12:length(targets)){ ID<-targets[i] start<-genemodel$start[genemodel$gene==ID & genemodel$feature=="mRNA"] end<-genemodel$end[genemodel$gene==ID & genemodel$feature=="mRNA"] chr<-genemodel$chr[genemodel$gene==ID & genemodel$feature=="mRNA"]

aTrack1 <- AnnotationTrack( genemodel[genemodel$chr==chr & genemodel$gene==ID & genemodel$feature=="CDS",], chromosome = chr, start = start, end = end, Id = ID, feature=ID, group = ID, name = "Gene Annotation", col="blue", fill="blue",cex=0.9 )

axisTrack <- GenomeAxisTrack(cex = 1,cex=0.9,exponent=5) # set the font size larger

grtrack <- GeneRegionTrack( genemodel[genemodel$chr==chr,], chromosome = chr, showId = TRUE, fontcolor="black",stacking="full", name = "Gene Annotation",col="grey", fill="grey",cex=1.2 )

fname<-paste0("P:/Assembly/ginkgo/P450s/Gviz/localginkgo",ID,"_",chr,"RNASeq.png") png(filename = fname,width =680, height = 680)

plotTracks(c(axisTrack, grtrack, aTrack1, S24),from=start,to=end,chromosome=chr, name=ID, type = "coverage",size=c(15,1,1,1),margin=2, shape="arrow", just.group = "above", transcriptAnnotation="gene", cex=1, extend.right=300, extend.left=300, cex.main=1.4, main=paste("RNASeq expression of", ID, "at", chr),title.width=1.5 )

dev.off() }

Error in value[3L] : 'end' must be <= 536870912 file: SR19AA2418Aligned.sortedByCoord.out.bam index: SR19AA2418Aligned.sortedByCoord.out.bam.bai In addition: There were 30 warnings (use warnings() to see them)

c(start,end,chr) [1] "689297194" "689298824" "Chr5"

sessionInfo() R version 3.6.2 (2019-12-12) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 17763)

Matrix products: default

Random number generation: RNG: Mersenne-Twister Normal: Inversion Sample: Rounding

locale: [1] LCCOLLATE=EnglishUnited States.1252 LCCTYPE=EnglishUnited States.1252
[3] LCMONETARY=EnglishUnited States.1252 LCNUMERIC=C
[5] LC
TIME=English_United States.1252

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

other attached packages: [1] GenomicFeatures1.38.2 AnnotationDbi1.48.0 Biobase2.46.0 Rsamtools2.2.2
[5] Biostrings2.54.0 XVector0.26.0 Gviz1.30.3 GenomicRanges1.38.0
[9] GenomeInfoDb1.22.0 IRanges2.20.2 S4Vectors0.24.3 BiocGenerics0.32.0
[13] openxlsx4.1.4 dplyr0.8.4

loaded via a namespace (and not attached): [1] ProtGenerics1.18.0 bitops1.0-6 matrixStats0.55.0
[4] bit64
0.9-7 RColorBrewer1.1-2 progress1.2.2
[7] httr1.4.1 tools3.6.2 backports1.1.5
[10] R6
2.4.1 rpart4.1-15 Hmisc4.3-1
[13] DBI1.1.0 lazyeval0.2.2 colorspace1.4-1
[16] nnet
7.3-12 tidyselect1.0.0 gridExtra2.3
[19] prettyunits1.1.1 bit1.1-15.2 curl4.3
[22] compiler
3.6.2 htmlTable1.13.3 DelayedArray0.12.2
[25] rtracklayer1.46.0 scales1.1.0 checkmate2.0.0
[28] askpass
1.1 rappdirs0.3.1 stringr1.4.0
[31] digest0.6.25 foreign0.8-75 dichromat2.0-0
[34] htmltools
0.4.0 base64enc0.1-3 jpeg0.1-8.1
[37] pkgconfig2.0.3 ensembldb2.10.2 BSgenome1.54.0
[40] dbplyr
1.4.2 htmlwidgets1.5.1 rlang0.4.4
[43] rstudioapi0.11 RSQLite2.2.0 BiocParallel1.20.1
[46] acepack
1.4.1 zip2.0.4 VariantAnnotation1.32.0
[49] RCurl1.98-1.1 magrittr1.5 GenomeInfoDbData1.2.2
[52] Formula
1.2-3 Matrix1.2-18 Rcpp1.0.3
[55] munsell0.5.0 lifecycle0.1.0 stringi1.4.6
[58] SummarizedExperiment
1.16.1 zlibbioc1.32.0 BiocFileCache1.10.2
[61] blob1.2.1 crayon1.3.4 lattice0.20-40
[64] splines
3.6.2 hms0.5.3 knitr1.28
[67] pillar1.4.3 biomaRt2.42.0 XML3.99-0.3
[70] glue
1.3.1 biovizBase1.34.1 latticeExtra0.6-29
[73] data.table1.12.8 png0.1-7 vctrs0.2.3
[76] gtable
0.3.0 openssl1.4.1 purrr0.3.3
[79] assertthat0.2.1 ggplot23.2.1 xfun0.12
[82] AnnotationFilter
1.10.0 survival3.1-8 tibble2.1.3
[85] GenomicAlignments1.22.1 memoise1.1.0 cluster_2.1.0

Gviz plotTracks • 1.2k views
ADD COMMENT
0
Entering edit mode
Robert Ivanek ▴ 750
@robert-ivanek-5892
Last seen 11 months ago
Switzerland

Hi Suh-Yuen, I guess this limit is coming from Rsamtools ScanBamParam-class, please see the help page, which argument:

?`ScanBamParam-class`
   which: A ‘GRanges’, ‘IntegerRangesList’, or any object that can be
          coerced to a ‘IntegerRangesList’, or missing object, from
          which a ‘IRangesList’ instance will be constructed. Names of
          the ‘IRangesList’ correspond to reference sequences, and
          ranges to the regions on that reference sequence for which
          matches are desired. Because data types are coerced to
          ‘IRangesList’, ‘which’ does _not_ include strand information
          (use the ‘flag’ argument instead). Only records with a read
          overlapping the specified ranges are returned. All ranges
          must have ends less than or equal to 536870912. When one
          record overlaps two ranges in ‘which’, the record is returned
          _twice_.

Best, Robert

ADD COMMENT
0
Entering edit mode

Hi Robert, Thank you very much for your help! In that case, I would have to give up using Gviz. Suh-Yuen

ADD REPLY

Login before adding your answer.

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