[Bioc-sig-seq] trimLRPatterns: can someone clarify the effects of the "ranges" argument?

Harris A. Jaffee hj at jhu.edu
Sat Dec 4 00:23:30 CET 2010


You are correct.  Your setting of 'ranges' is being ignored by the  
ShortRead
method, as we clearly see from

	showMethods("trimLRPatterns", includeDefs=TRUE)

It sounds like a bug to me unless there is documentation for it,  
which I don't
find, but maybe I don't know where to look.

The workaround for you right now, to get an IRanges value, would be  
to send
trimLRPatterns the sread slot of your ShortRead object, as in

	trimLRPatterns(subject=sread(your_ShortRead_object), ranges=T, other  
params)

But perhaps Martin knows better.

-Harris

On Dec 3, 2010, at 10:16 AM, Lionel (Lee) Brooks 3rd wrote:
> Hello all,
>
> I am using trimLRPatterns to trim adapter sequences from my short  
> read fastq file.  I followed the excellent tutorial at UCRiverside  
> and everything works swimmingly.  My issue is that I do not  
> understand the distinction between objects created with  
> trimLRPatterns(...,ranges=TRUE) and those created with  
> trimLRPatterns(...,ranges=FALSE).
>
> I create my ShortRead object in the following manner:
>
> reads <- readFastq("/path/to/seqandqualities.fastq")
> seqs <- sread(reads) # get sequence list
> qual <- quality(reads) # get quality score list
> qual <- quality(qual) # strip quality score type
> adapter3pr <- "TCGTATGCCGTCTTCTGCTTG"
> adapter5pr <- "CGACAGGTTCAGAGTTCTACAGTCCGACGATC"
>   # This is the adapter sequence to be trimmed from the ends of  
> your reads
> trimCoords <- trimLRPatterns(Rpattern=adapter3pr,  
> Lpattern=adapter5pr, subject=seqs, ranges=T)
>   # Trim sequences looking for a right end and left end pattern
>   # Gets IRanges object with trimmed coordinates
> seqs <- DNAStringSet(seqs, start=start(trimCoords), end=end 
> (trimCoords))
> qual <- BStringSet(qual, start=start(trimCoords), end=end(trimCoords))
>   # Use IRanges coordinates to trim sequences and quality scores
> qual <- SFastqQuality(qual) # reapply quality score type
> trimmed <- ShortReadQ(sread=seqs, quality=qual, id=id(reads))
>
> Now...my confusion arose when I used the same code EXCEPT I used  
> ranges=F in the trimLRPatterns call.  Like this:
>
> trimCoords <- trimLRPatterns(Rpattern=adapter3pr,  
> Lpattern=adapter5pr, subject=seqs, ranges=F)
>
> but upon examing the resulting object:
>
> atrributes(trimCoords)
>
> I can see no difference between the object that I created when  
> ranges=T.  Can anyone tell me what is happening here?  I wish to  
> extract the match coordinates from the trimCoords object.
>
> Please Note I adapted this code from:
> http://manuals.bioinformatics.ucr.edu/home/ht-seq#TOC-SmallRNA- 
> Profiling
>
> Appreciatively,
> Lee Brooks
>
> _______________________________________________
> Bioc-sig-sequencing mailing list
> Bioc-sig-sequencing at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing



More information about the Bioc-sig-sequencing mailing list