[BioC] find differences between two sets of ranges

Martin Morgan mtmorgan at fhcrc.org
Mon Jul 4 16:11:32 CEST 2011


On 07/04/2011 05:58 AM, Andreia Fonseca wrote:
> Hi Michael,
>
> thanks for the reply but I already tried to do setdiff and I get this
> message,
>
> Error in as.vector(x) : no method for coercing this S4 class to a vector
>
> My reads are not all of the same length, the read length varies from 18 to
> 26 bp, these are from a small RNA seq experiment.

Hi Andreia -- it might help to provide a more explicit example, with a 
couple of ranges illustrating each of the data structures you're working 
with. Martin

>
> Thanks for the help.
> Kind regards,
> Andreia
>
> On Mon, Jul 4, 2011 at 12:24 AM, Michael Lawrence<lawrence.michael at gene.com
>> wrote:
>
>>
>>
>> On Sat, Jul 2, 2011 at 10:41 PM, Andreia Fonseca<
>> andreia.fonseca at gmail.com>  wrote:
>>
>>> Dear all,
>>>
>>> I have a range list which I have created like this:
>>>
>>> aln<-readAligned("GHO-23_filtered.fastq_aligned", type="Bowtie")
>>> cvg = coverage(aln)
>>> islands<- slice(cov, lower = 1)
>>> ranges_islands<-slice(cvg, 1, rangesOnly=TRUE)
>>>
>>> And then I have a GRange object which I have imported
>>>
>>> genes=import.gff3("Egrandis_162_gene.gff3", asRangedData=FALSE)
>>>
>>> I want to select the ranges in ranges_islands which do not overlap with
>>> genes into object final_ranges and then I want to select the reads from
>>> aln
>>> which are within or overlapping>50%  with object final_ranges.
>>>
>>>
>> If your reads are of a fixed length, then something like this should work:
>>
>> final_ranges<- setdiff(ranges_islands, genes)
>> final_aln<- aln[!is.na(findOverlaps(as(aln, "GRanges"), final_ranges,
>> select = "first", minoverlap = halfReadLength))]
>>
>> Michael
>>
>>
>>
>>> I also would like to export the object final_ranges to a table chr, start,
>>> end.
>>>
>>> Can someone help?
>>> Thanks
>>> Andreia
>>>
>>>
>>> -----------------------------------------------------------------------------------------------
>>> Andreia J. Amaral, PhD
>>> BioFIG - Center for Biodiversity, Functional and Integrative Genomics
>>> Instituto de Medicina Molecular
>>> University of Lisbon
>>> Tel: +352 217500000 (ext. office: 28253)
>>> email:andreiaamaral at fm.ul.pt ; andreiaamaral at fc.ul.pt
>>>
>>>         [[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
>>>
>>
>>
>
>


-- 
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

Location: M1-B861
Telephone: 206 667-2793



More information about the Bioconductor mailing list