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
You were right! I had to reinstall R. but it did the trick! Thank you for your help