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

BUG (_R_CHECK_LENGTH_1_LOGIC2_): Error in .dpOrDefault(GdObject, ".__hasAnno", FALSE) && !is.null(bartext) && : 'length(x) = 3 > 1' in coercion to 'logical(1)' #23

Closed
HenrikBengtsson opened this issue Feb 16, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@HenrikBengtsson
Copy link

HenrikBengtsson commented Feb 16, 2020

R CMD check with (e.g. in ~/.R/check.Renviron):

## Check for bugs like if (c(TRUE, FALSE)). Supported since R (>= 3.4.0)
_R_CHECK_LENGTH_1_CONDITION_=package:_R_CHECK_PACKAGE_NAME_,verbose

## Check for bugs like c(TRUE, FALSE) && TRUE. Supported since R (>= 3.6.0)
_R_CHECK_LENGTH_1_LOGIC2_=package:_R_CHECK_PACKAGE_NAME_,verbose

produces:

* using log directory ‘/wynton/home/cbi/hb/repositories/matrixStats/revdep/checks/Gviz/new/Gviz.Rcheck’
* using R version 3.6.2 (2019-12-12)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* using options ‘--no-manual --no-build-vignettes’
* checking for file ‘Gviz/DESCRIPTION’ ... OK
* this is package ‘Gviz’ version ‘1.30.1’
* package encoding: UTF-8
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘Gviz’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking contents of ‘data’ directory ... OK
* checking data for non-ASCII characters ... OK
* checking data for ASCII and uncompressed saves ... OK
* checking installed files from ‘inst/doc’ ... OK
* checking files in ‘vignettes’ ... OK
* checking examples ... ERROR
Running examples in ‘Gviz-Ex.R’ failed
The error most likely occurred in:

> ### Name: GeneRegionTrack-class
> ### Title: GeneRegionTrack class and methods
> ### Aliases: GeneRegionTrack-class GeneRegionTrack
> ###   coerce,GeneRegionTrack,UCSCData-method
> ###   collapseTrack,GeneRegionTrack-method exon exon,GeneRegionTrack-method
> ###   exon<- exon<-,GeneRegionTrack,character-method
> ###   gene,GeneRegionTrack-method gene
> ###   gene<-,GeneRegionTrack,character-method gene<-
> ###   group,GeneRegionTrack-method group<-,GeneRegionTrack,character-method
> ###   identifier,GeneRegionTrack-method
> ###   identifier<-,GeneRegionTrack,character-method
> ###   initialize,GeneRegionTrack-method
> ###   initialize,ReferenceGeneRegionTrack-method
> ###   show,GeneRegionTrack-method show,ReferenceGeneRegionTrack-method
> ###   symbol,GeneRegionTrack-method
> ###   symbol<-,GeneRegionTrack,character-method symbol symbol<-
> ###   transcript,GeneRegionTrack-method
> ###   transcript<-,GeneRegionTrack,character-method transcript transcript<-
> ###   coerce,GRanges,GeneRegionTrack-method
> ###   coerce,GRangesList,GeneRegionTrack-method
> ###   coerce,TxDb,GeneRegionTrack-method
> ###   subset,ReferenceGeneRegionTrack-method
> ### Keywords: classes
> 
> ### ** Examples
> 
> 
> ## The empty object
> GeneRegionTrack()
GeneRegionTrack 'GeneRegionTrack'
| genome: NA
| active chromosome: chrNA
| annotation features: 0
> 
> ## Load some sample data
> data(cyp2b10)
> 
> ## Construct the object
> grTrack <- GeneRegionTrack(start=26682683, end=26711643,
+ rstart=cyp2b10$start, rends=cyp2b10$end, chromosome=7, genome="mm9",
+ transcript=cyp2b10$transcript, gene=cyp2b10$gene, symbol=cyp2b10$symbol,
+ feature=cyp2b10$feature, exon=cyp2b10$exon,
+ name="Cyp2b10", strand=cyp2b10$strand)
> 
> ## Directly from the data.frame
> grTrack <- GeneRegionTrack(cyp2b10)
> 
> ## From a TxDb object
> if(require(GenomicFeatures)){
+ samplefile <- system.file("extdata", "hg19_knownGene_sample.sqlite", package="GenomicFeatures")
+ txdb <- loadDb(samplefile)
+ GeneRegionTrack(txdb)
+ GeneRegionTrack(txdb, chromosome="chr6", start=35000000, end=40000000)
+ }
Loading required package: GenomicFeatures
Loading required package: AnnotationDbi
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

