Skip to content

Commit

Permalink
first push
Browse files Browse the repository at this point in the history
  • Loading branch information
js2264 committed Nov 25, 2023
0 parents commit 4a79c07
Show file tree
Hide file tree
Showing 43 changed files with 10,865 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
^LICENSE\.md$
^README\.Rmd$
^\.github$
^_pkgdown\.yml$
^docs$
^pkgdown$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
17 changes: 17 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
The Bioconductor community values

* an open approach to science that promotes the sharing of ideas, code, and expertise
* collaboration
* diversity and inclusivity
* a kind and welcoming environment
* community contributions

In line with these values, Bioconductor is dedicated to providing a welcoming, supportive, collegial, experience free of harassment, intimidation, and bullying regardless of:

* identity: gender, gender identity and expression, sexual orientation, disability, physical appearance, ethnicity, body size, race, age, religion, etc.
* intellectual position: approaches to data analysis, software preferences, coding style, scientific perspective, etc.
* stage of career

In order to uphold these values, members of the Bioconductor community are required to follow the Code of Conduct.The latest version of Bioconductor project Code of Conduct is available at http://bioconductor.org/about/code-of-conduct/. Please read the Code of Conduct before contributing to this project.

Thank you!
57 changes: 57 additions & 0 deletions .github/workflows/rworkflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: rworkflows
'on':
push:
branches:
- master
- main
- devel
- RELEASE_**
pull_request:
branches:
- master
- main
- devel
- RELEASE_**
jobs:
rworkflows:
permissions: write-all
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
container: ${{ matrix.config.cont }}
strategy:
fail-fast: ${{ false }}
matrix:
config:
- os: ubuntu-latest
bioc: devel
r: auto
cont: ghcr.io/bioconductor/bioconductor_docker:devel
rspm: ~
- os: macOS-latest
bioc: release
r: auto
cont: ~
rspm: ~
- os: windows-latest
bioc: release
r: auto
cont: ~
rspm: ~
steps:
- uses: neurogenomics/rworkflows@master
with:
run_bioccheck: ${{ false }}
run_rcmdcheck: ${{ true }}
as_cran: ${{ true }}
run_vignettes: ${{ true }}
has_testthat: ${{ true }}
run_covr: ${{ true }}
run_pkgdown: ${{ true }}
has_runit: ${{ false }}
has_latex: ${{ false }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run_docker: ${{ false }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
runner_os: ${{ runner.os }}
cache_version: cache-v1
docker_registry: ghcr.io
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
inst/doc
docs
*.pdf
NOTES.md
59 changes: 59 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Package: CoverageExperiment
Title: Coverage metrics over aligned genomic features of interest
Version: 0.98.0
Date: 2023-11-09
Authors@R:
person("First", "Last", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "YOUR-ORCID-ID"))
Description: What the package does (one paragraph).
License: MIT + file LICENSE
URL:
BugReports: https://support.bioconductor.org/tag/CoverageExperiment
biocViews: Software
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Depends:
R (>= 2.10),
SummarizedExperiment
Imports:
S4Vectors,
IRanges,
GenomicRanges,
GenomeInfoDb,
BiocParallel,
methods,
dplyr,
fansi,
pillar,
rlang,
cli,
purrr,
vctrs
Suggests:
tidySummarizedExperiment,
plyranges,
rtracklayer,
ggplot2,
TxDb.Hsapiens.UCSC.hg19.knownGene,
AnnotationHub,
GenomicFeatures,
BiocStyle,
knitr,
rmarkdown,
sessioninfo,
testthat (>= 3.0.0)
Config/testthat/edition: 3
VignetteBuilder: knitr
LazyData: false
Collate:
'AllClasses.R'
'AllGenerics.R'
'AllMethods.R'
'CoverageExperiment.R'
'aggregate.R'
'data.R'
'globals.R'
'print.R'
'reexports.R'
'utils.R'
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
YEAR: 2023
COPYRIGHT HOLDER: CoverageExperiment authors
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2023 CoverageExperiment authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
38 changes: 38 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Generated by roxygen2: do not edit by hand

S3method(as_tibble,CoverageExperiment)
S3method(print,CoverageExperiment)
S3method(tbl_format_header,tidyCoverageExperiment)
export(CoverageExperiment)
export(aggregate)
export(as_tibble)
exportMethods(CoverageExperiment)
exportMethods(aggregate)
exportMethods(show)
import(GenomeInfoDb)
import(GenomicRanges)
import(SummarizedExperiment)
import(methods)
importFrom(BiocParallel,bplapply)
importFrom(BiocParallel,bpparam)
importFrom(IRanges,NumericList)
importFrom(S4Vectors,aggregate)
importFrom(SummarizedExperiment,assayNames)
importFrom(cli,console_width)
importFrom(cli,symbol)
importFrom(dplyr,as_tibble)
importFrom(dplyr,bind_cols)
importFrom(dplyr,bind_rows)
importFrom(dplyr,filter)
importFrom(dplyr,mutate)
importFrom(dplyr,relocate)
importFrom(fansi,strwrap_ctl)
importFrom(pillar,align)
importFrom(pillar,get_extent)
importFrom(pillar,style_subtle)
importFrom(pillar,tbl_format_header)
importFrom(purrr,map_chr)
importFrom(rlang,names2)
importFrom(stats,qt)
importFrom(stats,setNames)
importFrom(vctrs,new_data_frame)
4 changes: 4 additions & 0 deletions R/AllClasses.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
methods::setClass(
"CoverageExperiment",
contains = c("RangedSummarizedExperiment")
)
2 changes: 2 additions & 0 deletions R/AllGenerics.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#' @export
setGeneric("CoverageExperiment", function(tracks, features, ...) standardGeneric("CoverageExperiment"))
67 changes: 67 additions & 0 deletions R/AllMethods.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#' as_tibble
#'
#' Coerce an `CoverageExperiment` object into a `tibble`
#'
#' @rdname as_tibble
#'
#' @param x an `CoverageExperiment` object
#' @param ... ignored
#' @return `tibble`
#'
#' @importFrom dplyr as_tibble
#' @export
#' @examples
#' data(ac)
#' as_tibble(ac)

as_tibble.CoverageExperiment <- function(x, ...) {
tracks <- colData(x)$track
features <- rowData(x)$features
assays <- names(assays(x))
w <- width(rowRanges(x)[[1]])[[1]]
bin <- w / length(assay(x, 1)[1, 1][[1]])
lapply(tracks, function(t) {
lapply(features, function(f) {
lapply(assays(x), `[[`, f, t) |>
stats::setNames(assays) |>
dplyr::bind_cols() |>
dplyr::mutate(
coord = seq(-w/2, w/2-1, bin),
track = t, features = f
) |>
dplyr::relocate(coord) |>
dplyr::relocate(features) |>
dplyr::relocate(track)
}) |> dplyr::bind_rows()
}) |> dplyr::bind_rows()
}

#' show
#'
#' show method for `CoverageExperiment` objects
#'
#' @rdname show
#'
#' @param object a CoverageExperiment object
#' @return `tibble`
#'
#' @export

setMethod("show", signature("CoverageExperiment"), function(object) {
w <- width(rowRanges(object)[[1]][1])
b <- w / ncol(assay(object, "coverage")[1, 1][[1]])
if (
isTRUE(x = getOption(x = "restore_SummarizedExperiment_show", default = FALSE)) |
isTRUE(x = getOption(x = "restore_CoverageExperiment_show", default = FALSE)) |
isFALSE("tidySummarizedExperiment" %in% .packages())
) {
f <- getMethod(f = "show", signature = "SummarizedExperiment",
where = asNamespace(ns = "SummarizedExperiment"))
f(object = object)
cat(paste0("width: ", w, '\n'))
cat(paste0("binning: ", b, '\n'))
}
else {
print(object)
}
})
Loading

0 comments on commit 4a79c07

Please sign in to comment.