"Error in NSBS - subscript contains NAs or out-of-bounds indices" for bumphunter `matchGenes`
0
0
Entering edit mode
@jonbarenboim-12542
Last seen 7.1 years ago

I am using bumphunters' matchGenes function to annotate some genomic data, and am getting this error when some regions cannot be mapped with `nearest`

Error in NSBS(i, x, exact = exact, upperBoundIsStrict = !allow.append) : 
  subscript contains NAs or out-of-bounds indices

The code I am running is below:

>library(GenomicFeatures)

>library(bumphunter)

>dmrs <- read.csv(path/to/file)

>library(TxDb.Hsapiens.UCSC.hg19.knownGene)

>txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene

>annotations <- annotateTranscripts(txdb)

>matched <- matchGenes(dmrs, annotations)

Error in NSBS(i, x, exact = exact, upperBoundIsStrict = !allow.append) : 
  subscript contains NAs or out-of-bounds indices
9: stop("subscript contains NAs or out-of-bounds indices")
8: NSBS(i, x, exact = exact, upperBoundIsStrict = !allow.append)
7: NSBS(i, x, exact = exact, upperBoundIsStrict = !allow.append)
6: normalizeSingleBracketSubscript(i, x)
5: extractROWS(x, i)
4: extractROWS(x, i)
3: subject[i, ]
2: subject[i, ]
1: matchGenes(dmrs, annotations)

The error only occurs when `nearest` fails to map some regions

> map <- nearest(makeGRangesFromDataFrame(dmrs), annotations)

> which(is.na(map))[1:10]
[1]  729 1379 1624 1927 1973 1986 1987 2031 2099 2111

> a <- matchGenes(dmrs[700:725,], annotations)

> b <- matchGenes(dmrs[725:730,], annotations)
Error in NSBS(i, x, exact = exact, upperBoundIsStrict = !allow.append) :
  subscript contains NAs or out-of-bounds indices
9: stop("subscript contains NAs or out-of-bounds indices")
8: NSBS(i, x, exact = exact, upperBoundIsStrict = !allow.append)
7: NSBS(i, x, exact = exact, upperBoundIsStrict = !allow.append)
6: normalizeSingleBracketSubscript(i, x)
5: extractROWS(x, i)
4: extractROWS(x, i)
3: subject[i, ]
2: subject[i, ]
1: matchGenes(dmrs[725:730, ], annotations)

The error disappears when the first line of the for loop in matchGenes is changed from

 i <- map[ind][j]

to 

i <- map[j] 

dmrs is a dataframe of regions obtained from bumphunterEngine. The first line is

> dmrs[1,]
    chr    start      end      value     area cluster indexStart indexEnd  L clusterL      p.value fwer  p.valueArea fwerArea
1 chr19 48945971 48947362 -0.5952619 19.64364   30722     467311   467396 86       98 1.804523e-06  0.1 1.804523e-06      0.1

(The relevant part of) my session info is:

R version 3.2.3 (2015-12-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS release 6.8 (Final)

other attached packages:
 [1] org.Hs.eg.db_3.2.3                      RSQLite_1.0.0                           DBI_0.3.1                              
 [4] TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2 bumphunter_1.10.0                       locfit_1.5-9.1                         
 [7] iterators_1.0.8                         foreach_1.4.3                           GenomicFeatures_1.22.13                
[10] AnnotationDbi_1.32.3                    Biobase_2.30.0                          GenomicRanges_1.22.4                   
[13] GenomeInfoDb_1.6.3                      IRanges_2.4.8                           S4Vectors_0.8.11                       
[16] BiocGenerics_0.16.1                    

 

bumphunter • 1.6k views
ADD COMMENT
0
Entering edit mode

Hi,

You seem to be using Bioconductor 3.2 which is not supported anymore. Please update your installation to use the current version of Bioconductor (BioC 3.4).  It requires R 3.3 which is also the most current release of R.

Thanks,

H.

ADD REPLY

Login before adding your answer.

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