Error in BSGenome "getSeq" function
1
0
Entering edit mode
pm16057 • 0
@pm16057-12148
Last seen 8.0 years ago

Hi all,

 

I have been experiencing some difficulties with the "getSeq" function from BSgenome. I have used this functions many times in the past and it has always worked fine but now I keep getting the same error. I have a feeling that something has changed in the package but even after going through gitHub and having a look at the source code I can't seem to locate the error.

 

Thank you in advance for your help

DNASequence<-getSeq(BSgenome.Dmelanogaster.UCSC.dm6)
Error in base::which(x, arr.ind, useNames, ...) :
  argument to 'which' is not logical

After traceback()

11: base::which(x, arr.ind, useNames, ...)
10: which(strand == "-")
9: which(strand == "-")
8: loadSubseqsFromStrandedSequence(x@single_sequences, seqname,
       ranges(gr), strand(gr), is_circular)
7: FUN(X[[i]], ...)
6: lapply(seq_len(length(grl)), function(i) {
       gr <- grl[[i]]
       if (length(gr) == 0L)
           return(DNAStringSet())
       seqlevel <- grl_seqlevels[i]
       is_circular <- isCircular(x)[[seqlevel]]
       idx <- match(seqlevel, x@user_seqnames)
       if (is.na(idx))
           stop("invalid sequence name: ", seqlevel)
       seqname <- names(x@user_seqnames)[[idx]]
       if (is.null(snplocs(x, seqname))) {
           subject <- try(get(seqname, envir = x@.seqs_cache, inherits = FALSE),
               silent = TRUE)
           if (is(subject, "try-error")) {
               ans <- loadSubseqsFromStrandedSequence(x@single_sequences,
                   seqname, ranges(gr), strand(gr), is_circular)
               return(ans)
           }
           .linkToCachedObject(subject) <- .newLinkToCachedObject(seqname,
               x@.seqs_cache, x@.link_counts)
       }
       else {
           subject <- x[[seqlevel]]
       }
       masks(subject) <- NULL
       loadSubseqsFromStrandedSequence(subject, seqlevel, ranges(gr),
           strand(gr), is_circular)
   })
5: lapply(seq_len(length(grl)), function(i) {
       gr <- grl[[i]]
       if (length(gr) == 0L)
           return(DNAStringSet())
       seqlevel <- grl_seqlevels[i]
       is_circular <- isCircular(x)[[seqlevel]]
       idx <- match(seqlevel, x@user_seqnames)
       if (is.na(idx))
           stop("invalid sequence name: ", seqlevel)
       seqname <- names(x@user_seqnames)[[idx]]
       if (is.null(snplocs(x, seqname))) {
           subject <- try(get(seqname, envir = x@.seqs_cache, inherits = FALSE),
               silent = TRUE)
           if (is(subject, "try-error")) {
               ans <- loadSubseqsFromStrandedSequence(x@single_sequences,
                   seqname, ranges(gr), strand(gr), is_circular)
               return(ans)
           }
           .linkToCachedObject(subject) <- .newLinkToCachedObject(seqname,
               x@.seqs_cache, x@.link_counts)
       }
       else {
           subject <- x[[seqlevel]]
       }
       masks(subject) <- NULL
       loadSubseqsFromStrandedSequence(subject, seqlevel, ranges(gr),
           strand(gr), is_circular)
   })
4: .extractFromBSgenomeSingleSequences(x, sseq_args$names, sseq_args$start,
       sseq_args$end, sseq_args$width, sseq_args$strand)
3: .local(x, ...)
2: getSeq(BSgenome.Dmelanogaster.UCSC.dm6)
1: getSeq(BSgenome.Dmelanogaster.UCSC.dm6)

And SessionInfo()

sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