GeneRegionTrack 'GeneRegionTrack'
| genome: hg19
| active chromosome: chr6
| annotation features: 71
> 
> 
> 
> ## Don't show: 
> ## For some annoying reason the postscript device does not know about
> ## the sans font
> if(!interactive())
+ {
+ font <- ps.options()$family
+ displayPars(grTrack) <- list(fontfamily=font, fontfamily.title=font)
+ }
> ## End(Don't show)
> 
> ## Plotting
> plotTracks(grTrack)
> 
> ## Track names
> names(grTrack)
[1] "GeneRegionTrack"
> names(grTrack) <- "foo"
> plotTracks(grTrack)
> 
> ## Subsetting and splitting
> subTrack <- subset(grTrack, from=26700000, to=26705000)
> length(subTrack)
[1] 0
> subTrack <- grTrack[transcript(grTrack)=="ENSMUST00000144140"]
> split(grTrack, transcript(grTrack))
$ENSMUST00000005477
GeneRegionTrack 'foo'
| genome: NA
| active chromosome: chr7
| annotation features: 12

$ENSMUST00000072438
GeneRegionTrack 'foo'
| genome: NA
| active chromosome: chr7
| annotation features: 11

$ENSMUST00000144140
GeneRegionTrack 'foo'
| genome: NA
| active chromosome: chr7
| annotation features: 2

> 
> ## Accessors
> start(grTrack)
 [1] 25897620 25897676 25897685 25897685 25911238 25911238 25911554 25911554
 [9] 25913865 25913865 25914748 25914748 25915392 25915392 25916766 25916934
[17] 25916934 25917288 25917288 25917288 25925373 25926068 25926068 25926250
[25] 25926250
> end(grTrack)
 [1] 25897684 25897684 25897855 25897855 25911400 25911400 25911703 25911703
 [9] 25914025 25914025 25914924 25914924 25915533 25915533 25917121 25917121
[17] 25917121 25917429 25917429 25917430 25925399 25926249 25926249 25926559
[25] 25926624
> width(grTrack)
 [1]  65   9 171 171 163 163 150 150 161 161 177 177 142 142 356 188 188 142 142
[20] 143  27 182 182 310 375
> position(grTrack)
 [1] 25897652 25897680 25897770 25897770 25911319 25911319 25911628 25911628
 [9] 25913945 25913945 25914836 25914836 25915462 25915462 25916944 25917028
[17] 25917028 25917358 25917358 25917359 25925386 25926158 25926158 25926404
[25] 25926437
> width(subTrack) <- width(subTrack)+100
> 
> strand(grTrack)
 [1] "+" "+" "+" "+" "+" "+" "+" "+" "+" "+" "+" "+" "+" "+" "+" "+" "+" "+" "+"
[20] "+" "+" "+" "+" "+" "+"
> strand(subTrack) <- "-"
> 
> chromosome(grTrack)
[1] "chr7"
> chromosome(subTrack) <- "chrX"
> 
> genome(grTrack)
[1] NA
> genome(subTrack) <- "hg19"
> 
> range(grTrack)
IRanges object with 25 ranges and 0 metadata columns:
           start       end     width
       <integer> <integer> <integer>
   [1]  25897620  25897684        65
   [2]  25897676  25897684         9
   [3]  25897685  25897855       171
   [4]  25897685  25897855       171
   [5]  25911238  25911400       163
   ...       ...       ...       ...
  [21]  25925373  25925399        27
  [22]  25926068  25926249       182
  [23]  25926068  25926249       182
  [24]  25926250  25926559       310
  [25]  25926250  25926624       375
