This is a test version of Biostars. For the public version, visit https://www.biostars.org.
R: Convert ShortReadQ class to DNAStringSet?

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.

r chip-seq

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"

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

0 answers

No answers yet.

Log in to answer this question.