I'm tried to get reverse complement of a DNA sequence in R applying Biostrings package. The length of sequence is around 900 and I want to see it completely but R shows an abstract version with some dots between the codes. Is there anyway to get it completely?
> library("Biostrings")
> d <- DNAString("CTGTTGAAGCGTCAGATGGATAAGCATCCATAATTTACTGTCCATATCCAAGACCTCATAGTATTCCTCGGGCATGAATTTAATTGGCGGGGTCGGGGTTCAAGTAAGCCGTATTTTGGCTTCGCCGCCGCGAATTTGAATGCGAGGCGTCTCCTCAAAGATGAGTAACGGCGTCCTGGGCTTCACAGAACTTTCGTGAGAAAACTCTAAGACTCTACAGAGATCACAAATGGTTTCAGCCCAGACTCTATTACTTGGGAGTAAGGGGGTTGACAACTCGCCACTCTATTTCCCATCATCTGCCCGCAGCTGCGACTGGGCCGAACCGAGATGGATATAGGAATAAAATGTGGTGGTGTTGCCGTGCTCTTTTCGTCCGCGTGTCCATGGCGAGGACAGCTATTTTCCTCTAAAGCCCATGTAGATCGCCTCGATCCCTCGTAAGACCCGGCTGCAGTCTGACGCCCCGACAAATAAGCTACCGCCTCCTAAACCATCCCCGATTCAGATGCGTGCTAACTTCGTGTTTCGGCCTAGCTTTAAGGGTACCGTCAGTCACCGCGACTCATAGCTGTACTCCTTCAGAATAAGGTAGTCCCGATCGTACACGTAGCTACAGAGGTATCAGACACGAGCTCGCGTCAATTCGACTCTTCGAGGCTGTGTGCCCCAGCTCCTCAGGGATCGCAATTTAGCAATCAAGAGATCTTGCCTCGTATCAATGATTTTCGCAGTTGGGTTCACGCCCCCTACAATAGCGCACCGCCTGTGTGCAAAGAAATTTTCTGGTACGTAAGATTCGAGGGAGTAGGGACGAAACATTCATGGCGATAGCAGATTTCCGAGGGCTACGGTGTAGCGGATACTAACCTCCGCGTGGTATAGATAGATACTTACCAAGGACACATGCTCTTCCTGTATAGCCGTTCCCG")
> rc <- reverseComplement(d)
> rc
932-letter "DNAString" instance
seq: CGGGAACGGCTATACAGGAAGAGCAT...TGCTTATCCATCTGACGCTTCAACAG
Just use as.character
:
> d = DNAString(paste0(sample(c("A","C","T","G"),600,TRUE),collapse=""))
> d
600-letter "DNAString" instance
seq: CACATTTCTGAAGGTGTTGAGCGGCATCATATAAAC...CATAAACATAATTGCTTGTTTAGTCTACCAAACGCT
> as.character(d)
[1] "CACATTTCTGAAGGTGTTGAGCGGCATCATATAAACGCTCCCCCTTCAACTGTATAGTCCGGCACAGTAGGCTTAGGATATCACCGATGTGTCCGCCACGAAGCTCGAAGACCCGCCTCAAACAGGGCGCACGACCCGCTATATCCAACAATGAGTTCGACCCTGGATCCGTGCATTACATAGGCGACATGTGTGAAAAACTTTGCGTATCTCGGGCTTGCGCCTTTACTCCATGACTTTCTTTCGAACCTTAAATGACTGGTGCATACCCCTGCTTGTCCGTAAGGGAACGGACGGTTGGTATATCTTGAGCACGAGTAAGGGCGCTGATACCCCTTTGCTCGTCATTGATGGGCCAATGTGATGTTGACGTTGCTTGAAGGATTGTACTGGGGTTAATTTTTACGGGCGGAATTGGCTTCACAGTAATACGGACTGTGTAACAAGCGAGCCCCTTAAACGTGCAGACACTAAATAGCGGGCGAGTTACCTTTCATCAGGCACAGGTTAACTTTGGAAAAGGTCCACTTGAACCTCATTTGAAACCAAAGACCGTTATATATGCATAAACATAATTGCTTGTTTAGTCTACCAAACGCT"
Note you don't want to be doing this too much since BioStrings
tries hard to be efficient at handling long strings. If you are trying to write this to a file there are other ways of doing it...