> ranges(grTrack)
GRanges object with 25 ranges and 7 metadata columns:
       seqnames            ranges strand |        feature          id
          <Rle>         <IRanges>  <Rle> |       <factor> <character>
   [1]     chr7 25897620-25897684      + |           utr5     unknown
   [2]     chr7 25897676-25897684      + |           utr5     unknown
   [3]     chr7 25897685-25897855      + | protein_coding     unknown
   [4]     chr7 25897685-25897855      + | protein_coding     unknown
   [5]     chr7 25911238-25911400      + | protein_coding     unknown
   ...      ...               ...    ... .            ...         ...
  [21]     chr7 25925373-25925399      + | protein_coding     unknown
  [22]     chr7 25926068-25926249      + | protein_coding     unknown
  [23]     chr7 25926068-25926249      + | protein_coding     unknown
  [24]     chr7 25926250-25926559      + |           utr3     unknown
  [25]     chr7 25926250-25926624      + |           utr3     unknown
                     exon         transcript               gene   symbol
                 <factor>           <factor>           <factor> <factor>
   [1] ENSMUSE00000742021 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10
   [2] ENSMUSE00000489385 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10
   [3] ENSMUSE00000742021 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10
   [4] ENSMUSE00000489385 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10
   [5] ENSMUSE00000973560 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10
   ...                ...                ...                ...      ...
  [21] ENSMUSE00000496705 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10
  [22] ENSMUSE00000498616 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10
  [23] ENSMUSE00000750625 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10
  [24] ENSMUSE00000750625 ENSMUST00000005477 ENSMUSG00000030483  Cyp2b10
  [25] ENSMUSE00000498616 ENSMUST00000072438 ENSMUSG00000030483  Cyp2b10
         density
       <numeric>
   [1]         1
   [2]         1
   [3]         1
   [4]         1
   [5]         1
   ...       ...
  [21]         1
  [22]         1
  [23]         1
  [24]         1
  [25]         1
  -------
  seqinfo: 1 sequence from an unspecified genome; no seqlengths
> 
> ## Annotation
> identifier(grTrack)
 [1] "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10"
 [8] "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10"
[15] "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10"
[22] "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10"
> identifier(grTrack, "lowest")
 [1] "ENSMUSE00000742021" "ENSMUSE00000489385" "ENSMUSE00000742021"
 [4] "ENSMUSE00000489385" "ENSMUSE00000973560" "ENSMUSE00000973560"
 [7] "ENSMUSE00001043622" "ENSMUSE00001043622" "ENSMUSE00001013991"
[10] "ENSMUSE00001013991" "ENSMUSE00000996531" "ENSMUSE00000996531"
[13] "ENSMUSE00000999790" "ENSMUSE00000999790" "ENSMUSE00000736922"
[16] "ENSMUSE00000963884" "ENSMUSE00000963884" "ENSMUSE00001063063"
[19] "ENSMUSE00001063063" "ENSMUSE00000748299" "ENSMUSE00000496705"
[22] "ENSMUSE00000498616" "ENSMUSE00000750625" "ENSMUSE00000750625"
[25] "ENSMUSE00000498616"
> identifier(subTrack) <- "bar"
> 
> feature(grTrack)
 [1] "utr5"           "utr5"           "protein_coding" "protein_coding"
 [5] "protein_coding" "protein_coding" "protein_coding" "protein_coding"
 [9] "protein_coding" "protein_coding" "protein_coding" "protein_coding"
[13] "protein_coding" "protein_coding" "protein_coding" "protein_coding"
[17] "protein_coding" "protein_coding" "protein_coding" "protein_coding"
[21] "protein_coding" "protein_coding" "protein_coding" "utr3"          
[25] "utr3"          
> feature(subTrack) <- "foo"
> 
> exon(grTrack)
 [1] "ENSMUSE00000742021" "ENSMUSE00000489385" "ENSMUSE00000742021"
 [4] "ENSMUSE00000489385" "ENSMUSE00000973560" "ENSMUSE00000973560"
 [7] "ENSMUSE00001043622" "ENSMUSE00001043622" "ENSMUSE00001013991"
[10] "ENSMUSE00001013991" "ENSMUSE00000996531" "ENSMUSE00000996531"
[13] "ENSMUSE00000999790" "ENSMUSE00000999790" "ENSMUSE00000736922"
[16] "ENSMUSE00000963884" "ENSMUSE00000963884" "ENSMUSE00001063063"
[19] "ENSMUSE00001063063" "ENSMUSE00000748299" "ENSMUSE00000496705"
[22] "ENSMUSE00000498616" "ENSMUSE00000750625" "ENSMUSE00000750625"
[25] "ENSMUSE00000498616"
> exon(subTrack) <- letters[1:2]
> 
> gene(grTrack)
 [1] "ENSMUSG00000030483" "ENSMUSG00000030483" "ENSMUSG00000030483"
 [4] "ENSMUSG00000030483" "ENSMUSG00000030483" "ENSMUSG00000030483"
 [7] "ENSMUSG00000030483" "ENSMUSG00000030483" "ENSMUSG00000030483"
