[BioC] GRanges Constructor With seqlengths

Dario Strbenac D.Strbenac at garvan.org.au
Wed May 30 12:00:37 CEST 2012


Hi,

I'm having problems using the seqlengths parameter. Suggestions ?

> head(x)
    chr position
1 chr12 13352230
2 chr11 66387388
3 chr16 54958470
4 chr16 54901876
5 chr11 66386240
6 chr16 54925044
                                                          sequence
1               CAGAGACCAGATTAGGCCCATCAAGTTCCCAGCCTTGTCAGTGGGCTTCA
2           AGATAGGAGAACTTGTTTTTCTGGATTCACTTAACTTTGTTACTGGAGGACTTG
3 TCTTTCTCATAGCTTTTCTTACCTGCCTATATTCAGCAGCCTCTATTTGATGAGAAATGACAAG
4  AGTATTAAACAAGAATGCACGTAAAGTGTGCAATGCATATAGCAGACAGTCAAGAAATGGTGT
5               CAAACATCTGAAGGGACAGTCTCCCTGGAACTCAGGCTTCTTGCTGGCTT
6             AGGAAAGTTTCCCAGGTTTCATTACATGTTTTCACGATTTAGCTTAAATGTT

> seqlengths(Hsapiens)[unique(x$chr)]
     chr4      chr3      chr7      chr8     chr15     chr18     chr10      chr5 
191154276 198022430 159138663 146364022 102531392  78077248 135534747 180915260 
    chr17     chr11      chr2     chr20     chr21      chr6     chr19      chrX 
 81195210 135006516 243199373  63025520  48129895 171115067  59128983 155270560 
    chr22      chr1     chr16     chr12      chr9     chr14     chr13 
 51304566 249250621  90354753 133851895 141213431 107349540 115169878

> GRanges(x$chr, IRanges(x$position, width=1), seqlengths=seqlengths(Hsapiens)[unique(x$chr)])
Error in validObject(.Object) : 
  invalid class âGRangesâobject: 'seqnames' contains missing values
> GRanges(x$chr, IRanges(x$position, width=1))
GRanges with 59335 ranges and 0 elementMetadata cols:
          seqnames                 ranges strand
             <Rle>              <IRanges>  <Rle>
      [1]    chr12   [13352230, 13352230]      *
      [2]    chr11   [66387388, 66387388]      *
      [3]    chr16   [54958470, 54958470]      *
      [4]    chr16   [54901876, 54901876]      *
      [5]    chr11   [66386240, 66386240]      *
      [6]    chr16   [54925044, 54925044]      *
      [7]    chr12   [88888128, 88888128]      *
      [8]    chr11   [ 1075886,  1075886]      *
      [9]    chr16   [54893488, 54893488]      *
      ...      ...                    ...    ...
  [59327]     chr8 [ 82392570,  82392570]      *
  [59328]     chr3 [195474810, 195474810]      *
  [59329]     chr1 [ 77335014,  77335014]      *
  [59330]     chr4 [141674200, 141674200]      *
  [59331]     chr5 [176021996, 176021996]      *
  [59332]    chr16 [ 54931950,  54931950]      *
  [59333]    chr16 [ 54960706,  54960706]      *
  [59334]     chr5 [150321696, 150321696]      *
  [59335]    chr19 [ 33791323,  33791323]      *
  ---
  seqlengths:
    chr1 chr10 chr11 chr12 chr14 chr15 ...  chr6  chr7  chr8  chr9  chrX  chrY
      NA    NA    NA    NA    NA    NA ...    NA    NA    NA    NA    NA    NA

> sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: x86_64-unknown-linux-gnu (64-bit)

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

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

other attached packages:
[1] BSgenome.Hsapiens.UCSC.hg19_1.3.17 BSgenome_1.24.0                   
[3] Biostrings_2.24.1                  GenomicRanges_1.8.6               
[5] IRanges_1.14.2                     BiocGenerics_0.2.0                

loaded via a namespace (and not attached):
[1] stats4_2.15.0



More information about the Bioconductor mailing list