#' plot_sliding_window
#'
#' By Coghlan (2011)
#'
#' @param windowsize Size of window
#' @param inputseq Sequence to analyze
#'
#' @export
plot_sliding_window <- function(windowsize, inputseq)
{
starts <- seq(1, length(inputseq)-windowsize, by = windowsize)
n <- length(starts) # Find the length of the vector "starts"
chunkGCs <- numeric(n) # Make a vector of the same length as
# vector "starts", but just containing zeroes
for (i in 1:n) {
chunk <- inputseq[starts[i]:(starts[i]+windowsize-1)]
chunkGC <- seqinr::GC(chunk)
print(chunkGC)
chunkGCs[i] <- chunkGC
}
plot(starts,
chunkGCs,
type="b",
xlab="Nucleotide start position",
ylab="GC content")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.