@@ -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
4948get_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" ){
0 commit comments