# Creation of example data.
testposition <- tibble::tibble(
type = c("ins", "snp", "snp", "del", "del", "snp", "snp", "ins", "snp", "ins", "snp"),
start = c(10, 20, 30, 35, 40, 60, 65, 90, 90, 100, 120),
end = start + 1,
seq_id = c(rep("A", 11))
)
testseq <- tibble::tibble(
seq_id = "A",
start = 0,
end = 150,
length = end - start
)
p <- gggenomes(seqs = testseq, feats = testposition)
# This first plot shows what is being plotted when only geom_variant is called
p + geom_variant()
# Next lets use position_variant, and change the shape aesthetic by column `type`
p + geom_variant(aes(shape = type), position = position_variant())
# Now lets create a plot with different offsets by inserting a self-created vector.
p + geom_variant(
aes(shape = type),
position = position_variant(c(del = 0.4, ins = -0.4))
) + scale_shape_variant()
# Changing the base will shift all points up/down relatively from the sequence.
p + geom_variant(
aes(shape = type),
position = position_variant(base = 0.5)
) + geom_seq()
Run the code above in your browser using DataLab