Skip to content

Commit 5dbf97c

Browse files
committed
Make package public
This is a breaking change. We remove the default argument for the `get_gft()` function to remove dependence on the Kwan lab file system. Now, a file path to a GTF must be provided. Additionally, `perform_edger()` can now receive for the `gtf` argument either a GTF dataframe object or a file path to a GTF.
1 parent 2fdccf2 commit 5dbf97c

5 files changed

Lines changed: 34 additions & 17 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: kwanlibr
22
Title: edgeR wrapper for simple differential expression analysis
3-
Version: 1.2.3
3+
Version: 1.3.0
44
Authors@R:
55
c(
66
person("Yaman", "Qalieh", , "yamanq@umich.edu", role = c("aut", "cre"),

R/core_edger_analyzer.R

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,16 @@ VOLCANO_RED = '#d80303'
3737
#'
3838
#' get_gtf(gtf, verbose) returns the reference specified by
3939
#' the path gtf.
40-
#' @param gtf Absolute path to the reference. Default is the GENCODE annotation
41-
#' for mm10/GRCm38
40+
#' @param gtf Absolute path to the reference
4241
#' @param verbose Set to TRUE to print number of genes in the reference
4342
#' @return A dataframe of gene annotations with 3 columns: the ensembl
4443
#' `gene_id`, the `gene_type`, and `gene_name` (gene symbol)
4544
#' @export
4645
#' @examples
47-
#' get_gtf(gtf='/nfs/turbo/umms-kykwan/projects/reference/gtf/gencode.vM14.primary_assembly.ERCC.annotation.gtf')
46+
#' get_gtf(gtf='reference/gtf/gencode.vM14.primary_assembly.ERCC.annotation.gtf')
4847

4948
get_gtf <- function(
50-
gtf='/nfs/turbo/umms-kykwan/projects/reference/gtf/gencode.vM14.primary_assembly.annotation.gtf',
49+
gtf,
5150
verbose=FALSE
5251
) {
5352

@@ -81,7 +80,7 @@ get_gtf <- function(
8180
#' refers to the batch of the sample. If NULL, no batch correction
8281
#' @param filePrefix Prefix to add to filenames (e.g. if they are in a different
8382
#' directory). If NULL, search the current working directory
84-
#' @param gtf A dataframe of the reference genome, generated by `kwanlibr::get_gtf`
83+
#' @param gtf Either a dataframe of the reference genome generated by `kwanlibr::get_gtf`, or a path to the reference genome.
8584
#' @param saveName Filename to save edgeR tables under. Saves top 5k genes and
8685
#' all genes. If NULL, do not save tables.
8786
#' @return A dataframe of the edgeR analysis
@@ -104,8 +103,12 @@ perform_edger <- function(
104103
}
105104
filePrefix <- gsub("/+$", "", filePrefix)
106105

107-
if (class(gtf) == "NULL") {
108-
gtf <- kwanlibr::get_gtf()
106+
if (class(gtf) == "character") {
107+
paste0("Getting GTF from ", gtf)
108+
gtf <- kwanlibr::get_gtf(gtf)
109+
}
110+
else if (class(gtf) != "data.frame") {
111+
stop("Provide a GTF with kwanlibr::get_gtf()")
109112
}
110113

111114
if(class(batchCol) == "NULL"){

informal_tests/test_core_edger_analyzer.R

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ exp_samples = kwanlibr::label_control_samples(exp_samples, 'Condition', 'ctrl')
3434
# ===================
3535
# Test perform_edger
3636
# ===================
37+
38+
# GTF object
3739
lrt = kwanlibr::perform_edger(
3840
exp_samples,
3941
filePrefix = config$paths$gene_counts_dir,
@@ -42,6 +44,23 @@ lrt = kwanlibr::perform_edger(
4244
saveName = paste0(config$paths$test_results_dump, 'edger_lrt')
4345
)
4446

47+
# GTF file path
48+
lrt = kwanlibr::perform_edger(
49+
exp_samples,
50+
filePrefix = config$paths$gene_counts_dir,
51+
idCol = 'Pool.Name',
52+
gtf=config$paths$gtf,
53+
saveName = paste0(config$paths$test_results_dump, 'edger_lrt')
54+
)
55+
56+
# no GFT
57+
lrt = kwanlibr::perform_edger(
58+
exp_samples,
59+
filePrefix = config$paths$gene_counts_dir,
60+
idCol = 'Pool.Name',
61+
saveName = paste0(config$paths$test_results_dump, 'edger_lrt')
62+
)
63+
4564
# ===================
4665
# Test make_volcano_dataframe
4766
# ===================

man/get_gtf.Rd

Lines changed: 3 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/perform_edger.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)