[BioC] sort error in GRange

emily [guest] guest at bioconductor.org
Tue Apr 30 20:37:11 CEST 2013


I have chip-seq data, and I would like to use GenomicRanges to count the overlap peaks. The files for the input are BED format generated from the peak calling. I used apply() function to generate bedlist, then I want to combine all those separate GRanges objects, each representing a single bed file, into a single big GRange object. I used do.call() function, then I would like to sort the chromosome location using sort() function, but it gave me an error as below.
> allorigins=sort(allorigins)
Error in x[!nas] : selecting spaces: subscript out of bounds

Could you please help me to fix this?

Thanks,
emily

 -- output of sessionInfo(): 

> names(bedlist)=NULL
> allorigins=do.call(c, bedlist)
> allorigins=sort(allorigins)
Error in x[!nas] : selecting spaces: subscript out of bounds
> allorigins
RangedData with 258508 rows and 1 value column across 240 spaces
          space                 ranges   |        name
       <factor>              <IRanges>   | <character>
1          chr1     [ 564401,  570399]   |        2726
2          chr1     [ 756001,  758799]   |          76
3          chr1     [ 811201,  811799]   |          34
4          chr1     [ 821801,  826199]   |          43
5          chr1     [ 834801,  921999]   |        2607
6          chr1     [ 928201,  942399]   |         349
7          chr1     [ 944601,  951799]   |          82
8          chr1     [ 955801, 1011599]   |        2015
9          chr1     [1014001, 1029199]   |         577
...         ...                    ... ...         ...
258500     chrX [153877201, 153891999]   |        1427
258501     chrX [153955401, 153965999]   |         806
258502     chrX [154002201, 154014399]   |        1066
258503     chrY [  9943601,   9944799]   |         202
258504     chrY [  9960801,   9968199]   |         578
258505     chrY [  9978601,   9990199]   |        1543
258506     chrY [ 10005401,  10010399]   |         502
258507     chrY [ 13458601,  13490199]   |       12809
258508     chrY [ 59012201,  59020799]   |         902
Warning messages:
1: In `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels) else paste(labels,  :
  duplicated levels will not be allowed in factors anymore
2: In `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels) else paste(labels,  :
  duplicated levels will not be allowed in factors anymore
> dim(allorigins)
[1] 258508      1
> allorigins[1:5,]
RangedData with 5 rows and 1 value column across 240 spaces
     space           ranges |        name
  <factor>        <IRanges> | <character>
1     chr1 [564401, 570399] |        2726
2     chr1 [756001, 758799] |          76
3     chr1 [811201, 811799] |          34
4     chr1 [821801, 826199] |          43
5     chr1 [834801, 921999] |        2607
Warning message:
In `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels) else paste(labels,  :
  duplicated levels will not be allowed in factors anymore


--
Sent via the guest posting facility at bioconductor.org.



More information about the Bioconductor mailing list