[10] "ENSMUSG00000030483" "ENSMUSG00000030483" "ENSMUSG00000030483"
[13] "ENSMUSG00000030483" "ENSMUSG00000030483" "ENSMUSG00000030483"
[16] "ENSMUSG00000030483" "ENSMUSG00000030483" "ENSMUSG00000030483"
[19] "ENSMUSG00000030483" "ENSMUSG00000030483" "ENSMUSG00000030483"
[22] "ENSMUSG00000030483" "ENSMUSG00000030483" "ENSMUSG00000030483"
[25] "ENSMUSG00000030483"
> gene(subTrack) <- "bar"
> 
> symbol(grTrack)
 [1] "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10"
 [8] "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10"
[15] "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10"
[22] "Cyp2b10" "Cyp2b10" "Cyp2b10" "Cyp2b10"
> symbol(subTrack) <- "foo"
> 
> transcript(grTrack)
 [1] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000072438"
 [4] "ENSMUST00000005477" "ENSMUST00000072438" "ENSMUST00000005477"
 [7] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000072438"
[10] "ENSMUST00000005477" "ENSMUST00000072438" "ENSMUST00000005477"
[13] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000144140"
[16] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000072438"
[19] "ENSMUST00000005477" "ENSMUST00000144140" "ENSMUST00000005477"
[22] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000005477"
[25] "ENSMUST00000072438"
> transcript(subTrack) <- c("foo", "bar")
> chromosome(subTrack) <- "chr7"
> plotTracks(subTrack)
> 
> values(grTrack)
          feature      id               exon         transcript
1            utr5 unknown ENSMUSE00000742021 ENSMUST00000072438
2            utr5 unknown ENSMUSE00000489385 ENSMUST00000005477
3  protein_coding unknown ENSMUSE00000742021 ENSMUST00000072438
4  protein_coding unknown ENSMUSE00000489385 ENSMUST00000005477
5  protein_coding unknown ENSMUSE00000973560 ENSMUST00000072438
6  protein_coding unknown ENSMUSE00000973560 ENSMUST00000005477
7  protein_coding unknown ENSMUSE00001043622 ENSMUST00000072438
8  protein_coding unknown ENSMUSE00001043622 ENSMUST00000005477
9  protein_coding unknown ENSMUSE00001013991 ENSMUST00000072438
10 protein_coding unknown ENSMUSE00001013991 ENSMUST00000005477
11 protein_coding unknown ENSMUSE00000996531 ENSMUST00000072438
12 protein_coding unknown ENSMUSE00000996531 ENSMUST00000005477
13 protein_coding unknown ENSMUSE00000999790 ENSMUST00000072438
14 protein_coding unknown ENSMUSE00000999790 ENSMUST00000005477
15 protein_coding unknown ENSMUSE00000736922 ENSMUST00000144140
16 protein_coding unknown ENSMUSE00000963884 ENSMUST00000072438
17 protein_coding unknown ENSMUSE00000963884 ENSMUST00000005477
18 protein_coding unknown ENSMUSE00001063063 ENSMUST00000072438
19 protein_coding unknown ENSMUSE00001063063 ENSMUST00000005477
20 protein_coding unknown ENSMUSE00000748299 ENSMUST00000144140
21 protein_coding unknown ENSMUSE00000496705 ENSMUST00000005477
22 protein_coding unknown ENSMUSE00000498616 ENSMUST00000072438
23 protein_coding unknown ENSMUSE00000750625 ENSMUST00000005477
24           utr3 unknown ENSMUSE00000750625 ENSMUST00000005477
25           utr3 unknown ENSMUSE00000498616 ENSMUST00000072438
                 gene  symbol density
