[BioC] ShortReadQ and conversion of quality scores to characters

Martin Morgan mtmorgan at fhcrc.org
Fri Jul 11 21:45:28 CEST 2014


On 07/11/2014 09:48 AM, Ivan Gregoretti wrote:
> Hello everyone,
>
> Could somebody show how to convert ShortReadQ qualities to characters?
>
>
> A little detail:
>
> For instance, I can load into memory a ShortReadQ instance,
>
> A <- readFastq('file.fq.gz')
>
> and then I can convert to character either the ID lines or the sequences,
>
> as.character(id(A))
> as.character(sread(A))
>
> For qualities however, the analogous operation cannot be performed,
>
>> as.character(quality(A)
> Error in as.character.default(quality(A)) :
>    no method for coercing this S4 class to a vector
>
>
> That is very unfortunate. Could somebody enlighten me?

   as.character(quality(quality(A))

(the double quality() is because of how the class was designed).

Martin

>
> Thank you,
>
> Ivan
>
>
> Ivan Gregoretti, PhD
> Bioinformatics
>
>
>> sessionInfo()
> R Under development (unstable) (2014-06-29 r66051)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> locale:
>   [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>   [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>   [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>   [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>   [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] parallel  stats     graphics  grDevices utils     datasets  methods
> [8] base
>
> other attached packages:
>   [1] lattice_0.20-29         sqldf_0.4-7.1           RSQLite.extfuns_0.0.1
>   [4] RSQLite_0.11.4          DBI_0.2-7               gsubfn_0.6-5
>   [7] proto_0.3-10            stringr_0.6.2           ShortRead_1.22.0
> [10] GenomicAlignments_1.0.1 BSgenome_1.32.0         Rsamtools_1.16.1
> [13] GenomicRanges_1.16.3    GenomeInfoDb_1.0.2      Biostrings_2.32.0
> [16] XVector_0.4.0           IRanges_1.22.9          BiocParallel_0.6.1
> [19] BiocGenerics_0.10.0
>
> loaded via a namespace (and not attached):
>   [1] BatchJobs_1.2       BBmisc_1.7          Biobase_2.24.0
>   [4] bitops_1.0-6        brew_1.0-6          checkmate_1.1
>   [7] chron_2.3-45        codetools_0.2-8     digest_0.6.4
> [10] fail_1.2            foreach_1.4.2       grid_3.2.0
> [13] hwriter_1.3         iterators_1.0.7     latticeExtra_0.6-26
> [16] plyr_1.8.1          RColorBrewer_1.0-5  Rcpp_0.11.2
> [19] sendmailR_1.1-2     stats4_3.2.0        tcltk_3.2.0
> [22] tools_3.2.0         zlibbioc_1.10.0
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>


-- 
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 Bioconductor mailing list