GRangesList filtering
1
0
Entering edit mode
@halian-vilela-4954
Last seen 9.7 years ago
Hey guys, I would like to know if there are any methods of efficiently subset a GRangeList by it seqnames. I have something like this: GRangesList of length 86046: $1 GRanges with 27 ranges and 3 elementMetadata values: seqnames ranges strand | exon_id exon_name exon_rank <rle> <iranges> <rle> | <integer> <character> <integer> [1] chr1 [66999065, 66999090] + | 1 <na> 1 [2] chr1 [66999928, 67000051] + | 2 <na> 2 [3] chr1 [67091529, 67091593] + | 3 <na> 3 [4] chr1 [67098752, 67098777] + | 4 <na> 4 [5] chr1 [67099762, 67099846] + | 5 <na> 5 [6] chr1 [67105459, 67105516] + | 6 <na> 6 [7] chr1 [67108492, 67108547] + | 7 <na> 7 [8] chr1 [67109226, 67109402] + | 8 <na> 8 [9] chr1 [67126195, 67126207] + | 9 <na> 9 ... ... ... ... ... ... ... ... In which each element ($1,$2,$3,...) represents a transcript and it set of exons... In the seqnames colum I have the chromosomes ranging from 1 to Y (all 24 human cromosomes), what I would like to know is how to get just the elements accounting for chromosome 14... I have made successfully by unlisting the structure into a huge normal GRange and then subseting normally: ex <- unlist(ex_tx) ex14 <- ex[which(seqnames(ex) == "chr14")] But obviously I lose the GRangesList structure. So are there any way to subset this directly in the GRangesList without the need to unlist, in a way that my result is also a GRangesList ? Thanks, Halian [[alternative HTML version deleted]]
• 5.5k views
ADD COMMENT
0
Entering edit mode
@valerie-obenchain-4275
Last seen 2.3 years ago
United States
Hi Halian, gr1 <- GRanges(seqnames = "chr2", ranges = IRanges(3, 6)) gr2 <- GRanges(seqnames = c("chr1", "chr1"), ranges = IRanges(c(7,13), width = 3)) gr3 <- GRanges(seqnames = c("chr1", "chr2"), ranges = IRanges(c(1, 4), c(3, 9))) grl <- GRangesList("gr1" = gr1, "gr2" = gr2, "gr3" = gr3) grl[seqnames(grl) == "chr2"] Valerie On 05/01/2012 07:26 AM, Halian Vilela wrote: > Hey guys, > > I would like to know if there are any methods of efficiently subset a > GRangeList by it seqnames. > > I have something like this: > > > GRangesList of length 86046: > $1 > GRanges with 27 ranges and 3 elementMetadata values: > seqnames ranges strand | exon_id exon_name exon_rank > <rle> <iranges> <rle> |<integer> <character> <integer> > [1] chr1 [66999065, 66999090] + | 1<na> 1 > [2] chr1 [66999928, 67000051] + | 2<na> 2 > [3] chr1 [67091529, 67091593] + | 3<na> 3 > [4] chr1 [67098752, 67098777] + | 4<na> 4 > [5] chr1 [67099762, 67099846] + | 5<na> 5 > [6] chr1 [67105459, 67105516] + | 6<na> 6 > [7] chr1 [67108492, 67108547] + | 7<na> 7 > [8] chr1 [67109226, 67109402] + | 8<na> 8 > [9] chr1 [67126195, 67126207] + | 9<na> 9 > ... ... ... ... ... ... ... ... > > > > In which each element ($1,$2,$3,...) represents a transcript and it > set of exons... > > In the seqnames colum I have the chromosomes ranging from 1 to Y (all > 24 human cromosomes), what I would like to know is how to get just the > elements accounting for chromosome 14... > > I have made successfully by unlisting the structure into a huge normal > GRange and then subseting normally: > > ex<- unlist(ex_tx) > ex14<- ex[which(seqnames(ex) == "chr14")] > > > But obviously I lose the GRangesList structure. So are there any way > to subset this directly in the GRangesList without the need to unlist, > in a way that my result is also a GRangesList ? > > Thanks, > Halian > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD COMMENT
0
Entering edit mode
ccing Halian On 05/01/2012 08:20 AM, Valerie Obenchain wrote: > Hi Halian, > > gr1 <- GRanges(seqnames = "chr2", ranges = IRanges(3, 6)) > gr2 <- GRanges(seqnames = c("chr1", "chr1"), ranges = > IRanges(c(7,13), width = 3)) > gr3 <- GRanges(seqnames = c("chr1", "chr2"), ranges = IRanges(c(1, > 4), c(3, 9))) > grl <- GRangesList("gr1" = gr1, "gr2" = gr2, "gr3" = gr3) > > grl[seqnames(grl) == "chr2"] > > Valerie > > > On 05/01/2012 07:26 AM, Halian Vilela wrote: >> Hey guys, >> >> I would like to know if there are any methods of efficiently subset a >> GRangeList by it seqnames. >> >> I have something like this: >> >> >> GRangesList of length 86046: >> $1 >> GRanges with 27 ranges and 3 elementMetadata values: >> seqnames ranges strand | exon_id >> exon_name exon_rank >> <rle> <iranges> <rle> |<integer> <character> <integer> >> [1] chr1 [66999065, 66999090] + | >> 1<na> 1 >> [2] chr1 [66999928, 67000051] + | >> 2<na> 2 >> [3] chr1 [67091529, 67091593] + | >> 3<na> 3 >> [4] chr1 [67098752, 67098777] + | >> 4<na> 4 >> [5] chr1 [67099762, 67099846] + | >> 5<na> 5 >> [6] chr1 [67105459, 67105516] + | >> 6<na> 6 >> [7] chr1 [67108492, 67108547] + | >> 7<na> 7 >> [8] chr1 [67109226, 67109402] + | >> 8<na> 8 >> [9] chr1 [67126195, 67126207] + | >> 9<na> 9 >> ... ... ... ... ... ... >> ... ... >> >> >> >> In which each element ($1,$2,$3,...) represents a transcript and it >> set of exons... >> >> In the seqnames colum I have the chromosomes ranging from 1 to Y (all >> 24 human cromosomes), what I would like to know is how to get just the >> elements accounting for chromosome 14... >> >> I have made successfully by unlisting the structure into a huge normal >> GRange and then subseting normally: >> >> ex<- unlist(ex_tx) >> ex14<- ex[which(seqnames(ex) == "chr14")] >> >> >> But obviously I lose the GRangesList structure. So are there any way >> to subset this directly in the GRangesList without the need to unlist, >> in a way that my result is also a GRangesList ? >> >> Thanks, >> Halian >> >> [[alternative HTML version deleted]] >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor at r-project.org >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: >> http://news.gmane.org/gmane.science.biology.informatics.conductor >
ADD REPLY

Login before adding your answer.

Traffic: 616 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6