Skip to content

[Bioc-devel] Error in NSBS

2 messages · Krithika Bhuvaneshwar [kb472@georgetown.edu], Hervé Pagès

#
Hello,

I am working on creating a package, and have come across an issue.

I have some R code in the "R" folder that works just fine when I test it.
The code contains a function accepts a GRangesList as input.

I call the function from my Rmarkdown file in the "vignette" folder. When I
test the "code chunk" from the Rmd file, the function works just fine. But
when I try to "knitPDF", it gives this error

Error in NSBS(i, x, exact = exact, upperBoundIsStrict = !allow.append) :
  subscript contains invalid names
Calls: <Anonymous> ... [ -> normalizeSingleBracketSubscript -> NSBS -> NSBS

The code is like this:
data("grl")
run.cin.chr(grl.seg = grl) #grl is the GRangesList input

Any help on how to fix this issue is much appreciated.


This is my session Info.
Session info
-----------------------------------------------------------------------------------------
 setting  value
 version  R version 3.2.2 (2015-08-14)
 system   x86_64, darwin13.4.0
 ui       RStudio (0.99.489)
 language (EN)
 collate  en_US.UTF-8
 tz       America/New_York
 date     2015-12-10

Packages
---------------------------------------------------------------------------------------------
 package                           * version  date       source
 acepack                             1.3-3.3  2014-11-24 CRAN (R 3.2.0)
 affxparser                          1.42.0   2015-10-14 Bioconductor
 affyio                              1.40.0   2015-10-14 Bioconductor
 AnnotationDbi                     * 1.32.2   2015-12-09 Bioconductor
 AnnotationHub                     * 2.2.2    2015-11-08 Bioconductor
 Biobase                           * 2.30.0   2015-10-14 Bioconductor
 BiocGenerics                      * 0.16.1   2015-11-06 Bioconductor
 BiocInstaller                       1.20.1   2015-11-18 Bioconductor
 BiocParallel                        1.4.0    2015-10-14 Bioconductor
 biomaRt                             2.26.1   2015-11-23 Bioconductor
 Biostrings                        * 2.38.2   2015-11-21 Bioconductor
 biovizBase                        * 1.18.0   2015-10-14 Bioconductor
 bit                                 1.1-12   2014-04-09 CRAN (R 3.2.0)
 bitops                              1.0-6    2013-08-17 CRAN (R 3.2.0)
 BSgenome                            1.38.0   2015-10-14 Bioconductor
 caTools                             1.17.1   2014-09-10 CRAN (R 3.2.0)
 CINdex                            * 0.99.4   2015-12-10 Bioconductor
 cluster                             2.0.3    2015-07-21 CRAN (R 3.2.2)
 codetools                           0.2-14   2015-07-15 CRAN (R 3.2.2)
 colorspace                          1.2-6    2015-03-11 CRAN (R 3.2.0)
 DBI                               * 0.3.1    2014-09-24 CRAN (R 3.2.0)
 devtools                          * 1.9.1    2015-09-11 CRAN (R 3.2.0)
 dichromat                           2.0-0    2013-01-24 CRAN (R 3.2.0)
 digest                              0.6.8    2014-12-31 CRAN (R 3.2.0)
 ff                                  2.2-13   2014-04-09 CRAN (R 3.2.0)
 foreach                             1.4.3    2015-10-13 CRAN (R 3.2.0)
 foreign                             0.8-66   2015-08-19 CRAN (R 3.2.0)
 Formula                             1.2-1    2015-04-07 CRAN (R 3.2.0)
 futile.logger                       1.4.1    2015-04-20 CRAN (R 3.2.0)
 futile.options                      1.0.0    2010-04-06 CRAN (R 3.2.0)
 gdata                               2.17.0   2015-07-04 CRAN (R 3.2.0)
 GenomeInfoDb                      * 1.6.1    2015-11-03 Bioconductor
 GenomicAlignments                   1.6.1    2015-10-22 Bioconductor
 GenomicFeatures                   * 1.22.6   2015-12-03 Bioconductor
 GenomicRanges                     * 1.22.1   2015-11-06 Bioconductor
 ggplot2                             1.0.1    2015-03-17 CRAN (R 3.2.0)
 GO.db                             * 3.2.2    2015-11-12 Bioconductor
 gplots                              2.17.0   2015-05-02 CRAN (R 3.2.0)
 graph                               1.48.0   2015-10-14 Bioconductor
 gridExtra                           2.0.0    2015-07-14 CRAN (R 3.2.0)
 gtable                              0.1.2    2012-12-05 CRAN (R 3.2.0)
 gtools                              3.5.0    2015-05-29 CRAN (R 3.2.0)
 Hmisc                               3.17-0   2015-09-21 CRAN (R 3.2.0)
 Homo.sapiens                      * 1.3.1    2015-12-09 Bioconductor
 htmltools                           0.2.6    2014-09-08 CRAN (R 3.2.0)
 httpuv                              1.3.3    2015-08-04 CRAN (R 3.2.0)
 httr                                1.0.0    2015-06-25 CRAN (R 3.2.0)
 interactiveDisplayBase              1.8.0    2015-10-14 Bioconductor
 IRanges                           * 2.4.5    2015-12-08 Bioconductor
 iterators                           1.0.8    2015-10-13 CRAN (R 3.2.0)
 KernSmooth                          2.23-15  2015-06-29 CRAN (R 3.2.2)
 knitr                             * 1.11     2015-08-14 CRAN (R 3.2.2)
 lambda.r                            1.1.7    2015-03-20 CRAN (R 3.2.0)
 lattice                             0.20-33  2015-07-14 CRAN (R 3.2.2)
 latticeExtra                        0.6-26   2013-08-15 CRAN (R 3.2.0)
 magrittr                            1.5      2014-11-22 CRAN (R 3.2.0)
 MASS                                7.3-45   2015-11-10 CRAN (R 3.2.2)
 memoise                             0.2.1    2014-04-22 CRAN (R 3.2.0)
 mime                                0.4      2015-09-03 CRAN (R 3.2.0)
 munsell                             0.4.2    2013-07-11 CRAN (R 3.2.0)
 nnet                                7.3-11   2015-08-30 CRAN (R 3.2.0)
 oligo                             * 1.34.0   2015-10-14 Bioconductor
 oligoClasses                      * 1.32.0   2015-10-14 Bioconductor
 org.Hs.eg.db                      * 3.2.3    2015-12-09 Bioconductor
 OrganismDbi                       * 1.12.0   2015-10-14 Bioconductor
 pd.genomewidesnp.6                * 3.14.1   2015-11-30 Bioconductor
 plyr                                1.8.3    2015-06-12 CRAN (R 3.2.0)
 preprocessCore                      1.32.0   2015-10-14 Bioconductor
 proto                               0.3-10   2012-12-22 CRAN (R 3.2.0)
 R6                                  2.1.1    2015-08-19 CRAN (R 3.2.0)
 RBGL                                1.46.0   2015-10-14 Bioconductor
 RColorBrewer                        1.1-2    2014-12-07 CRAN (R 3.2.0)
 Rcpp                                0.12.2   2015-11-15 CRAN (R 3.2.2)
 RCurl                               1.95-4.7 2015-06-30 CRAN (R 3.2.0)
 reshape2                            1.4.1    2014-12-06 CRAN (R 3.2.0)
 rmarkdown                           0.8.1    2015-10-10 CRAN (R 3.2.2)
 rpart                               4.1-10   2015-06-29 CRAN (R 3.2.2)
 Rsamtools                           1.22.0   2015-10-14 Bioconductor
 RSQLite                           * 1.0.0    2014-10-25 CRAN (R 3.2.0)
 rtracklayer                       * 1.30.1   2015-10-22 Bioconductor
 S4Vectors                         * 0.8.4    2015-12-08 Bioconductor
 scales                              0.3.0    2015-08-25 CRAN (R 3.2.0)
 shiny                               0.12.2   2015-08-05 CRAN (R 3.2.0)
 som                                 0.3-5    2010-04-07 CRAN (R 3.2.0)
 stringi                             1.0-1    2015-10-22 CRAN (R 3.2.0)
 stringr                             1.0.0    2015-04-30 CRAN (R 3.2.0)
 SummarizedExperiment                1.0.1    2015-11-06 Bioconductor
 survival                            2.38-3   2015-07-02 CRAN (R 3.2.2)
 TxDb.Hsapiens.UCSC.hg18.knownGene * 3.2.2    2015-12-09 Bioconductor
 TxDb.Hsapiens.UCSC.hg19.knownGene * 3.2.2    2015-12-09 Bioconductor
 VariantAnnotation                   1.16.4   2015-12-09 Bioconductor
 XML                                 3.98-1.3 2015-06-30 CRAN (R 3.2.0)
 xtable                              1.8-0    2015-11-02 CRAN (R 3.2.0)
 XVector                           * 0.10.0   2015-10-14 Bioconductor
 yaml                                2.1.13   2014-06-12 CRAN (R 3.2.0)
 zlibbioc                            1.16.0   2015-10-14 Bioconductor

Thanks,
--Krithika
#
Hi Krithika,

NSBS() is the internal helper defined in the S4Vectors package that
takes care of checking and normalizing the supplied subscript when
one tries to subset a Vector derivative (e.g. an Rle, Hits, IRanges,
GRanges, GRangesList, etc...). For example:

 > IRanges(1:26, 50, names=letters)[LETTERS]
Error in NSBS(i, x, exact = exact, upperBoundIsStrict = !allow.append) :
   subscript contains invalid names

It's just saying that the subscript 'i' contains names that are not
valid.

So it seems that in your case a subsetting operation that happens
in run.cin.chr() works just fine when you run run.cin.chr()
interactively but not in the context of knitPDF.

It's hard to know why without having more details.

Could you please run R CMD Stangle on your Rmarkdown file? That will
produce a .R file. Then start R and source this .R file with
source("file_produced_by_R_CMD_Stangle.R" , echo=TRUE).
Then please report the full output you get as well as the output of
sessionInfo() (call this after the source() command terminates).
Please use sessionInfo(), not session_info().

Thanks,
H.
On 12/10/2015 09:27 PM, Krithika Bhuvaneshwar [kb472 at georgetown.edu] wrote: