[Bioc-sig-seq] trimLRPatterns - adaptor trimming

Martin Morgan mtmorgan at fhcrc.org
Wed Aug 18 00:25:38 CEST 2010


On 08/17/2010 02:55 PM, Steve Lianoglou wrote:
> Hi Jess,
> 
> On Tue, Aug 17, 2010 at 5:15 PM, JASREET HUNDAL <jasreeth at gmail.com> wrote:
>> Hi Martin & Harris
>>
>> It looks like the bioconductor packages that I am using are updated:
> ...
>> Also, this is error  I get while exporting to fasta file:
>>>  fa <-sread(trimmed)
>> Error in slot(object, "sread") :
>>  no slot of name "sread" for this object of class "DNAStringSet"

My bad. The script Jess mention says

  trimmed <- trimLRPatterns(pcrPrimer, subject=sread(seq))

and then trimmed is a DNAStringSet (try class(trimmed)), and writeFastq
doesn't make sense. With

  trimmed <- trimLRPatterns(pcrPrimer, subject=seq)

it's a ShortReadQ (i.e., including quality) and writeFastq(trimmed,
"/path/to/file") should work. Explanations Steve offers below still
apply  to th DNAStringSet.

Martin

> 
> The "sread" method is used to get the *reads* (which would be a
> DNAStringSet object ) out of a ShortRead* object. The ShortRead* class
> stores the reads, as well as other information about the reads (phred
> scores, etc.)
> 
> It looks like your "trimmed" object is already a DNAStringSet -- so
> calling sread() on a DNAStringSet isn't really meaningful ... you
> would just get itself.
> 
> In short, the "trimmed" object you have appears to the the
> DNAStringSet you are looking to get by using the "sread" function.
> 
>> And while exporting using writeFastq:
>>
>>>  writeFastq(trimmed,"trimmedseqs")
>> Error in function (classes, fdef, mtable)  :
>>  unable to find an inherited method for function "writeFastq", for
>> signature "DNAStringSet"
>>
>> It would be great if you could suggest some other method to export the
>> trimmed object.
> 
> Here you have the opposite problem.
> 
> You "just" have a DNAStringSet -- no other metadata about your reads
> that a ShortRead* class holds, like phred scores, etc.
> 
> The writeFastq file expects to write your object as a FASTQ file.
> 
> If you have a DNAStringSet (which is what your "trimmed" object is),
> you can only really hope to write a FASTA file, in which case you can
> use the "writeFASTA" function (or the write.XStringSet function that
> Martin suggested) from the Biostrings package (which is already
> loaded).
> 
> Does that make sense?
> 
> So again (in summary (?)):
> the problem you are having is that you think that your "trimmed"
> object is something it's not.
> 
> I'm not sure how you got it, or where it came from, but it is "just" a
> DNAStringSEt -- which is simply a number of sequences (reads).
> 
> You can't write it as a fastq file (with writeFastq), and there's no
> need to get the "reads" out of it (with the sread function) because
> that's what they already are.
> 
> Hope that helps,
> 


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

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the Bioc-sig-sequencing mailing list