# NOT RUN {
## generate data
names1 <- c("feat1", "feat2", "feat3")
starts1 <- c(2, 1000, 1050)
ends1 <- c(600, 800, 1345)
strands1 <- c("-", -1, 1)
cols1 <- c("blue", "grey", "red")
## create data.frame
df1 <- data.frame(name=names1, start=starts1, end=ends1,
strand=strands1, col=cols1)
## with dna_seg
dna_seg1 <- dna_seg(df1)
dna_seg1
as.dna_seg(df1)
## test
is.dna_seg(dna_seg1)
## directly readable with read_dna_seg_from_tab
# }
# NOT RUN {
write.table(x=dna_seg1, file="dna_seg1.tab", quote=FALSE,
row.names=FALSE, sep="\t")
# }
# NOT RUN {
## with only one gene and with list, or two, and merging with c.dna_seg
gene2a <- dna_seg(list(name="feat1", start=50, end=900, strand="-", col="blue"))
genes2b <- dna_seg(data.frame(name=c("feat2", "feat3"), start=c(800, 1200),
end=c(1100, 1322), strand=c("+", 1),
col=c("grey", "red"),
fill=c("transparent", "grey"),
gene_type=c("arrows", "blocks")))
dna_seg2 <- c(gene2a, genes2b)
## test
is.dna_seg(dna_seg2)
## reading from file
dna_seg3_file <- system.file('extdata/dna_seg3.tab', package = 'genoPlotR')
dna_seg3 <- read_dna_seg_from_tab(dna_seg3_file)
is.dna_seg(dna_seg3)
# }
Run the code above in your browser using DataLab