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

Lionel (Lee) Brooks 3rd Lionel.Brooks at dartmouth.edu
Fri Dec 3 16:16:24 CET 2010


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



More information about the Bioc-sig-sequencing mailing list