1  ENSMUSG00000030483 Cyp2b10       1
2  ENSMUSG00000030483 Cyp2b10       1
3  ENSMUSG00000030483 Cyp2b10       1
4  ENSMUSG00000030483 Cyp2b10       1
5  ENSMUSG00000030483 Cyp2b10       1
6  ENSMUSG00000030483 Cyp2b10       1
7  ENSMUSG00000030483 Cyp2b10       1
8  ENSMUSG00000030483 Cyp2b10       1
9  ENSMUSG00000030483 Cyp2b10       1
10 ENSMUSG00000030483 Cyp2b10       1
11 ENSMUSG00000030483 Cyp2b10       1
12 ENSMUSG00000030483 Cyp2b10       1
13 ENSMUSG00000030483 Cyp2b10       1
14 ENSMUSG00000030483 Cyp2b10       1
15 ENSMUSG00000030483 Cyp2b10       1
16 ENSMUSG00000030483 Cyp2b10       1
17 ENSMUSG00000030483 Cyp2b10       1
18 ENSMUSG00000030483 Cyp2b10       1
19 ENSMUSG00000030483 Cyp2b10       1
20 ENSMUSG00000030483 Cyp2b10       1
21 ENSMUSG00000030483 Cyp2b10       1
22 ENSMUSG00000030483 Cyp2b10       1
23 ENSMUSG00000030483 Cyp2b10       1
24 ENSMUSG00000030483 Cyp2b10       1
25 ENSMUSG00000030483 Cyp2b10       1
> 
> ## Grouping
> group(grTrack)
 [1] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000072438"
 [4] "ENSMUST00000005477" "ENSMUST00000072438" "ENSMUST00000005477"
 [7] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000072438"
[10] "ENSMUST00000005477" "ENSMUST00000072438" "ENSMUST00000005477"
[13] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000144140"
[16] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000072438"
[19] "ENSMUST00000005477" "ENSMUST00000144140" "ENSMUST00000005477"
[22] "ENSMUST00000072438" "ENSMUST00000005477" "ENSMUST00000005477"
[25] "ENSMUST00000072438"
> group(subTrack) <- "Group 1"
> transcript(subTrack)
[1] "Group 1" "Group 1"
> plotTracks(subTrack)
> 
> ## Collapsing transcripts
> plotTracks(grTrack, collapseTranscripts=TRUE, showId=TRUE,
+ extend.left=10000, shape="arrow")
 ----------- FAILURE REPORT -------------- 
 --- failure: length > 1 in coercion to logical ---
 --- srcref --- 
: 
 --- package (from environment) --- 
Gviz
 --- call from context --- 
.local(GdObject, ...)
 --- call from argument --- 
.dpOrDefault(GdObject, ".__hasAnno", FALSE) && !is.null(bartext) && 
    !is.na(bartext)
 --- R stacktrace ---
where 1: .local(GdObject, ...)
where 2: .nextMethod(GdObject = GdObject, ... = ...)
where 3: callNextMethod()
where 4: drawGD(expandedTrackList[[i]], minBase = ranges["from"], maxBase = ranges["to"], 
    subset = FALSE)
where 5: drawGD(expandedTrackList[[i]], minBase = ranges["from"], maxBase = ranges["to"], 
    subset = FALSE)
where 6: plotTracks(grTrack, collapseTranscripts = TRUE, showId = TRUE, 
    extend.left = 10000, shape = "arrow")

 --- value of length: 3 type: logical ---
                    txt    x    y
ENSMUSG00000030483 TRUE TRUE TRUE
 --- function from context --- 
