R: Convert ShortReadQ class to DNAStringSet?
0
0
Entering edit mode
7.0 years ago

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 • 3.2k views
ADD COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 2246 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6