DepLogo (version 1.0)

DLData: Create DLData object

Description

Creates a new DLData object from a set of input sequences.

Usage

DLData(sequences, weights = NULL, symbols = alphabet.dna$alphabet,
  colors = alphabet.dna$colors, delim = "",
  sortByWeights = !is.null(weights), axis.labels = NULL)

Arguments

sequences

the input sequences, may be provided as i) "character" vector or ii) a data.frame with sequences organized in rows and one symbol per column

weights

weights associated with the sequences, numeric vector of the same length as sequences has sequences

symbols

the symbols (alphabet) over which the sequences are defined

colors

colors for each of the symbols, not necessarily unique

delim

delimiter between the symbols in the input sequences, ignored if sequences as a data.frame

sortByWeights

if TRUE, sequences will be ordered by their weight in decreasing order

axis.labels

the labels of the individual sequence positions; if NULL, indexes from 1 to to total number of positions will be used

Value

the DLData object

Details

Sequences may either be provided as a "character" vector or as a data.frame. All symbols occurring in these sequences need to be defined and assigned to colors, which are used for plotting later. Colors do not need to be unique, but symbols with identical colors may become indistinguishable in subsequent plots (which might even be desired, for instance, when visualizing protein properties instead of amino acids). Sequences may have an associated weight, which is used to order sequences, e.g., for creating chunks/blocks of sequences in subsequent plots (see chunks parameter of plotDeplogo).

See Also

plotDeplogo

Examples

Run this code
# NOT RUN {
# creating a DLData object using default (DNA) alphabet and colors
# from a character vector with two entries
data <- DLData(c("ACGT", "ATTA"))

# creating a DLData object using a custom, binary alphabet and custom colors
data2 <- DLData(c("A,B,B,A,B", "A,B,B,A,A", "A,B,A,A,B"),
    symbols = c("A", "B"), colors = c("red","green"), delim = ",")

# creating a DLData object from a data frame 
# (created from a character vector, in this case)
vec <- c("A,B,B,A,B", "A,B,B,A,A", "A,B,A,A,B")
df <- as.data.frame(t(sapply(vec, function(a){strsplit(a, ",")[[1]]})))
data.df <- DLData(df, symbols = c("A", "B"), colors = c("red", "green"))

# creating a DLData object from sequences and weights, read from a tabular file
seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), 
    stringsAsFactors = FALSE)
data3 <- DLData(sequences = seqs[, 1], weights = log1p(seqs[, 2]) )
# }

Run the code above in your browser using DataCamp Workspace