locale:
[1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C             
[3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8   
[5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8  
[7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                
[9] LC_ADDRESS=C               LC_TELEPHONE=C           
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] BSgenome.Dmelanogaster.UCSC.dm6_1.4.1 BSgenome_1.42.0                     
[3] rtracklayer_1.34.1                    Biostrings_2.42.1                   
[5] XVector_0.14.0                        GenomicRanges_1.26.2                
[7] GenomeInfoDb_1.10.2                   IRanges_2.8.1                       
[9] S4Vectors_0.12.1                      BiocGenerics_0.20.0                 
[11] BiocInstaller_1.24.0                 

loaded via a namespace (and not attached):
[1] lattice_0.20-34            XML_3.98-1.5             
[3] Rsamtools_1.26.1           GenomicAlignments_1.10.0 
[5] bitops_1.0-6               grid_3.3.2               
[7] zlibbioc_1.20.0            Matrix_1.2-7.1           
[9] BiocParallel_1.8.1         tools_3.3.2              
[11] Biobase_2.34.0             RCurl_1.95-4.8           
[13] SummarizedExperiment_1.4.0

 

R bsgenome getseq • 1.6k views
ADD COMMENT
1
Entering edit mode
@james-w-macdonald-5106
Last seen 5 days ago
United States

It looks like it might be something local to your installation.

> dnaseq <- getSeq(BSgenome.Dmelanogaster.UCSC.dm6)
> dnaseq
  A DNAStringSet instance of length 1870
          width seq                                         names               
   [1] 23513712 CGACAATGCACGACAGAGGA...GAACAGAGAACAGAGAAGAG chr2L
   [2] 25286936 CTCAAGATACCTTCTACAGA...TACGGAAACAGAATGAATTC chr2R
   [3] 28110227 TAGGGAGAAATATGATCGCG...GTTATTCCATGTTATTCTAT chr3L
   [4] 32079331 ACGGGACCGAGTATAGTACC...TGTTCGCATTCTAGGAATTC chr3R
   [5]  1348131 TTATTATATTATTATATTAT...GTCGATTTGAGATATATGAA chr4
   ...      ... ...
[1866]     1003 ATGCAGAGCTTGCATGCCTG...ATATACATATATACATATAT chrUn_DS485998v1
[1867]     1001 TCAAAAAAAGTTGAAAGCAA...AAAAGCCAGATGCATCGGGA chrUn_DS486002v1
[1868]     1001 AGCACGACGCGACTGCGTTA...TCCGTAACTAACAAAGACCG chrUn_DS486004v1
[1869]     1001 TATACATATATACATATATA...CATATATACGGATATACATA chrUn_DS486005v1
[1870]     1001 CAGGACTCACCAGCGCTCGG...CGACCAACTGAGCGTACCAG chrUn_DS486008v1
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 14393)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
 [1] BSgenome.Dmelanogaster.UCSC.dm6_1.4.1 BSgenome_1.42.0                      
 [3] rtracklayer_1.34.1                    Biostrings_2.42.1                    
 [5] XVector_0.14.0                        GenomicRanges_1.26.1                 
 [7] GenomeInfoDb_1.10.1                   IRanges_2.8.1                        
 [9] S4Vectors_0.12.0                      BiocGenerics_0.20.0                  
[11] BiocInstaller_1.24.0                 

loaded via a namespace (and not attached):
 [1] lattice_0.20-34            XML_3.98-1.5              
 [3] Rsamtools_1.26.1           GenomicAlignments_1.10.0  
 [5] bitops_1.0-6               grid_3.3.2                
 [7] zlibbioc_1.20.0            Matrix_1.2-7.1            
 [9] BiocParallel_1.8.1         tools_3.3.2               
[11] Biobase_2.34.0             RCurl_1.95-4.8            
[13] compiler_3.3.2             SummarizedExperiment_1.4.0

You may be able to track this down by re-installing packages, starting with the BSgenome.Dmelanogaster.UCSC.dm6 package. It may be that some of the data in that package got corrupted when you installed it.

ADD COMMENT
0
Entering edit mode

You were right! I had to reinstall R. but it did the trick! Thank you for your help

ADD REPLY

Login before adding your answer.

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