library(plotly)
aPos <- c(0,0,0)
tPos <- c(100, 0, 0)
cPos <- c(50,50*sqrt(3),0)
gPos <- c(50,25*sqrt(3),50*sqrt(3))
vertices <- list(a = aPos, t = tPos, g=gPos, c = cPos )
sequences <- Biostrings::readDNAStringSet( "repeats_dm.fa" )
sequence <- tolower(toString(sequences[1]))
split = 1/2
positions <- matrix(rep(0, nchar(sequence)), nrow = nchar(sequence)+1, ncol = 3)
for(i in 2:nrow(positions)){
positions[i,]  <- (positions[i-1,] + vertices[[substr(sequence, i-1, i-1)]])*split
}
p <- plot_ly(type="scatter3d", x = positions[,1], y = positions[,2], z = positions[,3] )
p2 <- plot3dseq(tolower(toString(sequences[2])))
p2
p1 <- plot3dseq(getSequence(sequences,1))
p4 <- plot3dseq(getSequence(sequences,4))


Gaura/cgr3d documentation built on May 21, 2019, 11:07 a.m.