diff --git a/DESCRIPTION b/DESCRIPTION index a65c7a5..063a305 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -5,53 +5,57 @@ Version: 0.1.0 Author: Chirag Parsania Maintainer: Chirag Parsania Description: The package contains utility functions to deal with day to - day bioinformatics tasks. Most of the functions are related to RNA-seq data analysis and visualization. + day bioinformatics tasks. Most of the functions are related to RNA-seq + data analysis and visualization. License: MIT + file LICENSE URL: https://github.com/cparsania/parcutils BugReports: https://github.com/cparsania/parcutils/issues +Depends: + ggplot2, + magrittr Imports: + AnnotationDbi, + BSgenome, + circlize (>= 0.4.13), cli (>= 3.0.1), + clusterProfiler, + ComplexHeatmap, DESeq2 (>= 1.30.0), dplyr (>= 0.8.5), + EnhancedVolcano, + EnrichedHeatmap, + enrichplot, + forcats, + fs, GenomicRanges (>= 1.38.0), + GGally, + ggcorrplot, + ggeasy, + ggrepel, + ggvenn, glue, + MetBrewer (>= 0.1.0), + msigdbr, + org.Mm.eg.db, + plyranges, + progress, purrr (>= 0.3.4), readr (>= 2.0.1), rlang (>= 0.4.11), rtracklayer (>= 1.46.0), + scales, + stringr, tibble (>= 3.0.1), tidyr (>= 1.1.3), tidyselect (>= 1.1.1), TidyWrappers (>= 0.0.1.9000), tools (>= 3.6.2), UpSetR (>= 1.4.0), - ComplexHeatmap, - MetBrewer (>= 0.1.0), - circlize (>= 0.4.13), - forcats, - stringr, - GGally, - fs, - ggeasy, - ggcorrplot, viridis, - writexl, - progress, - plyranges, - EnhancedVolcano, - scales, - AnnotationDbi, - BSgenome, - clusterProfiler, - enrichplot, - ggrepel, - ggvenn, - EnrichedHeatmap, - org.Mm.eg.db, - msigdbr -Depends: - magrittr, - ggplot2 + writexl +Suggests: + BSgenome.Hsapiens.UCSC.hg38, + org.Hs.eg.db Remotes: cparsania/TidyWrappers, jokergoo/circlize @@ -59,6 +63,3 @@ Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) RoxygenNote: 7.2.2 -Suggests: - BSgenome.Hsapiens.UCSC.hg38, - org.Hs.eg.db diff --git a/R/chip_related.R b/R/chip_related.R index 6770476..6d78cc5 100644 --- a/R/chip_related.R +++ b/R/chip_related.R @@ -3,14 +3,14 @@ #' @description This function creates an object of the \code{parcutils_chip}. parcutils_chip is an extension of the the \code{RangedSummarizedExperiment}. #' This object make sure that it contains necessary elements to perform downstream chipseq analysis. Downstream exploratory and visualization functions will be based on this object. #' @param x a list of the object(s) of \code{normalisedMatrix}. -#' @param row_ranges an object of the class GenomicRanges. Each range must be identified by an unique id stored in a column \code{name}, +#' @param row_ranges an object of the class GenomicRanges. Each range must be identified by an unique id stored in a column \code{name}. #' @details RPM is calculated by the function RowSums applied on the each row of the #' \code{normalized_matrix}. #' @return an object of the class parcutils_chip. Class parcutils_chip extends to RangedSummarizedExperiment. It contains data in the below format #' \itemize{ -#' \item{"assay"} {These is the object of NormalisedMatrix for the sample.} -#' \item{"columns"} {Columns are the columns in each assays. In this case they are the bins described in NormalisedMatrix.} -#' \item{"rowData"} {RPM value for each feature (row) across samples. } +#' \item{"assay"} {These are objects of the class \code{NormalisedMatrix} for each sample.} +#' \item{"columns"} {Columns are the columns in each assay. In this case they are the bins described in \code{NormalisedMatrix}.} +#' \item{"rowData"} {RPM value for each feature (row) across samples. For each feature RPM is the sum of all bins within a row. } #' } #' @export #' @@ -22,9 +22,10 @@ #' score = c(1, 2, 3, 1, 2, 3, 1, 2, 3)) #' target = GRanges(seqnames = "chr1", ranges = IRanges(start = 10, end = 20), name = "feat_1") #' x = normalizeToMatrix(signal, target, extend = 10, w = 2) -#' rownames(x) <- "feat_1" +#' rownames(x) <- "feat_1" #' make_parcutils_chip(x, target) #' +#' make_parcutils_chip <- function(x,row_ranges){ # validate assays @@ -79,7 +80,7 @@ make_parcutils_chip <- function(x,row_ranges){ #' @keywords internal #' @examples #' \dontrun{ - +#' # // todo #' } parcutils_chip <- setClass(Class = "parcutils_chip", contains="RangedSummarizedExperiment") @@ -94,7 +95,7 @@ parcutils_chip <- setClass(Class = "parcutils_chip", contains="RangedSummarizedE #' #' @examples #' \dontrun{ - +#' #// TODO #' } normalised_matrix_to_rpm <- function(x){ @@ -128,18 +129,17 @@ normalised_matrix_to_rpm <- function(x){ } -# a function to validate a list of normalised matrix. #' Validate a list of normalised matrix. #' #' @param x a list of the object(s) of \code{normalisedMatrix}. #' @return a list of the object(s) of \code{normalisedMatrix}. #' @export - +#' #' @keywords internal #' @examples #' \dontrun{ -#' // TODO +#' # // TODO #' } .validate_a_list_of_normalised_matrix <- function(x){ @@ -196,13 +196,13 @@ normalised_matrix_to_rpm <- function(x){ #' \preformatted{ .parallel_import_bw_files("path/do/bw/files)} #' \preformatted{ future::plan(future::sequential())} #' -#' Number of availabe threads/workers can be identified by [future::availableWorkers()] and +#' Number of available threads/workers can be identified by [future::availableWorkers()] and #' [future::availableCores()]. #' #' @return a list of GRanges object. Each GRanges object is an output of the function [rtracklayer::import.bw()]. #' @export - -#' @keywords {internal} +#' +#' @keywords internal #' @examples #' \dontrun{ #' } @@ -242,7 +242,7 @@ normalised_matrix_to_rpm <- function(x){ #' Import top features (ranked by score) from a bed file. #' #' @param bed_feature_file a character string denoting a valid bed file. -#' @param topn a numeric value, default 5000, denoting number of top features to keep. Features are ranked by a column \code{score}. +#' @param topn a numeric value, default 5000, denoting number of top features to keep. Top features are selected by a score column \code{score}. #' @param center logical, denoting whether to align each feature by central position. If TRUE, default, it will return a ranges of single nucleotide (width = 0) denting a central position of each feature. #' @param ... Other arguments pass to the function [rtracklayer::import.bed()]. #' @return an object of the \code{GRanges} containing \code{topn} features. @@ -250,6 +250,7 @@ normalised_matrix_to_rpm <- function(x){ #' #' @examples #' \dontrun{ +#' # TODO #' } import_topn_bed_features <- function(bed_feature_file,topn = 5000, center = TRUE,...){ @@ -272,11 +273,11 @@ import_topn_bed_features <- function(bed_feature_file,topn = 5000, center = TRUE #' Create a HeatmapList from parcutils_chip. #' -#' @param x an object of the class parcutils_chip. -#' @param cluster_targets_by_rpm logical, denoting weather to cluster targets by RPM value. +#' @param x an object of the class \code{parcutils_chip}. +#' @param cluster_targets_by_rpm logical, denoting whether to cluster targets by RPM value. #' @param cluster_by NULL (default) or character vector denoting RPM columns to be used for clustering. #' @param n_clust a numeric, default 2, denoting number of clusters for kmeans clustering. -#' @param cluster_rows logical, default FALSE, denoting weather to cluster rows using default clustering. This must be always false as kmeans is implimented. +#' @param cluster_rows logical, default FALSE, denoting whether to cluster rows using default clustering. This must be always false as kmeans is implimented. #' @param heatmap_columns NULL (default) or character vector denoting columns to be displayed in the heatmap. #' @param heatmap_column_title NULL (default) or character vector denoting title for each heatmap column. #' @param heatmap_pos_line logical, default FALSE, internally passed to \code{pos_line} argument of [EnrichedHeatmap::EnrichedHeatmap()]. @@ -432,21 +433,6 @@ make_enriched_heatmap_list <- function(x, - - - - - - - - - - - - - - - #' Generate a ChIP signal heatmap for a given sample. #' #' @description This function plots the ChIP signal heatmap for the given set of target region. ChIP signals shown in the plot will be plotted as an output of [EnrichedHeatmap::normalizeToMatrix()]. #' @details To obtain the order of targets from the output heatmap the suggested approach is `hm = ComplexHeatmap::draw(hm); ComplexHeatmap::row_order(hm)`. @@ -533,7 +519,7 @@ get_chip_signal_heatmap <- function(path_to_bw_file , #' Generate a ChIP signal heatmap of treatment over control. #' @description This function plots the ChIP signal heatmap for the given set of target region. -#' ChIP signals shown in the plot is the ratio of the treatment over control. Ratio will be calculated for each bin of the target region. Prior to calculate the ratio integer 1 will be added to both numerator and denominator to avoid the Inf and NaN from the final matrix. +#' ChIP signals shown in the plot are the ratio of the treatment over control. Ratio will be calculated for each bin of the target region. Prior to calculate the ratio integer 1 will be added to both numerator and denominator to avoid the Inf and NaN from the final matrix. #' @details To obtain the order of targets from the output heatmap the suggested approach is `hm = ComplexHeatmap::draw(hm); ComplexHeatmap::row_order(hm)`. #' @param path_control_bw a character string denoting a path to a bw file. String can be an absolute path or the valid URL pointing to bw file. Singals from this file will be used as numerator to calculate the fold change. #' @param path_treatment_bw a character string denoting a path to a bw file. String can be an absolute path or the valid URL pointing to bw file. Singals from this file will be used as denominator to calculate the fold change. @@ -743,8 +729,8 @@ get_three_prime_flank_motif <- function(x, #' @description Given an object of the class \code{parcutils_chip} it generates correlation heatmap for selected samples and observations (peaks). #' @details correlation is calculated based on RPM value of each feature. RPM is simply sum of values across the feature i.e. rowsum. #' @param x an object of the class \code{parcutils_chip}. -#' @param samples a character vector denoting samples to show in the plot. Values must be a subset of \code{names(assays(x))}. -#' @param peaks a character vector denoting peaks (observations) to use for correlation. Values must be a subset of \code{rownames(RowData(x))}. +#' @param samples a character vector denoting samples to show in the plot. Values must be a subset of \code{colnames(rowData(x))}. +#' @param peaks a character vector denoting peaks (observations) to use for correlation. Values must be a subset of \code{rownames(rowData(x))}. #' @param rename_samples a character vector denoting sample names to show in the plot. Values must be of same order and length of values given as an argument \code{sample}. #' @param scale_min a numeric value denoting a minimum value for the scale. #' @param scale_max a numeric value denoting a maximum value for the scale. diff --git a/docs/reference/dot-parallel_import_bw_files.html b/docs/reference/dot-parallel_import_bw_files.html index 9b9072a..c1e6c0d 100644 --- a/docs/reference/dot-parallel_import_bw_files.html +++ b/docs/reference/dot-parallel_import_bw_files.html @@ -70,7 +70,7 @@

