Question: Error in GRanges strand input
gravatar for
2.3 years ago by
prabin.dm0 wrote:

I am trying to make a Granges object with a list of genes that I have downloaded from MGI.

This is the column with strand info > mm9genes$X.3 gives me Levels: - +

However, when I use this code..

GRanges(seqnames = Rle("chr12", 322),
               ranges = IRanges(start = mm9genes$X, end = mm9genes$X.1),
               strand = Rle(mm9genes$X.3),
               symbol = mm9genes$X.2)`

I get error Error in .local(x, ...) : invalid strand levels in 'x': - , + I am pretty new to this and trying to learn from. Will appreciate any help.

R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] GenomicRanges_1.18.4 GenomeInfoDb_1.2.5   IRanges_2.0.1       
[4] S4Vectors_0.4.0      BiocGenerics_0.12.1  BiocInstaller_1.16.5

loaded via a namespace (and not attached):
 [1] bitops_1.0-6    digest_0.6.9    httr_1.1.0      magrittr_1.5   
 [5] RCurl_1.95-4.8  stringi_1.0-1   stringr_1.0.0   swirl_2.2.21   
 [9] testthat_0.11.0 tools_3.1.2     XVector_0.6.0   yaml_2.1.13    
granges tutorial • 672 views
ADD COMMENTlink modified 2.3 years ago by Martin Morgan ♦♦ 23k • written 2.3 years ago by prabin.dm0


This post is a question, not a Tutorial. Please ask again as a question i.e. make sure to set Post Type to Question (which is the default). Also provide a reproducible example and the output of your sessionInfo().



ADD REPLYlink written 2.3 years ago by Hervé Pagès ♦♦ 14k
Answer: Error in GRanges strand input
gravatar for Martin Morgan
2.3 years ago by
Martin Morgan ♦♦ 23k
United States
Martin Morgan ♦♦ 23k wrote:

(Although you're 'new' to this, your R and Bioconductor are very old! Consider updating!). I'm guessing that the software is complaining about the order or completeness of levels, which have I believe always been expected to be

> strand()
Levels: + - *

whereas your levels are reversed and missing the "*". I think the current software is smart enough to re-level your factor, and the old software would work if you coerced your levels to a character vector

strand = as.character(mm9genes$X.3)


ADD COMMENTlink written 2.3 years ago by Martin Morgan ♦♦ 23k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 257 users visited in the last hour