| ==.sq | R Documentation | 
Compares input sq object with either
another sq object or character vector.
## S3 method for class 'sq'
e1 == e2
| e1 | [ | 
| e2 | [ | 
`==` compares compatible object for equality of their respective
sequences. Objects are considered compatible, when either both have same
length or one of them is a scalar value (i.e. a vector of length 1).
Moreover, not every e1 sq type can be compared to any e2 sq
type.
To see which types are compatible, see Details of
sq-concatenate.
`==` returns logical vector, where each element describes whether
elements at position n of both e1 and e2 are equal in
meaning (that is, they may be represented differently, but their biological
interpretation must be identical). If one of compared objects is a scalar,
then said logical vector describes comparison for each element of the other,
longer vector.
A logical vector indicating on which positions these
objects are equal.
Functions from utility module:
get_sq_lengths(),
is.sq(),
sqconcatenate,
sqextract
# 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:
## Not run: 
sq_dna_1 == sq_dna_3
sq_dna_1 == c("AAA", "CCC")
## End(Not run)
# 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:
## Not run: 
sq_dna_1 == sq_ami_1
## End(Not run)
# On the other hand, unt sq is acceptable everywhere:
sq_dna_1 == sq_unt
sq_dna_4 == sq_unt
sq_ami_1 == sq_unt
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.