Skip to content

Commit 3984adf

Browse files
authored
Merge pull request #31 from m-jahn/dev
feat: various improvements for CRAN release version 1.4.0
2 parents d4f7f42 + f61e6d2 commit 3984adf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1621
-1046
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ inst/doc
22
.Rhistory
33
.Rproj*
44
.Rproj.user
5+
vignettes/*.html
6+
vignettes/png/*

DESCRIPTION

Lines changed: 35 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,60 @@
1-
Package: ggcoverage
21
Type: Package
2+
Package: ggcoverage
33
Title: Visualize Genome/Protein Coverage with Various Annotations
4-
Version: 1.3.0
4+
Version: 1.4.0
55
Authors@R: c(
6-
person(given = "Yabing",
7-
family = "Song",
8-
role = c("aut", "cre"),
9-
email = "[email protected]"),
10-
person(given = "Michael",
11-
family = "Jahn",
12-
email = "[email protected]",
13-
role = "aut",
6+
person("Yabing", "Song", , "[email protected]", role = c("aut", "cre", "cph")),
7+
person("Michael", "Jahn", , "[email protected]", role = c("aut", "cph"),
148
comment = c(ORCID = "0000-0002-3913-153X"))
159
)
16-
Maintainer: Yabing Song <[email protected]>
17-
Description: The goal of 'ggcoverage' is to simplify the process of visualizing genome/protein coverage. It contains functions to
18-
load data from BAM, BigWig, BedGraph or txt/xlsx files, create genome/protein coverage plot, add various annotations to
19-
the coverage plot, including base and amino acid annotation, GC annotation, gene annotation, transcript annotation, ideogram annotation,
20-
peak annotation, contact map annotation, link annotation and peotein feature annotation.
10+
Maintainer: Michael Jahn <[email protected]>
11+
Description: The goal of 'ggcoverage' is to simplify the process of
12+
visualizing genome/protein coverage. It contains functions to load
13+
data from BAM, BigWig, BedGraph or txt/xlsx files, create
14+
genome/protein coverage plots, add various annotations to the coverage
15+
plot, including base and amino acid annotation, GC annotation, gene
16+
annotation, transcript annotation, ideogram annotation, peak
17+
annotation, contact map annotation, link annotation and protein
18+
feature annotation.
2119
License: MIT + file LICENSE
22-
Encoding: UTF-8
23-
RoxygenNote: 7.3.1
24-
URL: https://showteeth.github.io/ggcoverage/, https://github.com/showteeth/ggcoverage
20+
URL: https://showteeth.github.io/ggcoverage/,
21+
https://github.com/showteeth/ggcoverage
2522
BugReports: https://github.com/showteeth/ggcoverage/issues
26-
biocViews:
2723
Imports:
24+
BiocParallel,
25+
Biostrings,
2826
dplyr,
27+
GenomeInfoDb,
28+
GenomicAlignments,
2929
GenomicRanges,
30-
ggbio,
3130
ggh4x,
31+
ggpattern,
3232
ggplot2,
3333
ggrepel,
3434
grDevices,
35+
gridExtra,
3536
IRanges,
36-
magrittr,
37+
methods,
3738
patchwork,
38-
RColorBrewer,
3939
rlang,
4040
Rsamtools,
4141
rtracklayer,
4242
scales,
4343
stats,
44-
utils,
45-
methods,
46-
GenomeInfoDb,
47-
S4Vectors,
48-
Biostrings,
49-
BSgenome,
50-
GenomicAlignments,
51-
reshape2,
52-
seqinr,
53-
ggforce,
54-
HiCBricks,
55-
ggpattern,
56-
BiocParallel,
57-
openxlsx,
58-
stringr,
59-
gridExtra
44+
utils
6045
Suggests:
61-
rmarkdown,
62-
knitr,
6346
BiocStyle,
64-
htmltools,
6547
BSgenome.Hsapiens.UCSC.hg19,
48+
ggbio,
49+
ggforce,
6650
graphics,
67-
HiCDataHumanIMR90
68-
VignetteBuilder: knitr
51+
HiCBricks,
52+
HiCDataHumanIMR90,
53+
htmltools,
54+
knitr,
55+
rmarkdown
56+
VignetteBuilder:
57+
knitr
58+
biocViews:
59+
Encoding: UTF-8
60+
RoxygenNote: 7.3.1

NAMESPACE

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export(FormatTrack)
1414
export(GetConsensusPeak)
1515
export(GetPlotData)
1616
export(LoadTrackFile)
17+
export(geom_arrows)
1718
export(geom_base)
1819
export(geom_cnv)
1920
export(geom_coverage)
@@ -45,14 +46,14 @@ export(theme_protein2)
4546
export(theme_tad)
4647
export(theme_tad2)
4748
export(theme_transcript)
48-
import(HiCBricks)
49-
importFrom(BSgenome,getSeq)
5049
importFrom(BiocParallel,MulticoreParam)
5150
importFrom(BiocParallel,bplapply)
5251
importFrom(BiocParallel,register)
52+
importFrom(Biostrings,getSeq)
5353
importFrom(Biostrings,letterFrequency)
5454
importFrom(Biostrings,readAAStringSet)
5555
importFrom(Biostrings,readDNAStringSet)
56+
importFrom(Biostrings,translate)
5657
importFrom(GenomeInfoDb,"seqlengths<-")
5758
importFrom(GenomeInfoDb,seqlengths)
5859
importFrom(GenomeInfoDb,seqnames)
@@ -69,10 +70,9 @@ importFrom(GenomicRanges,trim)
6970
importFrom(IRanges,IRanges)
7071
importFrom(IRanges,findOverlaps)
7172
importFrom(IRanges,subsetByOverlaps)
72-
importFrom(RColorBrewer,brewer.pal)
7373
importFrom(Rsamtools,ScanBamParam)
7474
importFrom(Rsamtools,indexBam)
75-
importFrom(S4Vectors,"values<-")
75+
importFrom(dplyr,"%>%")
7676
importFrom(dplyr,all_of)
7777
importFrom(dplyr,arrange)
7878
importFrom(dplyr,filter)
@@ -81,8 +81,6 @@ importFrom(dplyr,mutate)
8181
importFrom(dplyr,select)
8282
importFrom(dplyr,summarise)
8383
importFrom(dplyr,summarize)
84-
importFrom(ggbio,layout_karyogram)
85-
importFrom(ggforce,geom_bezier)
8684
importFrom(ggh4x,elem_list_rect)
8785
importFrom(ggh4x,facet_wrap2)
8886
importFrom(ggh4x,strip_themed)
@@ -99,6 +97,7 @@ importFrom(ggplot2,element_rect)
9997
importFrom(ggplot2,element_text)
10098
importFrom(ggplot2,expansion)
10199
importFrom(ggplot2,geom_bar)
100+
importFrom(ggplot2,geom_curve)
102101
importFrom(ggplot2,geom_hline)
103102
importFrom(ggplot2,geom_label)
104103
importFrom(ggplot2,geom_line)
@@ -114,7 +113,7 @@ importFrom(ggplot2,ggplot_add)
114113
importFrom(ggplot2,labs)
115114
importFrom(ggplot2,margin)
116115
importFrom(ggplot2,rel)
117-
importFrom(ggplot2,scale_color_gradient2)
116+
importFrom(ggplot2,scale_color_gradientn)
118117
importFrom(ggplot2,scale_color_manual)
119118
importFrom(ggplot2,scale_fill_manual)
120119
importFrom(ggplot2,scale_x_continuous)
@@ -125,22 +124,25 @@ importFrom(ggplot2,unit)
125124
importFrom(ggrepel,geom_text_repel)
126125
importFrom(grDevices,col2rgb)
127126
importFrom(grDevices,colorRampPalette)
127+
importFrom(grDevices,grey)
128128
importFrom(gridExtra,tableGrob)
129129
importFrom(gridExtra,ttheme_default)
130-
importFrom(magrittr,"%>%")
131130
importFrom(methods,extends)
132-
importFrom(openxlsx,read.xlsx)
133131
importFrom(patchwork,wrap_plots)
134-
importFrom(reshape2,melt)
135132
importFrom(rlang,.data)
136133
importFrom(rlang,as_label)
134+
importFrom(rtracklayer,GRangesForUCSCGenome)
135+
importFrom(rtracklayer,browserSession)
136+
importFrom(rtracklayer,getTable)
137137
importFrom(rtracklayer,import)
138+
importFrom(rtracklayer,tableName)
139+
importFrom(rtracklayer,ucscGenomes)
140+
importFrom(rtracklayer,ucscTableQuery)
138141
importFrom(scales,comma)
139142
importFrom(scales,rescale)
140143
importFrom(scales,scientific)
141-
importFrom(seqinr,translate)
142144
importFrom(stats,as.formula)
143-
importFrom(stringr,str_locate)
145+
importFrom(stats,reshape)
144146
importFrom(utils,menu)
145147
importFrom(utils,read.csv)
146148
importFrom(utils,read.table)

NEWS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# ggcoverage 1.4.0
2+
## Major changes
3+
* removed 11 strict dependencies, refactored many functions to work with basic solutions
4+
* formatted all R code with 'styler'
5+
* improved arrow style for genomic features
6+
7+
## Minor changes
8+
* fixed overlapping gene arrows issue
9+
* dont run failing ideogram example check
10+
* fixed unavailable URLS
11+
* use tidy description
12+
113
# ggcoverage 1.3.0
214
## Major changes
315
* Refactored `LoadTrack` function.

R/ConsensusPeak.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
GetConsensusPeak <- function(peak.file, peak.folder = NULL, mspc.path = NULL, rep.type = c("bio", "tec"), stringency.threshold = 1e-8,
2727
weak.threshold = 1e-4, gamma = 1e-8, alpha = 0.05, min.overlap.num = 1,
2828
multiple.intersections = c("Lowest", "Highest"), parallelism.degree = 1) {
29-
3029
# check parameters
3130
rep.type <- match.arg(arg = rep.type)
3231
multiple.intersections <- match.arg(arg = multiple.intersections)

R/FormatInput.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ GetRegion <- function(df, chr, start, end = NULL) {
4141
#' @param extend Extend length of \code{region}. Default: 2000.
4242
#'
4343
#' @return A dataframe.
44-
#' @importFrom magrittr %>%
44+
#' @importFrom dplyr %>%
4545
#' @importFrom dplyr filter arrange
4646
#'
4747
#' @export

R/LoadTrack.R

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#' @importFrom GenomicAlignments alphabetFrequencyFromBam readGAlignments coverage
3232
#' @importFrom GenomicRanges GRanges
3333
#' @importFrom IRanges IRanges subsetByOverlaps
34-
#' @importFrom magrittr %>%
34+
#' @importFrom dplyr %>%
3535
#' @importFrom dplyr select filter mutate all_of group_by summarize
3636
#' @importFrom BiocParallel register MulticoreParam bplapply
3737
#' @importFrom ggplot2 cut_width
@@ -56,17 +56,16 @@
5656
#' meta.info = sample.meta
5757
#' )
5858
LoadTrackFile <- function(
59-
track.file, track.folder = NULL,
60-
format = c("bam", "wig", "bw", "bedgraph", "txt"),
61-
region = NULL, extend = 2000,
62-
gtf.gr = NULL, gene.name = "HNRNPC",
63-
gene.name.type = c("gene_name", "gene_id"),
64-
meta.info = NULL, meta.file = "",
65-
bamcoverage.path = NULL,
66-
norm.method = c("RPKM", "CPM", "BPM", "RPGC", "None"),
67-
single.nuc = FALSE, single.nuc.region = NULL,
68-
bin.size = 10, bc.extra.para = NULL, n.cores = 1
69-
) {
59+
track.file, track.folder = NULL,
60+
format = c("bam", "wig", "bw", "bedgraph", "txt"),
61+
region = NULL, extend = 2000,
62+
gtf.gr = NULL, gene.name = "HNRNPC",
63+
gene.name.type = c("gene_name", "gene_id"),
64+
meta.info = NULL, meta.file = "",
65+
bamcoverage.path = NULL,
66+
norm.method = c("RPKM", "CPM", "BPM", "RPGC", "None"),
67+
single.nuc = FALSE, single.nuc.region = NULL,
68+
bin.size = 10, bc.extra.para = NULL, n.cores = 1) {
7069
# check parameters
7170
format <- match.arg(arg = format)
7271
gene.name.type <- match.arg(arg = gene.name.type)
@@ -83,8 +82,8 @@ LoadTrackFile <- function(
8382
if (format == "bam") {
8483
seqnames <- Rsamtools::scanBamHeader(track.file[1]) %>%
8584
lapply(function(x) x$targets) %>%
86-
unname %>%
87-
unlist
85+
unname() %>%
86+
unlist()
8887
gr <- GenomicRanges::GRanges(
8988
seqnames = names(seqnames[1]),
9089
IRanges(start = 1, end = min(100000, seqnames[1]))
@@ -128,20 +127,20 @@ LoadTrackFile <- function(
128127
BiocParallel::bplapply(track.file, BPPARAM = BiocParallel::MulticoreParam(), FUN = index_bam)
129128
}
130129
if (single.nuc) {
131-
if (is.null(n.cores) || n.cores == 1) {
132-
track.list <- lapply(
133-
track.file,
134-
single_nuc_cov,
135-
single.nuc.region
136-
)
137-
} else {
138-
track.list <- BiocParallel::bplapply(
139-
track.file,
140-
BPPARAM = BiocParallel::MulticoreParam(),
141-
FUN = single_nuc_cov,
142-
single.nuc.region
143-
)
144-
}
130+
if (is.null(n.cores) || n.cores == 1) {
131+
track.list <- lapply(
132+
track.file,
133+
single_nuc_cov,
134+
single.nuc.region
135+
)
136+
} else {
137+
track.list <- BiocParallel::bplapply(
138+
track.file,
139+
BPPARAM = BiocParallel::MulticoreParam(),
140+
FUN = single_nuc_cov,
141+
single.nuc.region
142+
)
143+
}
145144
} else {
146145
if (norm.method == "None") {
147146
message("Calculating coverage with GenomicAlignments when 'norm.method = None'")
@@ -310,8 +309,7 @@ single_nuc_cov <- function(x, single.nuc.region) {
310309
}
311310

312311
bam_coverage <- function(
313-
x, bamcoverage.path, bin.size, norm.method, bc.extra.para, gr
314-
) {
312+
x, bamcoverage.path, bin.size, norm.method, bc.extra.para, gr) {
315313
# bigwig file
316314
out.bw.file <- tempfile(fileext = c(".bw"))
317315
# prepare bamCoverage cmd

0 commit comments

Comments
 (0)