Skip to content

Commit f3cae6a

Browse files
Add files via upload
1 parent e97bbe8 commit f3cae6a

15 files changed

+1453
-24
lines changed

R/data.R

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#' @title RNA-seq example
2+
#' @description Extract of a DESeq2 result for differential expression analysis on RNA-seq data
3+
#' @format A data frame with 300 rows and 7 variables:
4+
#' \describe{
5+
#' \item{\code{geneName}}{genes symbols}
6+
#' \item{\code{baseMean}}{The average of the normalized count values, dividing by size factors, taken over all samples}
7+
#' \item{\code{log2FC}}{the log2 value of the Fold Change expression between two conditions}
8+
#' \item{\code{lfcSE}}{log2 Fold Change standard error (SE)}
9+
#' \item{\code{stat}}{Wald statistic}
10+
#' \item{\code{pvalue}}{Wald test p-value}
11+
#' \item{\code{padj}}{BH adjusted p-values}
12+
#'}
13+
#' @source \url{http://path.to.paper/}
14+
"RNAseq"
15+
#'
16+
#'
17+
#'
18+
#'
19+
#' @title RNA-seq example
20+
#' @description List result of the function \code{read.computeMatrix.file} used to read a matrix.gz file generated by deepTools computeMatrix function.
21+
#' @format A named list of 3 variables:
22+
#' \describe{
23+
#' \item{\code{metadata}}{data.frame with the information gotten from the matrix_file.gz}
24+
#' \item{\code{matrix.data}}{data.frame with the scores gotten from}
25+
#' \item{\code{original.file.path}}{with full path to the original matrix_file.gz}
26+
#'}
27+
#' @source \url{http://path.to.paper/}
28+
"deeptools.matrix"
29+
#'
30+
#'
31+
#'
32+
#'
33+
#' @title CNV data results example
34+
#' @description Simulation of Copy Number Variation (CNV) analysis on a cohort of patients.
35+
#' @format A data frame with 25 rows and 9 variables:
36+
#' \describe{
37+
#' \item{\code{geneName}}{hypothetical gene symbols}
38+
#' \item{\code{patient_1 ... patient_N}}{hypothetical patients ID}
39+
#'}
40+
#' @source Simulated data
41+
"CNV.data"

R/density.matrix.R

Lines changed: 399 additions & 0 deletions
Large diffs are not rendered by default.

R/plot.density.differences.R

Lines changed: 657 additions & 0 deletions
Large diffs are not rendered by default.

