DNAstringSet
、RNAStringSet
、AAStringSet
、BStringSet
Code
# BiocManager::install("Biostrings")
library(Biostrings)
conflicts_prefer(Biostrings::setdiff)
dna_strings <- DNAStringSet(c("ATCG", "GCAT", "ATCGAT", "GCTA"))
dna_strings
#> DNAStringSet object of length 4:
#> width seq
#> [1] 4 ATCG
#> [2] 4 GCAT
#> [3] 6 ATCGAT
#> [4] 4 GCTA
rna_strings <- RNAStringSet(c("AUCG", "GCAU", "AUCGAU", "GCUA"))
rna_strings
#> RNAStringSet object of length 4:
#> width seq
#> [1] 4 AUCG
#> [2] 4 GCAU
#> [3] 6 AUCGAU
#> [4] 4 GCUA
protein_strings <- AAStringSet(c("MATH", "GCAU", "MATHMATH", "CUMA"))
protein_strings
#> AAStringSet object of length 4:
#> width seq
#> [1] 4 MATH
#> [2] 4 GCAU
#> [3] 8 MATHMATH
#> [4] 4 CUMA
# 二进制字符串存储 如seq_id、quality
binary_strings <- BStringSet(c("ERCC010101", "CRCC110011", "101010", "111000"))
binary_strings
#> BStringSet object of length 4:
#> width seq
#> [1] 10 ERCC010101
#> [2] 10 CRCC110011
#> [3] 6 101010
#> [4] 6 111000