Title: | Dependency Logo |
---|---|
Description: | Plots dependency logos from a set of aligned input sequences. |
Authors: | Jan Grau [aut, cre], Jens Keilwagen [aut], Martin Nettling [aut] |
Maintainer: | Jan Grau <[email protected]> |
License: | GPL-3 |
Version: | 1.2.1 |
Built: | 2025-02-10 02:43:41 UTC |
Source: | https://github.com/cran/DepLogo |
builts an object of class Alphabet from the given set of symbols and colors
Alphabet(chars, cols)
Alphabet(chars, cols)
chars |
set of symbols |
cols |
set of colors; one for each symbol |
the Alphabet object
Martin Nettling
DNA <- Alphabet(c("A", "C", "G", "T"), c("green4", "blue", "orange", "red"))
DNA <- Alphabet(c("A", "C", "G", "T"), c("green4", "blue", "orange", "red"))
DNA alphabet
alphabet.dna
alphabet.dna
An object of class list
of length 2.
DNA alphabet with gaps
alphabet.dna.gap
alphabet.dna.gap
An object of class list
of length 2.
Amino acid alphabet
alphabet.protein
alphabet.protein
An object of class list
of length 2.
Amino acid alphabet with gaps
alphabet.protein.gap
alphabet.protein.gap
An object of class list
of length 2.
RNA alphabet
alphabet.rna
alphabet.rna
An object of class list
of length 2.
RNA alphabet with gaps
alphabet.rna.gap
alphabet.rna.gap
An object of class list
of length 2.
This function is a low-level plotting function (using image with add=TRUE
, internally).
colorchart(part, yoff, ic.scale = TRUE)
colorchart(part, yoff, ic.scale = TRUE)
part |
the set of sequences as DLData object |
yoff |
the offset in y-direction within the current plot |
ic.scale |
ignored for colorcharts |
the vertical (y) offset after this plot
Jan Grau <[email protected]>
# read data and create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[,1], weights = log1p(seqs[, 2]) ) # create high-level plot plot(NULL, xlim = c(1, ncol(data$data) - 1), ylim = c(0, nrow(data$data)), ylab = nrow(data$data), axes = FALSE) # and add colorchart and axis colorchart(data, yoff = nrow(data$data)) axis(1)
# read data and create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[,1], weights = log1p(seqs[, 2]) ) # create high-level plot plot(NULL, xlim = c(1, ncol(data$data) - 1), ylim = c(0, nrow(data$data)), ylab = nrow(data$data), axes = FALSE) # and add colorchart and axis colorchart(data, yoff = nrow(data$data)) axis(1)
Plots a representation of a set of sequences by rectangles of (scaled) averaged color values of the symbols at each position
deprects(part, yoff, ic.scale = TRUE)
deprects(part, yoff, ic.scale = TRUE)
part |
the set of sequences as DLData object |
yoff |
the offset in y-direction within the current plot |
ic.scale |
if |
This function is a low-level plotting function (using rect, internally).
the vertical (y) offset after this plot
Jan Grau <[email protected]>
# read data and create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1],weights = log1p(seqs[, 2]) ) # create high-level plot plot(NULL, xlim = c(1, ncol(data$data) - 1), ylim = c(0, nrow(data$data)), ylab = nrow(data$data), axes = FALSE) # and add deprects and axis deprects(data, yoff = nrow(data$data)) axis(1)
# read data and create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1],weights = log1p(seqs[, 2]) ) # create high-level plot plot(NULL, xlim = c(1, ncol(data$data) - 1), ylim = c(0, nrow(data$data)), ylab = nrow(data$data), axes = FALSE) # and add deprects and axis deprects(data, yoff = nrow(data$data)) axis(1)
DLData
objectCreates a new DLData
object from a set of input sequences.
DLData( sequences, weights = NULL, symbols = alphabet.dna$alphabet, colors = alphabet.dna$colors, delim = "", sortByWeights = !is.null(weights), axis.labels = NULL )
DLData( sequences, weights = NULL, symbols = alphabet.dna$alphabet, colors = alphabet.dna$colors, delim = "", sortByWeights = !is.null(weights), axis.labels = NULL )
sequences |
the input sequences, may be provided as i) |
weights |
weights associated with the sequences, numeric vector of the
same length as |
symbols |
the symbols (alphabet) over which the sequences are defined |
colors |
colors for each of the |
delim |
delimiter between the symbols in the input sequences, ignored if
|
sortByWeights |
if |
axis.labels |
the labels of the individual sequence positions;
if |
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
).
the DLData
object
Jan Grau <[email protected]>
# 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]) )
# 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]) )
Filters columns based on the relative information content of each column which is the standard information content normalized to the interval [0,1], where 0 corresponds to uniform distribution and 1 to perfect conservation of one nucleotide or amino acid, respectively.
filter.by.conservation(relative.ic)
filter.by.conservation(relative.ic)
relative.ic |
the maximum relative information content allowed to retain a position |
function that, given a DLData object, returns TRUE
for every column that does not exceed the specified relative information content
Jan Grau <[email protected]>
fun <- filter.by.conservation(relative.ic = 0.9)
fun <- filter.by.conservation(relative.ic = 0.9)
Filters columns based on the average or maximum mutual information of a column to all other columns. Mutual information is normalized to to interval [0,1], where 0 corresponds to independence and 1 to perfect dependence.
filter.by.dependencies(mi.threshold, use.max = FALSE)
filter.by.dependencies(mi.threshold, use.max = FALSE)
mi.threshold |
the minimum average or maximum mutual information required |
use.max |
if |
function that, given a DLData object, returns TRUE
for every column that does exceed the specified average mutual information
Jan Grau <[email protected]>
fun <- filter.by.dependencies(mi.threshold = 0.3)
fun <- filter.by.dependencies(mi.threshold = 0.3)
Filters columns (sequence positions) by gaps
filter.by.gaps(percent.gap)
filter.by.gaps(percent.gap)
percent.gap |
the maximum fraction of gaps allowed to retain a column |
function that, given a DLData object, returns TRUE
for every column that does not exceed the specified number of gaps
Jan Grau <[email protected]>
fun <- filter.by.gaps(percent.gap = 0.1)
fun <- filter.by.gaps(percent.gap = 0.1)
Filters the columns of the input data, i.e., positions of input sequences,
by a filter function that, given a DLData object, returns a list containing
i) as element $selected
a vector with entries TRUE
for every column
that should be retained in the filtered data and ii) as element $range
the
range of values obtained for the filtering criterion.
filterColumns(data, filter.fun)
filterColumns(data, filter.fun)
data |
the data as DLData object |
filter.fun |
the filter function |
a DLData object containing the filtered columns and the indexes of the remaining in its axis.labels
field
Jan Grau <[email protected]>
# read data and create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1], weights = log1p(seqs[, 2]) ) # create a filter function based on the percentage of gap symbols (at most 10%) fun <- filter.by.gaps(percent.gap = 0.1) data2 <- filterColumns(data, fun)
# read data and create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1], weights = log1p(seqs[, 2]) ) # create a filter function based on the percentage of gap symbols (at most 10%) fun <- filter.by.gaps(percent.gap = 0.1) data2 <- filterColumns(data, fun)
Computes the dependencies (as measures by mutual information) between all positions (columns) of discrete data. Specifically, it returns for each pair of positions (i,j) the mutual information I(X_i,X_j) multiplied by the number N of sequences (rows), which may also be used for testing the statistical significance of mutual information values, as for large N, 2*N*I(X_i,X_j) is approximately chi squared.
getDeps(data, ...) ## S3 method for class 'DLData' getDeps(data, ...) ## S3 method for class 'data.frame' getDeps(data, alphabet, ...)
getDeps(data, ...) ## S3 method for class 'DLData' getDeps(data, ...) ## S3 method for class 'data.frame' getDeps(data, alphabet, ...)
data |
the data for computing mutual information. Either a DLData object or a data.frame; In the latter case, the symbols of the alphabet must be provided as a second parameter |
... |
the symbols of the alphabet as character vector, only if data is a data.frame |
alphabet |
only required when called on a data.frame |
a matrix of the mutual information values, where the diagonal is fixed to zero
Jan Grau <[email protected]>
data <- DLData(c("ACGT", "ATTA")) deps <- getDeps(data)
data <- DLData(c("ACGT", "ATTA")) deps <- getDeps(data)
Determines the position weight matrix from a DLData object as relative frequency of symbols in each column of the data slot.
getPWM(part) ## S3 method for class 'DLData' getPWM(part)
getPWM(part) ## S3 method for class 'DLData' getPWM(part)
part |
the DLData object |
the position weight matrix, where columns correspond to positions (columns of the DLData$data slot) and rows to symbols
Jan Grau <[email protected]>
data <- DLData(c("ACGT", "ATTA")) getPWM(data)
data <- DLData(c("ACGT", "ATTA")) getPWM(data)
Plots a representation of a set of sequences as a sequence logo
logo(part, yoff, ic.scale = TRUE)
logo(part, yoff, ic.scale = TRUE)
part |
the set of sequences as DLData object |
yoff |
the offset in y-direction within the current plot |
ic.scale |
if |
This function is a low-level plotting function (using polygon, internally).
the vertical (y) offset after this plot
Jan Grau <[email protected]>
# read data and create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1], weights = log1p(seqs[,2]) ) # create high-level plot plot(NULL, xlim = c(1, ncol(data$data) - 1), ylim = c(0, nrow(data$data)), ylab = nrow(data$data), axes = FALSE) # and add sequence logo and axis logo(data, yoff = nrow(data$data)) axis(1)
# read data and create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1], weights = log1p(seqs[,2]) ) # create high-level plot plot(NULL, xlim = c(1, ncol(data$data) - 1), ylim = c(0, nrow(data$data)), ylab = nrow(data$data), axes = FALSE) # and add sequence logo and axis logo(data, yoff = nrow(data$data)) axis(1)
Partitions data
by the nucleotides at the most inter-dependent
positions as measures by pairwise mutual information. Paritioning is
performed recursively on the resulting subsets until i) the number of
sequences in a partition is less then minElements
, ii) the average
pairwise dependency between the current position and numBestForSorting
other positions with the largest mutual information value drops below
threshold
, or iii) maxNum
recursive splits have already been
performed. If splitting results in smaller partitions than
minElements
, these are added to the smallest partition with more than
minElements
sequences.
partition( data, minElements = 10, threshold = 0.1, numBestForSorting = 3, maxNum = 6, sortByWeights = NULL, partition.by = NULL ) ## S3 method for class 'DLData' partition( data, minElements = 10, threshold = 0.1, numBestForSorting = 3, maxNum = 6, sortByWeights = NULL, partition.by = NULL )
partition( data, minElements = 10, threshold = 0.1, numBestForSorting = 3, maxNum = 6, sortByWeights = NULL, partition.by = NULL ) ## S3 method for class 'DLData' partition( data, minElements = 10, threshold = 0.1, numBestForSorting = 3, maxNum = 6, sortByWeights = NULL, partition.by = NULL )
data |
the data as DLData object |
minElements |
the minimum number of elements to perform a further split |
threshold |
the threshold on the average mutual information value |
numBestForSorting |
the number of dependencies to other positions considered |
maxNum |
the maximum number of recursive splits |
sortByWeights |
if |
partition.by |
specify fixed positions to partition by |
the partitions as list of DLData objects
Jan Grau <[email protected]>
# create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1], weights = log1p(seqs[,2]) ) # partition data using default parameters partitions <- partition(data) # partition data using a threshold of 0.3 on the mutual # information value to the most dependent position, # sorting the resulting partitions by weight partitions2 <- partition(data = data, threshold = 0.3, numBestForSorting = 1, sortByWeights = TRUE)
# create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1], weights = log1p(seqs[,2]) ) # partition data using default parameters partitions <- partition(data) # partition data using a threshold of 0.3 on the mutual # information value to the most dependent position, # sorting the resulting partitions by weight partitions2 <- partition(data = data, threshold = 0.3, numBestForSorting = 1, sortByWeights = TRUE)
Plots the blocks of data in data
by successive, vertically arranged sub-plots of the function provided as block.fun
.
If data
is a single DLData object, one block is plotted. Further arguments are provided to block.fun
.
plotBlocks( data, show.number = TRUE, block.fun = deprects, ic.scale = TRUE, add = FALSE, ... ) ## S3 method for class 'DLData' plotBlocks( data, show.number = TRUE, block.fun = deprects, ic.scale = TRUE, add = FALSE, ... ) ## S3 method for class 'list' plotBlocks( data, show.number = TRUE, block.fun = deprects, ic.scale = TRUE, add = FALSE, ... )
plotBlocks( data, show.number = TRUE, block.fun = deprects, ic.scale = TRUE, add = FALSE, ... ) ## S3 method for class 'DLData' plotBlocks( data, show.number = TRUE, block.fun = deprects, ic.scale = TRUE, add = FALSE, ... ) ## S3 method for class 'list' plotBlocks( data, show.number = TRUE, block.fun = deprects, ic.scale = TRUE, add = FALSE, ... )
data |
the data, a single DLData object or a list of |
show.number |
if |
block.fun |
the function called for each of the blocks |
ic.scale |
if |
add |
if |
... |
if |
Jan Grau <[email protected]>
# read data and create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1], weights = log1p(seqs[, 2]) ) # plot all data plotBlocks(data) # partition data partitions <- partition(data, threshold = 0.3) # and plot partitions plotBlocks(partitions) # or plot partitions as sequence logos plotBlocks(partitions, block.fun = logo)
# read data and create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1], weights = log1p(seqs[, 2]) ) # plot all data plotBlocks(data) # partition data partitions <- partition(data, threshold = 0.3) # and plot partitions plotBlocks(partitions) # or plot partitions as sequence logos plotBlocks(partitions, block.fun = logo)
Plots a representation of dependency values as arcs between the sequence
positions. Internally, dependency values are computed using getDeps on
the data
object.
plotDeparcs( data, axis.at.bottom = TRUE, add.legend = TRUE, show.pvals = FALSE, axis.labels = NULL, threshold = 0.1 )
plotDeparcs( data, axis.at.bottom = TRUE, add.legend = TRUE, show.pvals = FALSE, axis.labels = NULL, threshold = 0.1 )
data |
the DLData object containing the data |
axis.at.bottom |
if |
add.legend |
if |
show.pvals |
if |
axis.labels |
the labels of the x-axis |
threshold |
threshold in mutual information values, edges below this value are not shown; ignored in |
Jan Grau <[email protected]>
# create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[,1], weights = log1p(seqs[, 2]) ) # plot using default parameters plotDeparcs(data) # plot with axis at top, without a legend (color scale), and using p-values plotDeparcs(data, axis.at.bottom = FALSE, add.legend = FALSE, show.pvals = TRUE)
# create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[,1], weights = log1p(seqs[, 2]) ) # plot using default parameters plotDeparcs(data) # plot with axis at top, without a legend (color scale), and using p-values plotDeparcs(data, axis.at.bottom = FALSE, add.legend = FALSE, show.pvals = TRUE)
Plots a dependency logo
plotDeplogo( data, dep.fun = plotDeparcs, block.fun = deprects, summary.fun = logo, weight.fun = NULL, chunks = NULL, chunk.height = 800, summary.height = 100, minPercent = 0.03, threshold = 0.1, numBestForSorting = 3, maxNum = 6, sortByWeights = NULL, dep.fun.legend = TRUE, show.dependency.pvals = FALSE, axis.labels = NULL, weight.ratio = 5, partition.by = NULL, ... ) ## S3 method for class 'DLData' plotDeplogo( data, dep.fun = plotDeparcs, block.fun = deprects, summary.fun = logo, weight.fun = NULL, chunks = NULL, chunk.height = 800, summary.height = 100, minPercent = 0.03, threshold = 0.1, numBestForSorting = 3, maxNum = 6, sortByWeights = NULL, dep.fun.legend = TRUE, show.dependency.pvals = FALSE, axis.labels = NULL, weight.ratio = 5, partition.by = NULL, ... )
plotDeplogo( data, dep.fun = plotDeparcs, block.fun = deprects, summary.fun = logo, weight.fun = NULL, chunks = NULL, chunk.height = 800, summary.height = 100, minPercent = 0.03, threshold = 0.1, numBestForSorting = 3, maxNum = 6, sortByWeights = NULL, dep.fun.legend = TRUE, show.dependency.pvals = FALSE, axis.labels = NULL, weight.ratio = 5, partition.by = NULL, ... ) ## S3 method for class 'DLData' plotDeplogo( data, dep.fun = plotDeparcs, block.fun = deprects, summary.fun = logo, weight.fun = NULL, chunks = NULL, chunk.height = 800, summary.height = 100, minPercent = 0.03, threshold = 0.1, numBestForSorting = 3, maxNum = 6, sortByWeights = NULL, dep.fun.legend = TRUE, show.dependency.pvals = FALSE, axis.labels = NULL, weight.ratio = 5, partition.by = NULL, ... )
data |
the data, currently implemented for DLData objects |
dep.fun |
the function for plotting the representation of dependency values (as computed by getDeps) |
block.fun |
the function for plotting a representation of the individual partitions of the data generated in dependency logos. |
summary.fun |
the function for plotting a representation of the summary plot for (one chunk of) the data |
weight.fun |
the function for plotting a representation of the
|
chunks |
the size of chunks the data is split into. The sum of the chunk sizes must not be greater than the number of data points in data; The default value of NULL corresponds to one chunk containing all data points |
chunk.height |
the (relative) height of the parts of the plot representing each of the chunks, one height for each chunk |
summary.height |
the (relative) height of the block summaries in the plot |
minPercent |
the minimum percentage of the (sub) data set that may constitute its own partition in the dependency logo |
threshold |
the threshold on the dependency value for further splits |
numBestForSorting |
the number of dependencies between position i and all other positions when computing the dependency value of position i |
maxNum |
the maximum number of splits allowed |
sortByWeights |
are partitions sorted by their average weight (descending) |
dep.fun.legend |
if |
show.dependency.pvals |
is |
axis.labels |
labels for the x-axis, vector of the same length as the individual sequences |
weight.ratio |
the factor by which the plotting width for the main plot is larger than for |
partition.by |
specify fixed positions to partition by |
... |
forwarded to the high-level |
The function dep.fun
provided for plotting the representation of
dependencies is currently implemented in plotDeparcs and
plotDepmatrix. Custom implementations must have the same signature as
these functions and create a single plot without using
layout (or similar).
The functions block.fun
and summary.fun
provided for plotting
the representation of individual partitions of the data generated in
dependency logos are currently implemented in deprects,
colorchart, and logo. Custom implementations must have the same
signature as these functions and create a single plot without using
layout (or similar).
The function weight.fun
for plotting a representation of the
weights
values of the sequences within one partition is currently
implemented in subLines and subBoxes. Custom implementations
must have the same signature as these functions and create a single plot
without using layout (or similar).
a list of DLData objects with the partitions created for the dependency logo
Jan Grau <[email protected]>
# read data and create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1],weights = log1p(seqs[, 2]) ) # plot default dependency logo plotDeplogo(data) # refine threshold for clearer picture plotDeplogo(data, threshold = 0.3) # customize different parts of the plot plotDeplogo(data, threshold = 0.3, dep.fun = plotDepmatrix, block.fun = colorchart) # add plots of the weights plotDeplogo(data, weight.fun = subBoxes)
# read data and create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1],weights = log1p(seqs[, 2]) ) # plot default dependency logo plotDeplogo(data) # refine threshold for clearer picture plotDeplogo(data, threshold = 0.3) # customize different parts of the plot plotDeplogo(data, threshold = 0.3, dep.fun = plotDepmatrix, block.fun = colorchart) # add plots of the weights plotDeplogo(data, weight.fun = subBoxes)
Plots a representation of dependency values as a triangular matrix rotated by
45 degrees. Internally, dependency values are computed using getDeps
on the data
object.
plotDepmatrix( data, axis.at.bottom = TRUE, add.legend = TRUE, show.pvals = FALSE, axis.labels = NULL, threshold = 0.1 )
plotDepmatrix( data, axis.at.bottom = TRUE, add.legend = TRUE, show.pvals = FALSE, axis.labels = NULL, threshold = 0.1 )
data |
the DLData object containing the data |
axis.at.bottom |
if |
add.legend |
if |
show.pvals |
if |
axis.labels |
the labels of the x-axis |
threshold |
ignored |
Jan Grau <[email protected]>
# create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1], weights = log1p(seqs[, 2]) ) # plot using default parameters plotDepmatrix(data) # plot with axis at top, without a legend (color scale), and using p-values plotDepmatrix(data, axis.at.bottom = FALSE, add.legend = FALSE, show.pvals = TRUE)
# create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1], weights = log1p(seqs[, 2]) ) # plot using default parameters plotDepmatrix(data) # plot with axis at top, without a legend (color scale), and using p-values plotDepmatrix(data, axis.at.bottom = FALSE, add.legend = FALSE, show.pvals = TRUE)
Replaces colors in DLData object
replaceColors(data, colors) ## S3 method for class 'DLData' replaceColors(data, colors)
replaceColors(data, colors) ## S3 method for class 'DLData' replaceColors(data, colors)
data |
the data |
colors |
the new colors |
the modified DLData object
Jan Grau <[email protected]>
# read data and create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1], weights = log1p(seqs[, 2]) ) replaceColors(data, c("red", "green", "blue", "yellow"))
# read data and create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1], weights = log1p(seqs[, 2]) ) replaceColors(data, c("red", "green", "blue", "yellow"))
Determine the reverse complementary DLData
object. Only works for DNA or RNA. Data may include gap symbols.
revcom(data) ## S3 method for class 'DLData' revcom(data)
revcom(data) ## S3 method for class 'DLData' revcom(data)
data |
the data |
the reverse complement
Jan Grau <[email protected]>
data <- DLData(c("ACGT", "ATTA")) revcom(data)
data <- DLData(c("ACGT", "ATTA")) revcom(data)
Plots a representation of the weights of a list of DLData objects. Each entry of the list is shown as an independent boxplot.
subBoxes(sub.parts, range, axis.above = TRUE, axis.below = TRUE)
subBoxes(sub.parts, range, axis.above = TRUE, axis.below = TRUE)
sub.parts |
a list of DLData objects |
range |
the range of values shown in the plot (i.e., the |
axis.above |
if |
axis.below |
if |
Jan Grau <[email protected]>
# read data and create DLData object seqs <- read.table(system.file("extdata", "nrsf.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1], weights = log1p(seqs[, 2]) ) # create dependency logo with plotted weights plotDeplogo(data, threshold = 0.03, weight.fun = subBoxes)
# read data and create DLData object seqs <- read.table(system.file("extdata", "nrsf.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1], weights = log1p(seqs[, 2]) ) # create dependency logo with plotted weights plotDeplogo(data, threshold = 0.03, weight.fun = subBoxes)
Plots a representation of the weights of a list of DLData objects. Each entry of the list is shown as an independent line with the median value shown as a red vertical line. Plots of list entries are separated by horizontal grey lines.
subLines(sub.parts, range, axis.above = TRUE, axis.below = TRUE)
subLines(sub.parts, range, axis.above = TRUE, axis.below = TRUE)
sub.parts |
a list of DLData objects |
range |
the range of values shown in the plot (i.e., the |
axis.above |
if |
axis.below |
if |
Jan Grau <[email protected]>
# read data and create DLData object seqs <- read.table(system.file("extdata", "nrsf.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1], weights = log1p(seqs[, 2]) ) # create dependency logo with plotted weights plotDeplogo(data, threshold = 0.03, weight.fun = subLines)
# read data and create DLData object seqs <- read.table(system.file("extdata", "nrsf.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1], weights = log1p(seqs[, 2]) ) # create dependency logo with plotted weights plotDeplogo(data, threshold = 0.03, weight.fun = subLines)
Suggests colors for the symbols in data
based on the co-occurrence of
symbols at common positions, weighted by the dependency values at those positions.
The idea is to assign similar colors only to symbols that either mostly occur at
different positions or that are present at positions with low inter-dependencies
to other positions.
suggestColors(data) ## S3 method for class 'DLData' suggestColors(data)
suggestColors(data) ## S3 method for class 'DLData' suggestColors(data)
data |
the data |
the colors
Jan Grau <[email protected]>
# read data and create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1] ,weights = log1p(seqs[, 2]) ) suggestColors(data)
# read data and create DLData object seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1] ,weights = log1p(seqs[, 2]) ) suggestColors(data)
summary
method for class "DLData".
The summary includes the number of sequences, the consensus sequence
and the number of sequences in object
that match the consensus.
## S3 method for class 'DLData' summary(object, delete.gaps = FALSE, ...)
## S3 method for class 'DLData' summary(object, delete.gaps = FALSE, ...)
object |
an object of class "DLData" |
delete.gaps |
if gaps should be removed from the consensus |
... |
further arguments passed to or from other methods |
a list
with elements members
containing the number of sequences,
consensus
containing the consensus sequences, and equal.consensus
containing the
number of sequences in object
that are identical to consensus
Jens Keilwagen, Jan Grau <[email protected]>
seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1], weights = log1p(seqs[, 2]) ) summary(data)
seqs <- read.table(system.file("extdata", "cjun.txt", package = "DepLogo"), stringsAsFactors = FALSE) data <- DLData(sequences = seqs[, 1], weights = log1p(seqs[, 2]) ) summary(data)