R/plot.density.profile.R

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#' @title Plot of NGS density signal at specific regions from deepTools matrices.
22
#'
3-
#' @description Plots the density profile of NGS data signals, using as input a score matrix computed by deeptools's computeMatrix function or by \link{computeMatrix.deeptools} from this package.
3+
#' @description Plots the density profile of NGS data signals, using as input a score matrix computed by deeptools's computeMatrix function or by \link{computeMatrix.deeptools} and \link{density.matrix} functions from this package.
44
#'
5-
#' @param matrix.file A single string indicating a full path to a matrix.gz file generated by \code{deepTools/computeMatrix} or by \link{computeMatrix.deeptools}, or a list generated by the function \link{read.computeMatrix.file}.
5+
#' @param matrix.file A single string indicating a full path to a matrix.gz file generated by \code{deepTools/computeMatrix} or by \link{computeMatrix.deeptools}, or a list generated by the function \link{read.computeMatrix.file} or \link{density.matrix}.
66
#' @param plot.by.group Logical value to define whether plot by group of regions or by sample. By default \code{TRUE}.
77
#' @param missing.data.as.zero Logical value to define whether treat missing data as 0. If set as \code{FALSE} missing data will be converted to \code{NA} and will be excluded from the computations of the signal. By default \code{TRUE}.
88
#' @param sample.names Samples names could be defined by a string vector. If set as \code{NULL} sample names will be get automatically by the matrix file. By default \code{NULL}. \cr Example: \code{c("sample1", "sample2", "sample3")}
@@ -34,7 +34,7 @@
3434
#' @param by.row Logical value to define whether the plots should be arranged by row. By default \code{TRUE}.
3535
#' @param print.multiplot Logical value to define whether to print the multiplot once created. By default \code{FALSE}.
3636
#'
37-
#' @return The functions returns a list containing:
37+
#' @return The function returns a list containing:
3838
#' \itemize{
3939
#' \item \code{data.table} with the computed values used for the plot;
4040
#' \item \code{metadata} table with the information gotten from the matrix_file.gz;
@@ -294,7 +294,10 @@ plot.density.profile = function(
294294

295295

296296
# Merge of all the tables in a single one
297-
full.stat.table = purrr::reduce(.x = sample.stat.table.list, .f = rbind)
297+
full.stat.table =
298+
purrr::reduce(.x = sample.stat.table.list, .f = rbind) %>%
299+
dplyr::mutate(sample = factor(sample, levels = sample_names),
300+
group = factor(group, levels = group_names))
298301

299302

300303
##############################################################################
@@ -480,6 +483,10 @@ plot.density.profile = function(
480483
print_plot = F,
481484
line_width = line.width,
482485
variance_opacity = error.transparency) +
486+
labs(color = "regions group",
487+
fill = "regions group",
488+
linetype = "regions group",
489+
group = "regions group") +
483490
theme(legend.position = legend.position,
484491
legend.background = element_blank(),
485492
axis.line = element_line(size = axis.line.width),

R/plot.density.summary.R

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#' @title Plot the distribution of overall NGS density at specific regions from deepTools matrices.
22
#'
3-
#' @description Computes the score of each element in a list of regions and generates violins plots with percentiles and the mean (optional) for each sample/region. It uses as input a score matrix computed by deeptools's computeMatrix function or by \link{computeMatrix.deeptools} from this package.
3+
#' @description Computes the score of each element in a list of regions and generates violins plots with percentiles and the mean (optional) for each sample/region. It uses as input a score matrix computed by deeptools's computeMatrix function or by \link{computeMatrix.deeptools} and \link{density.matrix} functions from this package.
44
#'
5-
#' @param matrix.file A single string indicating a full path to a matrix.gz file generated by \code{deepTools/computeMatrix} or by \link{computeMatrix.deeptools}, or a list generated by the function \link{read.computeMatrix.file}.
5+
#' @param matrix.file A single string indicating a full path to a matrix.gz file generated by \code{deepTools/computeMatrix} or by \link{computeMatrix.deeptools}, or a list generated by the function \link{read.computeMatrix.file} or \link{density.matrix}.
66
#' @param plot.by.group Logical value to define whether plot by group of regions or by sample. By default \code{TRUE}.
77
#' @param missing.data.as.zero Logical value to define whether treat missing data as 0. If set as \code{FALSE} missing data will be converted to \code{NA} and will be excluded from the computations of the signal. By default \code{TRUE}.
88
#' @param sample.names Samples names could be defined by a string vector. If set as \code{NULL} sample names will be get automatically by the matrix file. By default \code{NULL}. \cr Example: \code{c("sample1", "sample2", "sample3")}
@@ -52,7 +52,7 @@
5252
#' @param by.row Logical value to define whether the plots should be arranged by row. By default \code{TRUE}.
5353
#' @param print.multiplot Logical value to define whether to print the multiplot once generated. By default \code{FALSE}.
5454
#'
55-
#' @return The functions returns a list containing:
55+
#' @return The function returns a list containing:
5656
#' \itemize{
5757
#' \item \code{data.table} with the computed values used for the plot;
5858
#' \item \code{metadata} table with the information obtained from the matrix_file.gz;
@@ -334,7 +334,10 @@ plot.density.summary = function(
334334

335335
# Merge of all the tables in a single one
336336
full.stat.table = purrr::reduce(.x = sample.stat.table.list, .f = rbind)
337-
full.stat.table = Rseb::move.df.col(data.frame = full.stat.table, move.command = "sample first")
337+
full.stat.table =
338+
Rseb::move.df.col(data.frame = full.stat.table, move.command = "sample first") %>%
339+
dplyr::mutate(sample = factor(sample, levels = sample_names),
340+
group = factor(group, levels = group_names))
338341

339342

340343
#############################################################################
@@ -967,7 +970,7 @@ plot.density.summary = function(
967970
## generate the table with regions (from the matrix, equivalent to the bed used) to add then to the full.stat.table
968971

969972
# Bed files from original matrix
970-
regions.position = m$matrix.data[, 1:6]
973+
regions.position = matrix.data[, 1:6]
971974
names(regions.position) = c("chr", "start", "end", "name", "score", "strand")
972975

973976
# Repeating the regions n times as the number of samples

R/read.computeMatrix.file.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
#'
99
#' @return The functions returns a named list containing:
1010
#' \itemize{
11-
#' \item \code{metadata} data.frame with the information gotten from the matrix_file.gz;
12-
#' \item \code{matrix.data} data.frame with the scores gotten from;
13-
#' \item \code{original.file.path} with full path to the original matrix_file.gz.
11+
#' \item{\code{metadata}}{data.frame with the information gotten from the matrix_file.gz}
12+
#' \item{\code{matrix.data}}{data.frame with the scores gotten from}
13+
#' \item{\code{original.file.path}}{with full path to the original matrix_file.gz.}
1414
#' }
1515
#' This list can be passed as it is to the function \link{plot.density.profile}.
1616
#'

man/CNV.data.Rd

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/RNAseq.Rd

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/actualize.Rd

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/deeptools.matrix.Rd

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/density.matrix.Rd

Lines changed: 68 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)