Details
 .parallel_import_bw_files("path/do/bw/files)
-

Number of availabe threads/workers can be identified by future::availableWorkers() and +

Number of available threads/workers can be identified by future::availableWorkers() and future::availableCores().

diff --git a/docs/reference/dot-validate_a_list_of_normalised_matrix.html b/docs/reference/dot-validate_a_list_of_normalised_matrix.html index 951f63e..07c86a8 100644 --- a/docs/reference/dot-validate_a_list_of_normalised_matrix.html +++ b/docs/reference/dot-validate_a_list_of_normalised_matrix.html @@ -66,7 +66,10 @@

Value

Examples

- +
if (FALSE) {
+# // TODO
+}
+
diff --git a/docs/reference/get_chip_signal_over_control_heatmap.html b/docs/reference/get_chip_signal_over_control_heatmap.html index 04bab26..d3599b7 100644 --- a/docs/reference/get_chip_signal_over_control_heatmap.html +++ b/docs/reference/get_chip_signal_over_control_heatmap.html @@ -1,7 +1,7 @@ Generate a ChIP signal heatmap of treatment over control. — get_chip_signal_over_control_heatmap • parcutils @@ -46,7 +46,7 @@

This function plots the ChIP signal heatmap for the given set of target region. -ChIP signals shown in the plot is the ratio of the treatment over control. Ratio will be calculated for each bin of the target region. Prior to calculate the ratio integer 1 will be added to both numerator and denominator to avoid the Inf and NaN from the final matrix.

+ChIP signals shown in the plot are the ratio of the treatment over control. Ratio will be calculated for each bin of the target region. Prior to calculate the ratio integer 1 will be added to both numerator and denominator to avoid the Inf and NaN from the final matrix.

@@ -91,35 +91,35 @@

ArgumentsEnrichedHeatmap::normalizeToMatrix().

extend
-

pass to the same argument of EnrichedHeatmap::normalizeToMatrix().

+

pass to the same argument of EnrichedHeatmap::normalizeToMatrix().

mean_mode
-

pass to the same argument of EnrichedHeatmap::normalizeToMatrix().

+

pass to the same argument of EnrichedHeatmap::normalizeToMatrix().

keep
-

pass to the same argument of EnrichedHeatmap::normalizeToMatrix().

+

pass to the same argument of EnrichedHeatmap::normalizeToMatrix().

w
-

pass to the same argument of EnrichedHeatmap::normalizeToMatrix().

+

pass to the same argument of EnrichedHeatmap::normalizeToMatrix().

target_ratio
-

pass to the same argument of EnrichedHeatmap::normalizeToMatrix().

+

pass to the same argument of EnrichedHeatmap::normalizeToMatrix().

smooth
-

pass to the same argument of EnrichedHeatmap::normalizeToMatrix().

+

pass to the same argument of EnrichedHeatmap::normalizeToMatrix().

...
-

other arguments pass to the function EnrichedHeatmap::EnrichedHeatmap().

+

other arguments pass to the function EnrichedHeatmap::EnrichedHeatmap().

diff --git a/docs/reference/import_topn_bed_features.html b/docs/reference/import_topn_bed_features.html index 0fde0de..98e2a9e 100644 --- a/docs/reference/import_topn_bed_features.html +++ b/docs/reference/import_topn_bed_features.html @@ -58,7 +58,7 @@

ArgumentsValue

Examples

if (FALSE) {
+# TODO
 }
 
diff --git a/docs/reference/make_enriched_heatmap_list.html b/docs/reference/make_enriched_heatmap_list.html index 8f32da4..8037924 100644 --- a/docs/reference/make_enriched_heatmap_list.html +++ b/docs/reference/make_enriched_heatmap_list.html @@ -71,11 +71,11 @@

Usage

Arguments

x
-

an object of the class parcutils_chip.

+

an object of the class parcutils_chip.

cluster_targets_by_rpm
-

logical, denoting weather to cluster targets by RPM value.

+

logical, denoting whether to cluster targets by RPM value.

cluster_by
@@ -87,7 +87,7 @@

ArgumentsArguments

Value

-

an object of the class parcutils_chip. Class parcutils_chip extends to RangedSummarizedExperiment. It contains data in the below format

  • "assay" These is the object of NormalisedMatrix for the sample.

  • -
  • "columns" Columns are the columns in each assays. In this case they are the bins described in NormalisedMatrix.

  • -
  • "rowData" RPM value for each feature (row) across samples.

  • +

    an object of the class parcutils_chip. Class parcutils_chip extends to RangedSummarizedExperiment. It contains data in the below format

    • "assay" These are objects of the class NormalisedMatrix for each sample.

    • +
    • "columns" Columns are the columns in each assay. In this case they are the bins described in NormalisedMatrix.

    • +
    • "rowData" RPM value for each feature (row) across samples. For each feature RPM is the sum of all bins within a row.

Details

@@ -90,11 +90,12 @@

Examples#> Error in GRanges(seqnames = "chr1", ranges = IRanges(start = 10, end = 20), name = "feat_1"): could not find function "GRanges" x = normalizeToMatrix(signal, target, extend = 10, w = 2) #> Error in normalizeToMatrix(signal, target, extend = 10, w = 2): could not find function "normalizeToMatrix" - rownames(x) <- "feat_1" +rownames(x) <- "feat_1" #> Error in rownames(x) <- "feat_1": object 'x' not found make_parcutils_chip(x, target) #> Error in .validate_a_list_of_normalised_matrix(x = x): object 'x' not found +