Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-gregoricchio committed Apr 13, 2021
1 parent e97bbe8 commit f3cae6a
Show file tree
Hide file tree
Showing 15 changed files with 1,453 additions and 24 deletions.
41 changes: 41 additions & 0 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#' @title RNA-seq example
#' @description Extract of a DESeq2 result for differential expression analysis on RNA-seq data
#' @format A data frame with 300 rows and 7 variables:
#' \describe{
#' \item{\code{geneName}}{genes symbols}
#' \item{\code{baseMean}}{The average of the normalized count values, dividing by size factors, taken over all samples}
#' \item{\code{log2FC}}{the log2 value of the Fold Change expression between two conditions}
#' \item{\code{lfcSE}}{log2 Fold Change standard error (SE)}
#' \item{\code{stat}}{Wald statistic}
#' \item{\code{pvalue}}{Wald test p-value}
#' \item{\code{padj}}{BH adjusted p-values}
#'}
#' @source \url{http://path.to.paper/}
"RNAseq"
#'
#'
#'
#'
#' @title RNA-seq example
#' @description List result of the function \code{read.computeMatrix.file} used to read a matrix.gz file generated by deepTools computeMatrix function.
#' @format A named list of 3 variables:
#' \describe{
#' \item{\code{metadata}}{data.frame with the information gotten from the matrix_file.gz}
#' \item{\code{matrix.data}}{data.frame with the scores gotten from}
#' \item{\code{original.file.path}}{with full path to the original matrix_file.gz}
#'}
#' @source \url{http://path.to.paper/}
"deeptools.matrix"
#'
#'
#'
#'
#' @title CNV data results example
#' @description Simulation of Copy Number Variation (CNV) analysis on a cohort of patients.
#' @format A data frame with 25 rows and 9 variables:
#' \describe{
#' \item{\code{geneName}}{hypothetical gene symbols}
#' \item{\code{patient_1 ... patient_N}}{hypothetical patients ID}
#'}
#' @source Simulated data
"CNV.data"
399 changes: 399 additions & 0 deletions R/density.matrix.R

Large diffs are not rendered by default.

657 changes: 657 additions & 0 deletions R/plot.density.differences.R

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions R/plot.density.profile.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#' @title Plot of NGS density signal at specific regions from deepTools matrices.
#'
#' @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.
#' @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.
#'
#' @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}.
#' @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}.
#' @param plot.by.group Logical value to define whether plot by group of regions or by sample. By default \code{TRUE}.
#' @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}.
#' @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")}
Expand Down Expand Up @@ -34,7 +34,7 @@
#' @param by.row Logical value to define whether the plots should be arranged by row. By default \code{TRUE}.
#' @param print.multiplot Logical value to define whether to print the multiplot once created. By default \code{FALSE}.
#'
#' @return The functions returns a list containing:
#' @return The function returns a list containing:
#' \itemize{
#' \item \code{data.table} with the computed values used for the plot;
#' \item \code{metadata} table with the information gotten from the matrix_file.gz;
Expand Down Expand Up @@ -294,7 +294,10 @@ plot.density.profile = function(


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


##############################################################################
Expand Down Expand Up @@ -480,6 +483,10 @@ plot.density.profile = function(
print_plot = F,
line_width = line.width,
variance_opacity = error.transparency) +
labs(color = "regions group",
fill = "regions group",
linetype = "regions group",
group = "regions group") +
theme(legend.position = legend.position,
legend.background = element_blank(),
axis.line = element_line(size = axis.line.width),
Expand Down
13 changes: 8 additions & 5 deletions R/plot.density.summary.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#' @title Plot the distribution of overall NGS density at specific regions from deepTools matrices.
#'
#' @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.
#' @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.
#'
#' @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}.
#' @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}.
#' @param plot.by.group Logical value to define whether plot by group of regions or by sample. By default \code{TRUE}.
#' @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}.
#' @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")}
Expand Down Expand Up @@ -52,7 +52,7 @@
#' @param by.row Logical value to define whether the plots should be arranged by row. By default \code{TRUE}.
#' @param print.multiplot Logical value to define whether to print the multiplot once generated. By default \code{FALSE}.
#'
#' @return The functions returns a list containing:
#' @return The function returns a list containing:
#' \itemize{
#' \item \code{data.table} with the computed values used for the plot;
#' \item \code{metadata} table with the information obtained from the matrix_file.gz;
Expand Down Expand Up @@ -334,7 +334,10 @@ plot.density.summary = function(

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


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

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

# Repeating the regions n times as the number of samples
Expand Down
6 changes: 3 additions & 3 deletions R/read.computeMatrix.file.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#'
#' @return The functions returns a named list containing:
#' \itemize{
#' \item \code{metadata} data.frame with the information gotten from the matrix_file.gz;
#' \item \code{matrix.data} data.frame with the scores gotten from;
#' \item \code{original.file.path} with full path to the original matrix_file.gz.
#' \item{\code{metadata}}{data.frame with the information gotten from the matrix_file.gz}
#' \item{\code{matrix.data}}{data.frame with the scores gotten from}
#' \item{\code{original.file.path}}{with full path to the original matrix_file.gz.}
#' }
#' This list can be passed as it is to the function \link{plot.density.profile}.
#'
Expand Down
23 changes: 23 additions & 0 deletions man/CNV.data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions man/RNAseq.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion man/actualize.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions man/deeptools.matrix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions man/density.matrix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f3cae6a

Please sign in to comment.