comparison {genoPlotR} | R Documentation |
Comparison class and class functions
Description
A comparison is a collection of similarities, representing the comparison between two DNA segments. These functions are class functions to create, convert and test comparison objects.
Usage
comparison(x)
as.comparison(df)
is.comparison(comparison)
Arguments
x |
Can be a |
df |
A |
comparison |
Any object to test. |
Details
Objects (either data frames or lists) should have at least named
elements start1
, end1
, start2
and end2
. In
addition, it can take a col
or column. Additional numeric columns can
be used for color-coding (via apply_color_scheme
.
comparison
tries to build a comparison object from either a
data frame or a list, as.comparison
accepts only data.frames.
is.comparison
returns TRUE
if the object tested is a
comparison object.
Read functions such as read_comparison_from_tab
and
read_comparison_from_blast
also return comparison objects.
Value
A comparison object for comparison
and
as.comparison
. Comparison objects are also of class
data.frame
. They contain the columns start1
,
end1
, start2
, end2
, direction
and
col
(color).
A logical for is.comparison
.
Author(s)
Lionel Guy
See Also
dna_seg
, read_comparison_from_tab
,
read_comparison_from_blast
,
trim.comparison
, reverse.comparison
.
Examples
## Get some values
starts1 <- c(2, 1000, 1050)
ends1 <- c(600, 800, 1345)
starts2 <- c(50, 800, 1200)
ends2 <- c(900, 1100, 1322)
## From a data.frame
comparison1 <- as.comparison(data.frame(start1=starts1, end1=ends1,
start2=starts2, end2=ends2))
comparison1
is.comparison(comparison1)
is.data.frame(comparison1)
comparison(data.frame(start1=starts1, end1=ends1,
start2=starts2, end2=ends2))
## From a list
comparison(list(start1=starts1, end1=ends1,
start2=starts2, end2=ends2))
## From a file
comparison2_file <- system.file('extdata/comparison2.tab',
package = 'genoPlotR')
comparison2 <- read_comparison_from_tab(comparison2_file)