#### The support.bioconductor.org editor has been updated to markdown! Please see more info at: Tutorial: Updated Support Site Editor

Question: [devteam-bioc] sort error in GRange
0
5.8 years ago by
United States
Valerie Obenchain6.7k wrote:
Hi Emily, We are phasing out the RangedData class for the GRanges class. You can coerce your RangedData to a GRanges and then sort. gr <- as(allorigins, "GRanges") sort(gr) You probably read the BED file in with a function from rtracklayer. In the future you can set 'asRangedData=FALSE' and a GRAnges will be created instead of a RangedData. Let me know if you have trouble sorting the GRanges. Valerie On 04/30/2013 11:37 AM, Maintainer wrote: > > 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. > > ____________________________________________________________________ ____ > devteam-bioc mailing list > To unsubscribe from this mailing list send a blank email to > devteam-bioc-leave at lists.fhcrc.org > You can also unsubscribe or change your personal options at > https://lists.fhcrc.org/mailman/listinfo/devteam-bioc >
rtracklayer genomicranges • 577 views