Skip to content

Commit 6a56c41

Browse files
committed
added scCNA class
1 parent 1fb4cca commit 6a56c41

14 files changed

+207
-2
lines changed

LICENSE

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
YEAR: 2019
2+
COPYRIGHT HOLDER: CopyKit

LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MIT License
2+
3+
Copyright (c) 2019 CopyKit
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

NAMESPACE

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
# Generated by roxygen2: fake comment so roxygen2 overwrites silently.
2-
exportPattern("^[^\\.]")
1+
# Generated by roxygen2: do not edit by hand
2+
3+
export("%>%")
4+
export(readCNAVarbin)
5+
importFrom(magrittr,"%>%")

R/AllClasses.R

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
### all clases for the copykit package
2+
3+
###################################################################
4+
# defining scCNA class
5+
#'
6+
#' @export
7+
#' @import methods
8+
#' @importClassesFrom SummarizedExperiment RangedSummarizedExperiment SingleCellExperiment
9+
#' @importClassesFrom S4Vectors DataFrame SimpleList
10+
#'
11+
#'
12+
13+
.scCNA <- setClass("scCNA", contains = "SingleCellExperiment")
14+
15+
scCNA <- function(segment_ratios, ...) {
16+
cna <-
17+
SingleCellExperiment::SingleCellExperiment(list(segment_ratios = segment_ratios), ...)
18+
.scCNA(cna)
19+
}

R/readCNAVarbin.R

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#' Load data from Copy Number Experiment
2+
#'
3+
#' Creates an S4 class scCNA from the output directory of the copy number pipeline.
4+
#'
5+
#' @param dir A path for the output of the copy number pipeline.
6+
#'
7+
#' @return A S4 class object containing the segment ratios for each bin (rows) and each sample (columns).
8+
#' @export
9+
#'
10+
#' @examples
11+
readCNAVarbin <- function(dir) {
12+
# Reads a copy number directory and produces
13+
# a scCNA object as output
14+
15+
seg_data <- readr::read_tsv(fs::dir_ls(
16+
path = dir,
17+
recurse = T,
18+
glob = "*uber*seg.txt"
19+
)) %>%
20+
janitor::clean_names() %>%
21+
dplyr::select(-c(chrom,
22+
chrompos,
23+
abspos)) %>%
24+
as.data.frame()
25+
26+
cna_obj <- scCNA(list(segment_ratios = seg_data))
27+
28+
}

R/utils-pipe.R

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#' Pipe operator
2+
#'
3+
#' See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details.
4+
#'
5+
#' @name %>%
6+
#' @rdname pipe
7+
#' @keywords internal
8+
#' @export
9+
#' @importFrom magrittr %>%
10+
#' @usage lhs \%>\% rhs
11+
NULL

README.Rmd

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
output: github_document
3+
---
4+
5+
<!-- README.md is generated from README.Rmd. Please edit that file -->
6+
7+
```{r, include = FALSE}
8+
knitr::opts_chunk$set(
9+
collapse = TRUE,
10+
comment = "#>",
11+
fig.path = "man/figures/README-",
12+
out.width = "100%"
13+
)
14+
```
15+
# CopyKit
16+
17+
<!-- badges: start -->
18+
<!-- badges: end -->
19+
20+
The goal of copykit is to provide a toolkit for the analysis of single-cell copy number data
21+
22+
## Installation
23+
24+
You can install the development version of CopyKit from github with:
25+
26+
``` r
27+
devtools::install_github()
28+
```
29+
30+
## Example
31+
32+
This is a basic example which shows you how to solve a common problem:
33+
34+
```{r example}
35+
# library(copykit)
36+
## basic example code
37+
```
38+
39+

README.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
<!-- README.md is generated from README.Rmd. Please edit that file -->
3+
4+
# CopyKit
5+
6+
<!-- badges: start -->
7+
8+
<!-- badges: end -->
9+
10+
The goal of copykit is to provide a toolkit for the analysis of
11+
single-cell copy number data
12+
13+
## Installation
14+
15+
You can install the development version of CopyKit from github with:
16+
17+
``` r
18+
devtools::install_github()
19+
```
20+
21+
## Example
22+
23+
This is a basic example which shows you how to solve a common problem:
24+
25+
``` r
26+
# library(copykit)
27+
## basic example code
28+
```

inst/WORDLIST

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CopyKit
2+
github

man/pipe.Rd

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/readCNAVarbin.Rd

+17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/scCNA-class.Rd

+16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/spelling.R

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
if(requireNamespace('spelling', quietly = TRUE))
2+
spelling::spell_check_test(vignettes = TRUE, error = FALSE,
3+
skip_on_cran = TRUE)

tests/testthat.R

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
library(testthat)
2+
library(copykit)
3+
4+
test_check("copykit")

0 commit comments

Comments
 (0)