Example of importing tRNAdb output as GRanges
tRNAdbImport 1.5.6
The tRNAdb and mttRNAdb (Jühling et al. 2009) is a compilation of tRNA sequences and tRNA genes. It is a follow up version of the database of Sprinzl et al. (Sprinzl and Vassilenko 2005).
Using tRNAdbImport the tRNAdb can be accessed as outlined on the website
http://trna.bioinf.uni-leipzig.de/ and the results
are returned as a GRanges object.
library(tRNAdbImport)
# accessing tRNAdb
# tRNA from yeast for Alanine and Phenylalanine
gr <- import.tRNAdb(organism = "Saccharomyces cerevisiae",
aminoacids = c("Phe","Ala"))
# get a Phenylalanine tRNA from yeast
gr <- import.tRNAdb.id(tdbID = gr[gr$tRNA_type == "Phe",][1L]$tRNAdb_ID)
# find the same tRNA via blast
gr <- import.tRNAdb.blast(blastSeq = gr$tRNA_seq)
# accessing mtRNAdb
# get the mitochrondrial tRNA for Alanine in Bos taurus
gr <- import.mttRNAdb(organism = "Bos taurus",
aminoacids = "Ala")
# get one mitochrondrial tRNA in Bos taurus.
gr <- import.mttRNAdb.id(mtdbID = gr[1L]$tRNAdb_ID)
# check that the result has the appropriate columns
istRNAdbGRanges(gr)
## [1] TRUE
The tRNAdb offers two different sets of data, one containing DNA sequences and
one containing RNA sequences. Depending on the database selected, DNA as
default, the GRanges will contain a DNAStringSet or a ModRNAStringSet as
the tRNA_seq column. Because the RNA sequences can contain modified
nucleotides, the ModRNAStringSet class is used instead of the RNAStringSet
class to store the sequences correctly with all information intact.
gr <- import.tRNAdb(organism = "Saccharomyces cerevisiae",
aminoacids = c("Phe","Ala"),
database = "RNA")
gr$tRNA_seq
## A ModRNAStringSet instance of length 3
## width seq names
## [1] 76 tdbR00000012
## [2] 76 tdbR00000083
## [3] 76 tdbR00000084
The special characters in the sequence might no exactly match the ones shown on
the website, since they are sanitized internally to a unified dictionary defined
in the Modstrings package. However, the type of modification encoded will
remain the same (See the Modstrings package for more details).
The information on the position and type of the modifications can also be
converted into a tabular format using the separate function from the
Modstrings package.
separate(gr$tRNA_seq)
## GRanges object with 38 ranges and 1 metadata column:
## seqnames ranges strand | mod
## <Rle> <IRanges> <Rle> | <character>
## [1] tdbR00000012 9 + | m1G
## [2] tdbR00000012 16 + | D
## [3] tdbR00000012 20 + | D
## [4] tdbR00000012 26 + | m2,2G
## [5] tdbR00000012 34 + | I
## ... ... ... ... . ...
## [34] tdbR00000084 46 + | m7G
## [35] tdbR00000084 49 + | f5Cm
## [36] tdbR00000084 54 + | m5U
## [37] tdbR00000084 55 + | Y
## [38] tdbR00000084 58 + | m1A
## -------
## seqinfo: 3 sequences from an unspecified genome; no seqlengths
The output can be saved or directly used for further analysis.
library(Biostrings)
library(rtracklayer)
writeXStringSet(gr$tRNA_seq, filepath = tempfile())
gff <- tRNAdb2GFF(gr)
export.gff3(gff, con = tempfile())
Please have a look at the tRNA package for further analysis of the tRNA
sequences.
sessionInfo()
## R Under development (unstable) (2020-01-27 r77730)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows Server 2012 R2 x64 (build 9600)
##
## Matrix products: default
##
## locale:
## [1] LC_COLLATE=C
## [2] LC_CTYPE=English_United States.1252
## [3] LC_MONETARY=English_United States.1252
## [4] LC_NUMERIC=C
## [5] LC_TIME=English_United States.1252
##
## attached base packages:
## [1] parallel stats4 stats graphics grDevices utils datasets
## [8] methods base
##
## other attached packages:
## [1] rtracklayer_1.47.0 tRNAdbImport_1.5.6 tRNA_1.5.2
## [4] Structstrings_1.3.3 Modstrings_1.3.6 Biostrings_2.55.4
## [7] XVector_0.27.0 GenomicRanges_1.39.2 GenomeInfoDb_1.23.13
## [10] IRanges_2.21.3 S4Vectors_0.25.12 BiocGenerics_0.33.0
## [13] BiocStyle_2.15.6
##
## loaded via a namespace (and not attached):
## [1] Rcpp_1.0.3 lattice_0.20-40
## [3] Rsamtools_2.3.5 assertive.properties_0.0-4
## [5] assertive.types_0.0-3 assertive.data.us_0.0-2
## [7] assertthat_0.2.1 digest_0.6.25
## [9] R6_2.4.1 evaluate_0.14
## [11] assertive.code_0.0-3 httr_1.4.1
## [13] ggplot2_3.2.1 pillar_1.4.3
## [15] assertive.strings_0.0-3 zlibbioc_1.33.1
## [17] rlang_0.4.4 curl_4.3
## [19] lazyeval_0.2.2 Matrix_1.2-18
## [21] assertive_0.3-5 assertive.data_0.0-3
## [23] rmarkdown_2.1 BiocParallel_1.21.2
## [25] stringr_1.4.0 RCurl_1.98-1.1
## [27] munsell_0.5.0 DelayedArray_0.13.4
## [29] compiler_4.0.0 xfun_0.12
## [31] pkgconfig_2.0.3 htmltools_0.4.0
## [33] SummarizedExperiment_1.17.2 tidyselect_1.0.0
## [35] tibble_2.1.3 GenomeInfoDbData_1.2.2
## [37] bookdown_0.17 matrixStats_0.55.0
## [39] assertive.sets_0.0-3 codetools_0.2-16
## [41] XML_3.99-0.3 crayon_1.3.4
## [43] dplyr_0.8.4 GenomicAlignments_1.23.1
## [45] bitops_1.0-6 grid_4.0.0
## [47] assertive.base_0.0-7 gtable_0.3.0
## [49] lifecycle_0.1.0 magrittr_1.5
## [51] assertive.models_0.0-2 scales_1.1.0
## [53] stringi_1.4.6 assertive.matrices_0.0-2
## [55] xml2_1.2.2 assertive.reflection_0.0-4
## [57] assertive.datetimes_0.0-2 tools_4.0.0
## [59] Biobase_2.47.2 glue_1.3.1
## [61] purrr_0.3.3 assertive.numbers_0.0-2
## [63] yaml_2.2.1 colorspace_1.4-1
## [65] BiocManager_1.30.10 assertive.files_0.0-2
## [67] assertive.data.uk_0.0-2 knitr_1.28
Jühling, Frank, Mario Mörl, Roland K. Hartmann, Mathias Sprinzl, Peter F. Stadler, and Joern Pütz. 2009. “TRNAdb 2009: Compilation of tRNA Sequences and tRNA Genes.” Nucleic Acids Research 37: D159–D162. https://doi.org/10.1093/nar/gkn772.
Sprinzl, Mathias, and Konstantin S. Vassilenko. 2005. “Compilation of tRNA Sequences and Sequences of tRNA Genes.” Nucleic Acids Research 33: D139–D140. https://doi.org/10.1093/nar/gki012.