function (GdObject, minBase, maxBase, prepare = FALSE, subset = TRUE, 
    ...) 
{
    debug <- .dpOrDefault(GdObject, "debug", FALSE)
    if ((is.logical(debug) && debug) || debug == "prepare") 
        browser()
    imageMap(GdObject) <- NULL
    if (!length(GdObject)) 
        return(invisible(GdObject))
    if (prepare) {
        GdObject <- callNextMethod(GdObject, ...)
        bins <- stacks(GdObject)
        stacks <- max(bins)
        pushViewport(dataViewport(xData = c(minBase, maxBase), 
            extension = 0, yscale = c(1, stacks + 1), clip = TRUE))
        GdObject <- collapseTrack(GdObject, diff = .pxResolution(coord = "x"), 
            xrange = c(minBase, maxBase))
        popViewport(1)
        return(invisible(GdObject))
    }
    if ((is.logical(debug) && debug) || debug == "draw") 
        browser()
    bins <- stacks(GdObject)
    stacks <- max(bins)
    rev <- .dpOrDefault(GdObject, "reverseStrand", FALSE)
    xscale <- if (!rev) 
        c(minBase, maxBase)
    else c(maxBase, minBase)
    yscale <- if (!.dpOrDefault(GdObject, "reverseStacking", 
        FALSE)) 
        c(1, stacks + 1)
    else c(stacks + 1, 1)
    pushViewport(dataViewport(xscale = xscale, extension = 0, 
        yscale = yscale, clip = TRUE))
    res <- .pxResolution(coord = "x")
    curVp <- vpLocation()
    if (curVp$size["height"]/stacks < .dpOrDefault(GdObject, 
        "min.height", 3)) 
        stop("Too many stacks to draw. Either increase the device size or limit the drawing to a smaller region.")
    if (.dpOrDefault(GdObject, "showOverplotting", FALSE)) {
        dens <- as.numeric(values(GdObject)$density)
        if (length(unique(dens)) != 1) {
            minSat <- max(0.25, 1/max(dens))
            minDens <- min(dens)
            rDens <- diff(range(dens))
            saturation <- minSat + ((dens - minDens)/rDens/(1/(1 - 
                minSat)))
            bc <- unique(.getBiotypeColor(GdObject))
            baseCol <- rgb2hsv(col2rgb(bc))
            desatCols <- unlist(lapply(saturation, function(x) hsv(baseCol[1, 
                ], x, baseCol[3, ])))
            names(desatCols) <- paste(unique(feature(GdObject)), 
                rep(dens, each = length(bc)), sep = "_")
            feature(GdObject) <- paste(feature(GdObject), dens, 
                sep = "_")
            desatCols <- desatCols[unique(names(desatCols))]
            displayPars(GdObject) <- as.list(desatCols)
        }
    }
    box <- .boxes(GdObject, (stacks - bins) + 1)
    barsAndLab <- .barsAndLabels(GdObject)
    bar <- barsAndLab$bars
    bartext <- barsAndLab$labels
    shape <- .dpOrDefault(GdObject, "shape", "arrow")
    col.line <- .dpOrDefault(GdObject, "col.line")[1]
    border <- .dpOrDefault(GdObject, "col")[1]
    if (is.null(border)) 
        border <- ifelse(is(GdObject, "GeneRegionTrack"), NA, 
            "transparent")
    lwd <- .dpOrDefault(GdObject, "lwd", 2)
    lty <- .dpOrDefault(GdObject, "lty", 1)
    alpha <- .dpOrDefault(GdObject, "alpha", 1)
    rotation <- .dpOrDefaultFont(GdObject, "rotation", "item", 
        0)
    rotation.group <- .dpOrDefaultFont(GdObject, "rotation", 
        "group", 0)
    just <- .dpOrDefault(GdObject, "just.group", "left")
    if (nrow(box) > 0) {
        drawLabel <- .dpOrDefault(GdObject, ".__hasAnno", FALSE) && 
            !is.null(bartext) && !is.na(bartext) && nrow(bartext) > 
            0 && stacking(GdObject) != "dense"
        bs <- as.vector((stacks - bins) + 1)
        if (drawLabel && just %in% c("above", "below")) {
            labelHeights <- max(.getStringDims(GdObject, bartext$txt, 
                subtype = "group")$height)
            labelSpace <- as.numeric(convertHeight(unit(2, "points"), 
                "native"))
            avSpace <- (1 - max(box$cy2 - box$cy1))/2
            vadjust <- max(0, (labelHeights + (2 * labelSpace)) - 
                avSpace)
            bh <- 1 - (avSpace * 2)
            bhNew <- bh - vadjust
            sfac <- bhNew/bh
            if (just == "above") {
                bar$y <- bar$y - (vadjust/2)
                box$textY <- box$textY - (vadjust/2)
                bartext$y <- bartext$y - labelSpace
                box$cy1 <- bs + ((box$cy1%%1 - avSpace) * sfac) + 
                  avSpace
                box$cy2 <- bs + ((box$cy2%%1 - avSpace) * sfac) + 
                  avSpace
            }
            else {
                bar$y <- bar$y + (vadjust/2)
                box$textY <- box$textY + (vadjust/2)
                bartext$y <- bartext$y + labelSpace
                box$cy1 <- bs + ((box$cy1%%1 - avSpace) * sfac) + 
                  avSpace + vadjust
                box$cy2 <- bs + ((box$cy2%%1 - avSpace) * sfac) + 
                  avSpace + vadjust
            }
        }
        if (nrow(bar) > 0) 
            .arrowBar(bar$sx1, bar$sx2, y = bar$y, bar$strand, 
                box[, 1:4, drop = FALSE], W = .dpOrDefault(GdObject, 
                  "arrowFeatherWidth", 3), D = .dpOrDefault(GdObject, 
                  "arrowFeatherDistance", 20), col = if (is.null(col.line)) 
                  bar$col
                else rep(col.line, length(bar$col)), lwd = lwd, 
                lty = lty, alpha = alpha, barOnly = (!"smallArrow" %in% 
                  .dpOrDefault(GdObject, "shape", "box") || stacking(GdObject) == 
                  "dense"), diff = res, min.height = .dpOrDefault(GdObject, 
                  "min.height", 3))
        box$col <- if (is.na(border)) 
            box$fill
        else border
        if ("box" %in% shape || ("smallArrow" %in% shape && !("arrow" %in% 
            shape || "ellipse" %in% shape))) {
            .filledBoxes(box, lwd = lwd, lty = lty, alpha = alpha)
        }
        if ("ellipse" %in% shape) {
            ellCoords <- .box2Ellipse(box)
            grid.polygon(x = ellCoords$x1, y = ellCoords$y1, 
                id = ellCoords$id, gp = gpar(col = if (is.na(border)) 
                  box$fill
                else border, fill = box$fill, lwd = lwd, lty = lty, 
                  alpha = alpha), default.units = "native")
        }
        if ("arrow" %in% shape && !"box" %in% shape) {
            .filledArrow(box, lwd = lwd, lty = lty, alpha = alpha, 
                min.width = 4 * res, max.width = .dpOrDefault(GdObject, 
                  "arrowHeadMaxWidth", 40) * res)
        }
        if ("fixedArrow" %in% shape && !"box" %in% shape) {
            .filledArrow(box, lwd = lwd, lty = lty, alpha = alpha, 
                min.width = 4 * res, absoluteWidth = TRUE, W = .dpOrDefault(GdObject, 
                  "arrowHeadWidth", 30) * res)
        }
        if (.dpOrDefault(GdObject, "showFeatureId", FALSE)) 
            grid.text(box$text, box$textX, box$textY, rot = rotation, 
                gp = .fontGp(GdObject, subtype = "item"), default.units = "native", 
                just = c("center", "center"))
        if (drawLabel) {
            grid.text(bartext$txt, bartext$x, bartext$y, rot = rotation.group, 
                gp = .fontGp(GdObject, subtype = "group"), default.units = "native", 
                just = barsAndLab$align)
        }
    }
    popViewport(1)
    im <- if (!is.null(box)) {
        coords <- as.matrix(box[, c("x1", "y1", "x2", "y2"), 
            drop = FALSE])
        restCols <- setdiff(colnames(box), c("x1", "x2", "y1", 
            "y2", "cx1", "cx2", "cy1", "cy2", "textX", "textY"))
        tags <- sapply(restCols, function(x) {
            tmp <- as.character(box[, x])
                box$textY <- box$textY - (vadjust/2)
                bartext$y <- bartext$y - labelSpace
                box$cy1 <- bs + ((box$cy1%%1 - avSpace) * sfac) + 
                  avSpace
                box$cy2 <- bs + ((box$cy2%%1 - avSpace) * sfac) + 
                  avSpace
            }
            else {
                bar$y <- bar$y + (vadjust/2)
                box$textY <- box$textY + (vadjust/2)
                bartext$y <- bartext$y + labelSpace
                box$cy1 <- bs + ((box$cy1%%1 - avSpace) * sfac) + 
                  avSpace + vadjust
                box$cy2 <- bs + ((box$cy2%%1 - avSpace) * sfac) + 
                  avSpace + vadjust
            }
        }
        if (nrow(bar) > 0) 
            .arrowBar(bar$sx1, bar$sx2, y = bar$y, bar$strand, 
                box[, 1:4, drop = FALSE], W = .dpOrDefault(GdObject, 
                  "arrowFeatherWidth", 3), D = .dpOrDefault(GdObject, 
                  "arrowFeatherDistance", 20), col = if (is.null(col.line)) 
                  bar$col
                else rep(col.line, length(bar$col)), lwd = lwd, 
                lty = lty, alpha = alpha, barOnly = (!"smallArrow" %in% 
                  .dpOrDefault(GdObject, "shape", "box") || stacking(GdObject) == 
                  "dense"), diff = res, min.height = .dpOrDefault(GdObject, 
                  "min.height", 3))
        box$col <- if (is.na(border)) 
            box$fill
        else border
        if ("box" %in% shape || ("smallArrow" %in% shape && !("arrow" %in% 
            shape || "ellipse" %in% shape))) {
            .filledBoxes(box, lwd = lwd, lty = lty, alpha = alpha)
        }
        if ("ellipse" %in% shape) {
            ellCoords <- .box2Ellipse(box)
            grid.polygon(x = ellCoords$x1, y = ellCoords$y1, 
                id = ellCoords$id, gp = gpar(col = if (is.na(border)) 
                  box$fill
                else border, fill = box$fill, lwd = lwd, lty = lty, 
                  alpha = alpha), default.units = "native")
        }
        if ("arrow" %in% shape && !"box" %in% shape) {
            .filledArrow(box, lwd = lwd, lty = lty, alpha = alpha, 
                min.width = 4 * res, max.width = .dpOrDefault(GdObject, 
                  "arrowHeadMaxWidth", 40) * res)
        }
        if ("fixedArrow" %in% shape && !"box" %in% shape) {
            .filledArrow(box, lwd = lwd, lty = lty, alpha = alpha, 
                min.width = 4 * res, absoluteWidth = TRUE, W = .dpOrDefault(GdObject, 
                  "arrowHeadWidth", 30) * res)
        }
        if (.dpOrDefault(GdObject, "showFeatureId", FALSE)) 
            grid.text(box$text, box$textX, box$textY, rot = rotation, 
                gp = .fontGp(GdObject, subtype = "item"), default.units = "native", 
                just = c("center", "center"))
        if (drawLabel) {
            grid.text(bartext$txt, bartext$x, bartext$y, rot = rotation.group, 
                gp = .fontGp(GdObject, subtype = "group"), default.units = "native", 
                just = barsAndLab$align)
        }
    }
    popViewport(1)
    im <- if (!is.null(box)) {
        coords <- as.matrix(box[, c("x1", "y1", "x2", "y2"), 
            drop = FALSE])
        restCols <- setdiff(colnames(box), c("x1", "x2", "y1", 
            "y2", "cx1", "cx2", "cy1", "cy2", "textX", "textY"))
        tags <- sapply(restCols, function(x) {
            tmp <- as.character(box[, x])
            names(tmp) <- rownames(coords)
            tmp
        }, simplify = FALSE)
        tags$title <- identifier(GdObject)
        ImageMap(coords = coords, tags = tags)
    }
    else NULL
    imageMap(GdObject) <- im
    return(invisible(GdObject))
}
<environment: namespace:Gviz>
 --- function search by body ---
 ----------- END OF FAILURE REPORT -------------- 
Error in .dpOrDefault(GdObject, ".__hasAnno", FALSE) && !is.null(bartext) &&  : 
  'length(x) = 3 > 1' in coercion to 'logical(1)'
Calls: plotTracks ... drawGD -> drawGD -> callNextMethod -> .nextMethod -> .local
Execution halted
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ... OK
  Running ‘testthat.R’
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in ‘inst/doc’ ... OK
* checking running R code from vignettes ... NONE
  ‘Gviz.Rmd’using ‘UTF-8’... OK
* checking re-building of vignette outputs ... SKIPPED
* DONE
Status: 1 ERROR

See also

You can read about the type of bug in HenrikBengtsson/Wishlist-for-R#48

@ivanek ivanek added the bug Something isn't working label Feb 17, 2020
@ivanek
Copy link
Owner

ivanek commented Feb 17, 2020

Hi @HenrikBengtsson,
I committed a fix also to current release (bioc 3.10, Gviz version 1.30.3). I already fixed that before in devel version (bioc 3.11, Gviz version 1.31.4).
Best, Robert

@ivanek ivanek closed this as completed Feb 17, 2020
@HenrikBengtsson
Copy link
Author

thxs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants