Entering edit mode
                    Hello!
When I run nearestTSS() from edgeR, it fails saying
> TSS <- nearestTSS(yall$genes$Chr, yall$genes$Locus, species="Hs")
Error in Out$distance[Out$neg] <- -Out$distance[Out$neg] : 
  NAs are not allowed in subscripted assignments
Here is the full code.
    R version 3.5.0 (2018-04-23) -- "Joy in Playing"
    Copyright (C) 2018 The R Foundation for Statistical Computing
    Platform: x86_64-pc-linux-gnu (64-bit)
    R is free software and comes with ABSOLUTELY NO WARRANTY.
    You are welcome to redistribute it under certain conditions.
    Type 'license()' or 'licence()' for distribution details.
      Natural language support but running in an English locale
    R is a collaborative project with many contributors.
    Type 'contributors()' for more information and
    'citation()' on how to cite R or R packages in publications.
    Type 'demo()' for some demos, 'help()' for on-line help, or
    'help.start()' for an HTML browser interface to help.
    Type 'q()' to quit R.
    > library(edgeR)
    Loading required package: limma
    > targets <- c("SRR097807_1_trimmed_bismark_bt2.bismark.cov.gz", "SRR097808_1_trimmed_bismark_bt2.bismark.cov.gz", "SRR097809_1_trimmed_bismark_bt2.bismark.cov.gz", "SRR097810_1_trimmed_bismark_bt2.bismark.cov.gz")
> ##read in bismark files
    > yall <- readBismark2DGE(targets, sample.names=targets)
    Reading SRR097807_1_trimmed_bismark_bt2.bismark.cov.gz 
    Reading SRR097808_1_trimmed_bismark_bt2.bismark.cov.gz 
    Reading SRR097809_1_trimmed_bismark_bt2.bismark.cov.gz 
    Reading SRR097810_1_trimmed_bismark_bt2.bismark.cov.gz 
    Hashing ...
    Collating counts ...
    > 
    > ##remove genomic segments that have not been assembled into recognizable chromosomes
    > keep <- rep(TRUE, nrow(yall))
    > Chr <- as.character(yall$genes$Chr)
    > keep[ grep("random",Chr) ] <- FALSE
    > keep[ grep("chrUn",Chr) ] <- FALSE
    > 
    > keep[Chr=="chrY"] <- FALSE
    > keep[Chr=="chrM"] <- FALSE
    > table(keep)
    keep
      FALSE    TRUE 
      17424 5971475 
    > 
    > ## subset DGEList to remove rows corresponding to unwanted chromosomes
    > ## keep.lib.sizes=FALSE cuases the library sizes to be recomputed
    > 
    > yall <- yall[keep,, keep.lib.sizes=FALSE]
    > ChrNames <- paste0("chr",c(1:22,"X"))
    > ChrNames
     [1] "chr1"  "chr2"  "chr3"  "chr4"  "chr5"  "chr6"  "chr7"  "chr8"  "chr9" 
    [10] "chr10" "chr11" "chr12" "chr13" "chr14" "chr15" "chr16" "chr17" "chr18"
    [19] "chr19" "chrX" 
    > yall$genes$Chr <- factor(yall$genes$Chr, levels=ChrNames)
    > o <- order(yall$genes$Chr, yall$genes$Locus)
    > yall <- yall[o,]
    > 
    > TSS <- nearestTSS(yall$genes$Chr, yall$genes$Locus, species="Hs")
    Error in Out$distance[Out$neg] <- -Out$distance[Out$neg] : 
      NAs are not allowed in subscripted assignments
    In addition: Warning message:
    replacing previous import ‘BiocGenerics::dims’ by ‘Biobase::dims’ when loading ‘AnnotationDbi’ 
    > sessionInfo()
    R version 3.5.0 (2018-04-23)
    Platform: x86_64-pc-linux-gnu (64-bit)
    Running under: CentOS Linux 7 (Core)
    Matrix products: default
    BLAS: /opt/apps/r/3.5.0/lib64/R/lib/libRblas.so
    LAPACK: /opt/apps/r/3.5.0/lib64/R/lib/libRlapack.so
    locale:
     [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
     [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
     [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
     [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
     [9] LC_ADDRESS=C               LC_TELEPHONE=C            
    [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
    attached base packages:
    [1] stats     graphics  grDevices utils     datasets  methods   base     
    other attached packages:
    [1] edgeR_3.24.0 limma_3.36.2
    loaded via a namespace (and not attached):
     [1] Rcpp_1.0.0           AnnotationDbi_1.44.0 BiocGenerics_0.28.0 
     [4] hms_0.4.2            IRanges_2.16.0       bit_1.1-14          
     [7] lattice_0.20-35      R6_2.2.2             rlang_0.3.0.1       
    [10] org.Hs.eg.db_3.7.0   blob_1.1.1           tools_3.5.0         
    [13] parallel_3.5.0       grid_3.5.0           Biobase_2.40.0      
    [16] DBI_1.0.0            bit64_0.9-7          digest_0.6.15       
    [19] tibble_1.4.2         readr_1.2.1          S4Vectors_0.20.1    
    [22] memoise_1.1.0        RSQLite_2.1.1        compiler_3.5.0      
    [25] pillar_1.2.3         stats4_3.5.0         locfit_1.5-9.1      
    [28] pkgconfig_2.0.1
What is causing this error? Thank you!
