Question: R: Convert ShortReadQ class to DNAStringSet?
0
gravatar for trodriguez2011
2.3 years ago by
trodriguez20110 wrote:

In processing raw fastq reads, I need to use trimming tools from the Bioconductor ShortRead package, and vcountpattern from Biostrings. It seems impossible to move between the two. I have tried:

  1. writeFastq to export the trimmed data and importing with readDNAStringSet. Error in .Call2("read_XStringSet_from_fastq", filexp_list, nrec, skip, : read_XStringSet_from_fastq(): FASTQ files with variable sequence lengths are not supported yet
  2. DNAStringSet(my trimmed data) Error in as.character.default(x) : no method for coercing this S4 class to a vector
  3. vcountpattern(my trimmed data) Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘vcountPattern’ for signature ‘"ShortReadQ"’
  4. trimLRPatterns(my raw fastq data read as a DNAStringSet) Returns no error, but I have not been able to make this trim my data as does trimTailw from ShortRead.

I realize that there is likely a simple fix, but I am very frustrated that I cannot move between packages. ANy help would be appreciated.

chip-seq R • 1.3k views
ADD COMMENTlink modified 2.2 years ago by Biostar ♦♦ 20 • written 2.3 years ago by trodriguez20110

Did you try your shortread object @sread? it is a dnastringset object. From manual, shortreadQ class contains DNAStringSet, Quality, ShortReadQ objects with in it. class(fq@sread), class(sread(fq)) should give you DNAstringset object (fq being "ShortReadQ" object)

Example code:

fl <- system.file(package="ShortRead", "extdata", "E-MTAB-1147","ERR127302_1_subset.fastq.gz") # example data path- provided by package
fq <- readFastq(fl) # load fastq.gz file
sread(fq) ## prints reads as DNAstringset  object

classes:

> class(fq)
[1] "ShortReadQ"
attr(,"package")
[1] "ShortRead"

> class(fq@sread)
[1] "DNAStringSet"
attr(,"package")
[1] "Biostrings"
ADD REPLYlink written 2.3 years ago by cpad011212k

This worked perfectly. Thank you very much for your help!

ADD REPLYlink written 2.3 years ago by trodriguez20110
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1159 users visited in the last hour