Skip to content

Commit

Permalink
check
Browse files Browse the repository at this point in the history
  • Loading branch information
showteeth committed Jul 5, 2022
1 parent 4d506dd commit adc32f1
Show file tree
Hide file tree
Showing 42 changed files with 373 additions and 328 deletions.
21 changes: 14 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Authors@R:
person(given = "Yabing",
family = "Song",
role = c("aut", "cre"),
email = "[email protected]",
comment = c(ORCID = "YOUR-ORCID-ID"))
email = "[email protected]")
Maintainer: Yabing Song <[email protected]>
Description: DEbChIP aims to explore, analyze, visualize and interpret RNA-seq data. It contains five functional panels: Quality Control (QC),
Principal Component Analysis (PCA), Differential Expression Analysis (DEA), Functional Enrichment Analysis (FEA), Integrate with ChIP-seq (DEbChIP), Utils.
License: MIT + file LICENSE
Expand All @@ -16,7 +16,6 @@ RoxygenNote: 7.1.1
Depends:
R (>= 4.0.0)
Imports:
BiocGenerics,
BiocManager,
circlize,
clusterProfiler (>= 3.18.1),
Expand All @@ -32,6 +31,8 @@ Imports:
ggplot2,
ggplotify,
ggrepel,
ggvenn,
ggupset,
graphics,
grDevices,
grid,
Expand All @@ -44,6 +45,7 @@ Imports:
RColorBrewer,
reshape2,
rrcov,
rlang,
stats,
stringr,
SummarizedExperiment,
Expand All @@ -53,11 +55,16 @@ Imports:
utils,
ChIPseeker,
GenomeInfoDb,
ggvenn,
viridis
viridis,
patchwork
Suggests:
rmarkdown,
knitr
knitr,
msigdbr,
htmltools,
BiocStyle,
airway
Remotes:
GuangchuangYu/enrichplot
YuLab-SMU/enrichplot
YuLab-SMU/ChIPseeker
VignetteBuilder: knitr
16 changes: 16 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ import(ChIPseeker)
import(ComplexHeatmap)
import(clusterProfiler)
import(ggplot2)
import(ggupset)
import(ggvenn)
importFrom(BiocManager,install)
importFrom(ComplexHeatmap,draw)
importFrom(ComplexHeatmap,pheatmap)
importFrom(DEFormats,as.DESeqDataSet)
importFrom(DEFormats,as.DGEList)
importFrom(DESeq2,DESeqDataSetFromMatrix)
importFrom(DESeq2,counts)
importFrom(DESeq2,estimateSizeFactors)
importFrom(DESeq2,normTransform)
Expand Down Expand Up @@ -84,8 +86,17 @@ importFrom(enrichplot,dotplot)
importFrom(enrichplot,gseaplot2)
importFrom(ggplotify,as.ggplot)
importFrom(ggrepel,geom_text_repel)
importFrom(grDevices,col2rgb)
importFrom(grDevices,colorRampPalette)
importFrom(grDevices,dev.off)
importFrom(grDevices,pdf)
importFrom(grDevices,rgb)
importFrom(graphics,abline)
importFrom(graphics,barplot)
importFrom(graphics,image)
importFrom(graphics,legend)
importFrom(graphics,mtext)
importFrom(graphics,title)
importFrom(grid,grid.grabExpr)
importFrom(magrittr,"%>%")
importFrom(matrixStats,rowVars)
Expand All @@ -94,10 +105,13 @@ importFrom(plot3D,scatter3D)
importFrom(plot3D,text3D)
importFrom(purrr,set_names)
importFrom(reshape2,melt)
importFrom(rlang,":=")
importFrom(rrcov,PcaGrid)
importFrom(rrcov,PcaHubert)
importFrom(stats,as.formula)
importFrom(stats,cor)
importFrom(stats,dist)
importFrom(stats,na.omit)
importFrom(stats,prcomp)
importFrom(stringr,str_wrap)
importFrom(sva,ComBat_seq)
Expand All @@ -106,4 +120,6 @@ importFrom(tibble,deframe)
importFrom(tibble,rownames_to_column)
importFrom(tidyr,drop_na)
importFrom(utils,read.table)
importFrom(utils,write.csv)
importFrom(utils,write.table)
importFrom(viridis,viridis)
2 changes: 1 addition & 1 deletion R/ChIP_consensus_peak.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ GetConsensusPeak <- function(peak.file, peak.folder = NULL, mspc.path = NULL, re

# prepare input files
if (!is.null(peak.folder)) {
peak.file <- list.files(path = peak.folder, full.names = T)
peak.file <- list.files(path = peak.folder, full.names = TRUE)
}
# check peak file number
if (length(peak.file) < 1) {
Expand Down
37 changes: 2 additions & 35 deletions R/ChIP_peak_annotation.R
Original file line number Diff line number Diff line change
@@ -1,37 +1,3 @@
# 存在的问题:
# * gene id的对应问题

# https://bioconductor.org/packages/3.15/data/annotation/
# BiocManager::install(c("TxDb.Athaliana.BioMart.plantsmart28","TxDb.Btaurus.UCSC.bosTau9.refGene",
# "TxDb.Celegans.UCSC.ce11.refGene","TxDb.Cfamiliaris.UCSC.canFam3.refGene",
# "TxDb.Dmelanogaster.UCSC.dm6.ensGene","TxDb.Drerio.UCSC.danRer11.refGene",
# "TxDb.Ggallus.UCSC.galGal6.refGene","TxDb.Hsapiens.UCSC.hg38.knownGene",
# "TxDb.Mmulatta.UCSC.rheMac10.refGene","TxDb.Mmusculus.UCSC.mm10.knownGene",
# "TxDb.Ptroglodytes.UCSC.panTro6.refGene","TxDb.Sscrofa.UCSC.susScr11.refGene",
# "TxDb.Rnorvegicus.UCSC.rn6.refGene","TxDb.Scerevisiae.UCSC.sacCer3.sgdGene"))

# TxDb.Athaliana.BioMart.plantsmart28: Arabidopsis thaliana
# TxDb.Btaurus.UCSC.bosTau9.refGene: Bos taurus
# TxDb.Celegans.UCSC.ce11.refGene: Caenorhabditis elegans
# TxDb.Cfamiliaris.UCSC.canFam3.refGene: Canis familiaris
# TxDb.Dmelanogaster.UCSC.dm6.ensGene: Drosophila melanogaster
# TxDb.Drerio.UCSC.danRer11.refGene: Danio rerio
# TxDb.Ggallus.UCSC.galGal6.refGene: Gallus gallus
# TxDb.Hsapiens.UCSC.hg38.knownGene: Homo sapiens
# TxDb.Mmulatta.UCSC.rheMac10.refGene: Macaca mulatta
# TxDb.Mmusculus.UCSC.mm10.knownGene: Mus musculus
# TxDb.Ptroglodytes.UCSC.panTro6.refGene: Pan troglodytes
# TxDb.Sscrofa.UCSC.susScr11.refGene: Sus scrofa
# TxDb.Rnorvegicus.UCSC.rn6.refGene: Rattus norvegicus
# TxDb.Scerevisiae.UCSC.sacCer3.sgdGene: Saccharomyces cerevisiae

# genes(TxDb.Mmulatta.UCSC.rheMac10.refGene, columns=c("TXID", "TXNAME", "GENEID"))
#
# library(TxDb.Hsapiens.UCSC.hg38.knownGene)
# #
# seqlevelsStyle(TxDb.Hsapiens.UCSC.hg38.knownGene)


# get txdb and orgdb for species
GetSpeciesAnno <- function(species) {
spe_names <- c(
Expand Down Expand Up @@ -195,6 +161,7 @@ PeakProfile <- function(peak.df, species = c(
#' @importFrom ggplotify as.ggplot
#' @importFrom cowplot plot_grid
#' @import ChIPseeker
#' @import ggupset
#' @export
#'
#' @examples
Expand Down Expand Up @@ -248,7 +215,7 @@ AnnoPeak <- function(peak.df, species = c(
# annotation
txdb.obj <- get(txdb)
if (seq.style != "None") {
seqlevelsStyle(txdb.obj) <- seq.style
GenomeInfoDb::seqlevelsStyle(txdb.obj) <- seq.style
peak.seqs <- GenomeInfoDb::seqlevels(peak.gr)
# to avoid Unable to find an inherited method for function 'NSBS' for signature '"SortedByQueryHits"'
txdb.obj <- keepSeqlevels(x = txdb.obj, value = peak.seqs)
Expand Down
25 changes: 13 additions & 12 deletions R/DE_bind_ChIP.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
#' # RNA-Seq data
#' count.file <- system.file("extdata", "debchip_count.txt", package = "DEbChIP")
#' meta.file <- system.file("extdata", "debchip_meta.txt", package = "DEbChIP")
#' count.matrix <- read.table(file = count.file, header = T, sep = "\t")
#' meta.info <- read.table(file = meta.file, header = T)
#' count.matrix <- read.table(file = count.file, header = TRUE, sep = "\t")
#' meta.info <- read.table(file = meta.file, header = TRUE)
#' # create DESeqDataSet object
#' dds <- DESeq2::DESeqDataSetFromMatrix(
#' countData = count.matrix, colData = meta.info,
Expand All @@ -46,7 +46,7 @@
#' dds.results.ordered <- dds.results[order(dds.results$log2FoldChange, decreasing = TRUE), ]
#' # Integrated with RNA-Seq
#' debchip.res <- DEbChIP(
#' de.res = dds.results.ordered, chip.res = peak.anno.df,
#' de.res = dds.results.ordered, chip.res = peak.anno[["df"]],
#' chip.anno.key = "Promoter", merge.key = "SYMBOL"
#' )
DEbChIP <- function(de.res, chip.res, chip.anno.key = c("Promoter", "5' UTR", "3' UTR", "Exon", "Intron", "Downstream", "Distal Intergenic", "All"),
Expand Down Expand Up @@ -118,8 +118,8 @@ DEbChIP <- function(de.res, chip.res, chip.anno.key = c("Promoter", "5' UTR", "3
#' # RNA-Seq data
#' count.file <- system.file("extdata", "debchip_count.txt", package = "DEbChIP")
#' meta.file <- system.file("extdata", "debchip_meta.txt", package = "DEbChIP")
#' count.matrix <- read.table(file = count.file, header = T, sep = "\t")
#' meta.info <- read.table(file = meta.file, header = T)
#' count.matrix <- read.table(file = count.file, header = TRUE, sep = "\t")
#' meta.info <- read.table(file = meta.file, header = TRUE)
#' # create DESeqDataSet object
#' dds <- DESeq2::DESeqDataSetFromMatrix(
#' countData = count.matrix, colData = meta.info,
Expand All @@ -134,7 +134,7 @@ DEbChIP <- function(de.res, chip.res, chip.anno.key = c("Promoter", "5' UTR", "3
#' dds.results.ordered <- dds.results[order(dds.results$log2FoldChange, decreasing = TRUE), ]
#' # Integrated with RNA-Seq
#' debchip.res <- DEbChIP(
#' de.res = dds.results.ordered, chip.res = peak.anno.df,
#' de.res = dds.results.ordered, chip.res = peak.anno[["df"]],
#' chip.anno.key = "Promoter", merge.key = "SYMBOL"
#' )
#' # DE and ChIP venn plot
Expand Down Expand Up @@ -166,7 +166,8 @@ PlotDEbChIP <- function(de.chip, ...) {
#' @param go.type GO enrichment type, chosen from ALL, BP, MF, CC. Default: ALL.
#' @param enrich.pvalue Cutoff value of pvalue. Default: 0.05.
#' @param enrich.qvalue Cutoff value of qvalue. Default: 0.05.
#' @param org.db Organism database. Default: org.Mm.eg.db.
#' @param species Species used, chosen from "Human","Mouse","Rat","Fly","Arabidopsis","Yeast","Zebrafish","Worm","Bovine","Pig","Chicken","Rhesus",
#' "Canine","Xenopus","Anopheles","Chimp","E coli strain Sakai","Myxococcus xanthus DK 1622". Default: "Human".
#' @param padj.method One of "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none". Default: BH.
#' @param show.term Number of enrichment term to show. Default: 15.
#' @param str.width Length of enrichment term in plot. Default: 30.
Expand Down Expand Up @@ -202,8 +203,8 @@ PlotDEbChIP <- function(de.chip, ...) {
#' # RNA-Seq data
#' count.file <- system.file("extdata", "debchip_count.txt", package = "DEbChIP")
#' meta.file <- system.file("extdata", "debchip_meta.txt", package = "DEbChIP")
#' count.matrix <- read.table(file = count.file, header = T, sep = "\t")
#' meta.info <- read.table(file = meta.file, header = T)
#' count.matrix <- read.table(file = count.file, header = TRUE, sep = "\t")
#' meta.info <- read.table(file = meta.file, header = TRUE)
#' # create DESeqDataSet object
#' dds <- DESeq2::DESeqDataSetFromMatrix(
#' countData = count.matrix, colData = meta.info,
Expand All @@ -218,18 +219,18 @@ PlotDEbChIP <- function(de.chip, ...) {
#' dds.results.ordered <- dds.results[order(dds.results$log2FoldChange, decreasing = TRUE), ]
#' # Integrated with RNA-Seq
#' debchip.res <- DEbChIP(
#' de.res = dds.results.ordered, chip.res = peak.anno.df,
#' de.res = dds.results.ordered, chip.res = peak.anno[["df"]],
#' chip.anno.key = "Promoter", merge.key = "SYMBOL"
#' )
#' # functional enrichment on genes
#' fe.results <- DEbChIPFE(de.chip = debchip.res, gene.type = "ENTREZID", species = "Mouse", save = F)
#' fe.results <- DEbChIPFE(de.chip = debchip.res, gene.type = "ENTREZID", species = "Mouse", save = FALSE)
DEbChIPFE <- function(de.chip, out.folder = NULL, gene.type = c("ENSEMBL", "ENTREZID", "SYMBOL"), go.type = c("ALL", "BP", "MF", "CC"),
enrich.pvalue = 0.05, enrich.qvalue = 0.05, species = c(
"Human", "Mouse", "Rat", "Fly", "Arabidopsis", "Yeast", "Zebrafish", "Worm", "Bovine", "Pig", "Chicken", "Rhesus",
"Canine", "Xenopus", "Anopheles", "Chimp", "E coli strain Sakai", "Myxococcus xanthus DK 1622"
),
padj.method = c("BH", "holm", "hochberg", "hommel", "bonferroni", "BY", "fdr", "none"),
show.term = 15, str.width = 30, plot.resolution = 300, plot.width = 7, plot.height = 9, save = T) {
show.term = 15, str.width = 30, plot.resolution = 300, plot.width = 7, plot.height = 9, save = TRUE) {
# check parameter
gene.type <- match.arg(arg = gene.type)
go.type <- match.arg(arg = go.type)
Expand Down
Loading

0 comments on commit adc32f1

Please sign in to comment.