# Creating objects to work on:
sq_dna_1 <- sq(c("ACTGCTG", "CTTAGA", "CCCT", "CTGAATGT"),
alphabet = "dna_bsc")
sq_dna_2 <- sq(c("ACTGCTG", "CTTAGA", "CCCT", "CTGAATGT"),
alphabet = "dna_bsc")
sq_dna_3 <- sq(c("ACTGCTG", "CTTAGA", "GGAA"),
alphabet = "dna_bsc")
sq_dna_4 <- sq(c("ACTGCTG", "CTTAGA", "CCCT", "GTNANN"),
alphabet = "dna_ext")
sq_ami_1 <- sq(c("ACTGCTG", "NIKAAR", "CCCT", "CTGAATGT"),
alphabet = "ami_bsc")
sq_unt <- sq(c("AHSNLVSCTK$SH%&VS", "YQTVKA&#BSKJGY",
"CCCT", "AVYI#VSV&*DVGDJCFA"))
# Comparing sq object with an object of the same length:
sq_dna_1 == sq_dna_2
sq_dna_1 == c("ACTGCTG", "CTTAGA", "CCCT", "CTGAATGT")
# Cannot compare sq objects of different lengths:
if (FALSE) {
sq_dna_1 == sq_dna_3
sq_dna_1 == c("AAA", "CCC")
}
# Unless comparing sq object with scalar value:
sq_dna_1 == "CTTAGA"
# It's possible to compare basic and extended types:
sq_dna_1 == sq_dna_4
# Mixing DNA, RNA and amino acid types throws an error, however:
if (FALSE) {
sq_dna_1 == sq_ami_1
}
# On the other hand, unt sq is acceptable everywhere:
sq_dna_1 == sq_unt
sq_dna_4 == sq_unt
sq_ami_1 == sq_unt
Run the code above in your browser using DataLab